diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php new file mode 100644 index 00000000000..18e0865f387 Binary files /dev/null and b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTts.php differ diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php new file mode 100644 index 00000000000..15686e8dd40 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/GPBMetadata/Google/Cloud/Texttospeech/V1/CloudTtsLrs.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' + + +0google/cloud/texttospeech/v1/cloud_tts_lrs.protogoogle.cloud.texttospeech.v1google/api/client.protogoogle/api/field_behavior.proto,google/cloud/texttospeech/v1/cloud_tts.proto#google/longrunning/operations.protogoogle/protobuf/timestamp.proto" +SynthesizeLongAudioRequest +parent ( @ +input ( 2,.google.cloud.texttospeech.v1.SynthesisInputBAD + audio_config ( 2).google.cloud.texttospeech.v1.AudioConfigBA +output_gcs_uri ( BAF +voice ( 22.google.cloud.texttospeech.v1.VoiceSelectionParamsBA" +SynthesizeLongAudioResponse" +SynthesizeLongAudioMetadata. + +start_time ( 2.google.protobuf.Timestamp8 +last_update_time ( 2.google.protobuf.TimestampB +progress_percentage (2 +TextToSpeechLongAudioSynthesize +SynthesizeLongAudio8.google.cloud.texttospeech.v1.SynthesizeLongAudioRequest.google.longrunning.Operation"At +8google.cloud.texttospeech.v1.SynthesizeLongAudioResponse8google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata<"7/v1/{parent=projects/*/locations/*}:synthesizeLongAudio:*OAtexttospeech.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB + com.google.cloud.texttospeech.v1B#TextToSpeechLongAudioSynthesisProtoPZDcloud.google.com/go/texttospeech/apiv1/texttospeechpb;texttospeechpbGoogle.Cloud.TextToSpeech.V1Google\\Cloud\\TextToSpeech\\V1Google::Cloud::TextToSpeech::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php new file mode 100644 index 00000000000..7d299d36de5 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioConfig.php @@ -0,0 +1,329 @@ +google.cloud.texttospeech.v1.AudioConfig + */ +class AudioConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_encoding = 0; + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $speaking_rate = 0.0; + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $pitch = 0.0; + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + protected $volume_gain_db = 0.0; + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $sample_rate_hertz = 0; + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + */ + private $effects_profile_id; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $audio_encoding + * Required. The format of the audio byte stream. + * @type float $speaking_rate + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * @type float $pitch + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * @type float $volume_gain_db + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * @type int $sample_rate_hertz + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * @type array|\Google\Protobuf\Internal\RepeatedField $effects_profile_id + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAudioEncoding() + { + return $this->audio_encoding; + } + + /** + * Required. The format of the audio byte stream. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAudioEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\AudioEncoding::class); + $this->audio_encoding = $var; + + return $this; + } + + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getSpeakingRate() + { + return $this->speaking_rate; + } + + /** + * Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is + * the normal native speed supported by the specific voice. 2.0 is twice as + * fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 + * speed. Any other values < 0.25 or > 4.0 will return an error. + * + * Generated from protobuf field double speaking_rate = 2 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setSpeakingRate($var) + { + GPBUtil::checkDouble($var); + $this->speaking_rate = $var; + + return $this; + } + + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getPitch() + { + return $this->pitch; + } + + /** + * Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means + * increase 20 semitones from the original pitch. -20 means decrease 20 + * semitones from the original pitch. + * + * Generated from protobuf field double pitch = 3 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setPitch($var) + { + GPBUtil::checkDouble($var); + $this->pitch = $var; + + return $this; + } + + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getVolumeGainDb() + { + return $this->volume_gain_db; + } + + /** + * Optional. Input only. Volume gain (in dB) of the normal native volume + * supported by the specific voice, in the range [-96.0, 16.0]. If unset, or + * set to a value of 0.0 (dB), will play at normal native signal amplitude. A + * value of -6.0 (dB) will play at approximately half the amplitude of the + * normal native signal amplitude. A value of +6.0 (dB) will play at + * approximately twice the amplitude of the normal native signal amplitude. + * Strongly recommend not to exceed +10 (dB) as there's usually no effective + * increase in loudness for any value greater than that. + * + * Generated from protobuf field double volume_gain_db = 4 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setVolumeGainDb($var) + { + GPBUtil::checkDouble($var); + $this->volume_gain_db = $var; + + return $this; + } + + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * Optional. The synthesis sample rate (in hertz) for this audio. When this is + * specified in SynthesizeSpeechRequest, if this is different from the voice's + * natural sample rate, then the synthesizer will honor this request by + * converting to the desired sample rate (which might result in worse audio + * quality), unless the specified sample rate is not supported for the + * encoding chosen, in which case it will fail the request and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf field int32 sample_rate_hertz = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEffectsProfileId() + { + return $this->effects_profile_id; + } + + /** + * Optional. Input only. An identifier which selects 'audio effects' profiles + * that are applied on (post synthesized) text to speech. Effects are applied + * on top of each other in the order they are given. See + * [audio + * profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for + * current supported profile ids. + * + * Generated from protobuf field repeated string effects_profile_id = 6 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEffectsProfileId($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->effects_profile_id = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php new file mode 100644 index 00000000000..1a3ee8800a9 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/AudioEncoding.php @@ -0,0 +1,90 @@ +google.cloud.texttospeech.v1.AudioEncoding + */ +class AudioEncoding +{ + /** + * Not specified. Will return result + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + * + * Generated from protobuf enum AUDIO_ENCODING_UNSPECIFIED = 0; + */ + const AUDIO_ENCODING_UNSPECIFIED = 0; + /** + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * Audio content returned as LINEAR16 also contains a WAV header. + * + * Generated from protobuf enum LINEAR16 = 1; + */ + const LINEAR16 = 1; + /** + * MP3 audio at 32kbps. + * + * Generated from protobuf enum MP3 = 2; + */ + const MP3 = 2; + /** + * Opus encoded audio wrapped in an ogg container. The result will be a + * file which can be played natively on Android, and in browsers (at least + * Chrome and Firefox). The quality of the encoding is considerably higher + * than MP3 while using approximately the same bitrate. + * + * Generated from protobuf enum OGG_OPUS = 3; + */ + const OGG_OPUS = 3; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * Audio content returned as MULAW also contains a WAV header. + * + * Generated from protobuf enum MULAW = 5; + */ + const MULAW = 5; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/A-law. + * Audio content returned as ALAW also contains a WAV header. + * + * Generated from protobuf enum ALAW = 6; + */ + const ALAW = 6; + + private static $valueToName = [ + self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED', + self::LINEAR16 => 'LINEAR16', + self::MP3 => 'MP3', + self::OGG_OPUS => 'OGG_OPUS', + self::MULAW => 'MULAW', + self::ALAW => 'ALAW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php new file mode 100644 index 00000000000..bc208aa890c --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams.php @@ -0,0 +1,106 @@ +google.cloud.texttospeech.v1.CustomVoiceParams + */ +class CustomVoiceParams extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $model = ''; + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $reported_usage = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Required. The name of the AutoML model that synthesizes the custom voice. + * @type int $reported_usage + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Required. The name of the AutoML model that synthesizes the custom voice. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return int + * @deprecated + */ + public function getReportedUsage() + { + @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); + return $this->reported_usage; + } + + /** + * Optional. Deprecated. The usage of the synthesized audio to be reported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage reported_usage = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + * @deprecated + */ + public function setReportedUsage($var) + { + @trigger_error('reported_usage is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams\ReportedUsage::class); + $this->reported_usage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php new file mode 100644 index 00000000000..6e8d93d63f0 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/CustomVoiceParams/ReportedUsage.php @@ -0,0 +1,68 @@ +google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage + */ +class ReportedUsage +{ + /** + * Request with reported usage unspecified will be rejected. + * + * Generated from protobuf enum REPORTED_USAGE_UNSPECIFIED = 0; + */ + const REPORTED_USAGE_UNSPECIFIED = 0; + /** + * For scenarios where the synthesized audio is not downloadable and can + * only be used once. For example, real-time request in IVR system. + * + * Generated from protobuf enum REALTIME = 1; + */ + const REALTIME = 1; + /** + * For scenarios where the synthesized audio is downloadable and can be + * reused. For example, the synthesized audio is downloaded, stored in + * customer service system and played repeatedly. + * + * Generated from protobuf enum OFFLINE = 2; + */ + const OFFLINE = 2; + + private static $valueToName = [ + self::REPORTED_USAGE_UNSPECIFIED => 'REPORTED_USAGE_UNSPECIFIED', + self::REALTIME => 'REALTIME', + self::OFFLINE => 'OFFLINE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReportedUsage::class, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams_ReportedUsage::class); + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php new file mode 100644 index 00000000000..a1f5971ee7a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesRequest.php @@ -0,0 +1,115 @@ +google.cloud.texttospeech.v1.ListVoicesRequest + */ +class ListVoicesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $language_code = ''; + + /** + * @param string $languageCode Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * @return \Google\Cloud\TextToSpeech\V1\ListVoicesRequest + * + * @experimental + */ + public static function build(string $languageCode): self + { + return (new self()) + ->setLanguageCode($languageCode); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php new file mode 100644 index 00000000000..d28b7ae0e15 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/ListVoicesResponse.php @@ -0,0 +1,67 @@ +google.cloud.texttospeech.v1.ListVoicesResponse + */ +class ListVoicesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + */ + private $voices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $voices + * The list of voices. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVoices() + { + return $this->voices; + } + + /** + * The list of voices. + * + * Generated from protobuf field repeated .google.cloud.texttospeech.v1.Voice voices = 1; + * @param array<\Google\Cloud\TextToSpeech\V1\Voice>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVoices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\TextToSpeech\V1\Voice::class); + $this->voices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php new file mode 100644 index 00000000000..ca9b5bfd29a --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SsmlVoiceGender.php @@ -0,0 +1,73 @@ +google.cloud.texttospeech.v1.SsmlVoiceGender + */ +class SsmlVoiceGender +{ + /** + * An unspecified gender. + * In VoiceSelectionParams, this means that the client doesn't care which + * gender the selected voice will have. In the Voice field of + * ListVoicesResponse, this may mean that the voice doesn't fit any of the + * other categories in this enum, or that the gender of the voice isn't known. + * + * Generated from protobuf enum SSML_VOICE_GENDER_UNSPECIFIED = 0; + */ + const SSML_VOICE_GENDER_UNSPECIFIED = 0; + /** + * A male voice. + * + * Generated from protobuf enum MALE = 1; + */ + const MALE = 1; + /** + * A female voice. + * + * Generated from protobuf enum FEMALE = 2; + */ + const FEMALE = 2; + /** + * A gender-neutral voice. This voice is not yet supported. + * + * Generated from protobuf enum NEUTRAL = 3; + */ + const NEUTRAL = 3; + + private static $valueToName = [ + self::SSML_VOICE_GENDER_UNSPECIFIED => 'SSML_VOICE_GENDER_UNSPECIFIED', + self::MALE => 'MALE', + self::FEMALE => 'FEMALE', + self::NEUTRAL => 'NEUTRAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php new file mode 100644 index 00000000000..4e8f0065c3c --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesisInput.php @@ -0,0 +1,123 @@ +google.cloud.texttospeech.v1.SynthesisInput + */ +class SynthesisInput extends \Google\Protobuf\Internal\Message +{ + protected $input_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The raw text to be synthesized. + * @type string $ssml + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @return string + */ + public function getSsml() + { + return $this->readOneof(2); + } + + public function hasSsml() + { + return $this->hasOneof(2); + } + + /** + * The SSML document to be synthesized. The SSML document must be valid + * and well-formed. Otherwise the RPC will fail and return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For + * more information, see + * [SSML](https://cloud.google.com/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @param string $var + * @return $this + */ + public function setSsml($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getInputSource() + { + return $this->whichOneof("input_source"); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php new file mode 100644 index 00000000000..ab9407b4e61 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioMetadata.php @@ -0,0 +1,162 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata + */ +class SynthesizeLongAudioMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @deprecated + */ + protected $last_update_time = null; + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + */ + protected $progress_percentage = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Time when the request was received. + * @type \Google\Protobuf\Timestamp $last_update_time + * Deprecated. Do not use. + * @type float $progress_percentage + * The progress of the most recent processing update in percentage, ie. 70.0%. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @return \Google\Protobuf\Timestamp|null + * @deprecated + */ + public function getLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + unset($this->last_update_time); + } + + /** + * Deprecated. Do not use. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2 [deprecated = true]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + * @deprecated + */ + public function setLastUpdateTime($var) + { + @trigger_error('last_update_time is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + * @return float + */ + public function getProgressPercentage() + { + return $this->progress_percentage; + } + + /** + * The progress of the most recent processing update in percentage, ie. 70.0%. + * + * Generated from protobuf field double progress_percentage = 3; + * @param float $var + * @return $this + */ + public function setProgressPercentage($var) + { + GPBUtil::checkDouble($var); + $this->progress_percentage = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php new file mode 100644 index 00000000000..4e937eb04a6 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioRequest.php @@ -0,0 +1,250 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioRequest + */ +class SynthesizeLongAudioRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * While Long Audio is in preview, SSML is temporarily unsupported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_config = null; + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_gcs_uri = ''; + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The resource states of the request in the form of + * `projects/*/locations/*`. + * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input + * Required. The Synthesizer requires either plain text or SSML as input. + * While Long Audio is in preview, SSML is temporarily unsupported. + * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config + * Required. The configuration of the synthesized audio. + * @type string $output_gcs_uri + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The resource states of the request in the form of + * `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * While Long Audio is in preview, SSML is temporarily unsupported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * While Long Audio is in preview, SSML is temporarily unsupported. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); + $this->input = $var; + + return $this; + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null + */ + public function getAudioConfig() + { + return $this->audio_config; + } + + public function hasAudioConfig() + { + return isset($this->audio_config); + } + + public function clearAudioConfig() + { + unset($this->audio_config); + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var + * @return $this + */ + public function setAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); + $this->audio_config = $var; + + return $this; + } + + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputGcsUri() + { + return $this->output_gcs_uri; + } + + /** + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * + * Generated from protobuf field string output_gcs_uri = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->output_gcs_uri = $var; + + return $this; + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null + */ + public function getVoice() + { + return $this->voice; + } + + public function hasVoice() + { + return isset($this->voice); + } + + public function clearVoice() + { + unset($this->voice); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); + $this->voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php new file mode 100644 index 00000000000..e1a3d25b413 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeLongAudioResponse.php @@ -0,0 +1,33 @@ +google.cloud.texttospeech.v1.SynthesizeLongAudioResponse + */ +class SynthesizeLongAudioResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTtsLrs::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php new file mode 100644 index 00000000000..70131ca15cc --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechRequest.php @@ -0,0 +1,182 @@ +google.cloud.texttospeech.v1.SynthesizeSpeechRequest + */ +class SynthesizeSpeechRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $voice = null; + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_config = null; + + /** + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * + * @return \Google\Cloud\TextToSpeech\V1\SynthesizeSpeechRequest + * + * @experimental + */ + public static function build(\Google\Cloud\TextToSpeech\V1\SynthesisInput $input, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice, \Google\Cloud\TextToSpeech\V1\AudioConfig $audioConfig): self + { + return (new self()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\TextToSpeech\V1\SynthesisInput $input + * Required. The Synthesizer requires either plain text or SSML as input. + * @type \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * @type \Google\Cloud\TextToSpeech\V1\AudioConfig $audio_config + * Required. The configuration of the synthesized audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\SynthesisInput|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The Synthesizer requires either plain text or SSML as input. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SynthesisInput input = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\SynthesisInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\SynthesisInput::class); + $this->input = $var; + + return $this; + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams|null + */ + public function getVoice() + { + return $this->voice; + } + + public function hasVoice() + { + return isset($this->voice); + } + + public function clearVoice() + { + unset($this->voice); + } + + /** + * Required. The desired voice of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.VoiceSelectionParams voice = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams $var + * @return $this + */ + public function setVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\VoiceSelectionParams::class); + $this->voice = $var; + + return $this; + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\TextToSpeech\V1\AudioConfig|null + */ + public function getAudioConfig() + { + return $this->audio_config; + } + + public function hasAudioConfig() + { + return isset($this->audio_config); + } + + public function clearAudioConfig() + { + unset($this->audio_config); + } + + /** + * Required. The configuration of the synthesized audio. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.AudioConfig audio_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\TextToSpeech\V1\AudioConfig $var + * @return $this + */ + public function setAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\AudioConfig::class); + $this->audio_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php new file mode 100644 index 00000000000..bfe3329eb5e --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/SynthesizeSpeechResponse.php @@ -0,0 +1,83 @@ +google.cloud.texttospeech.v1.SynthesizeSpeechResponse + */ +class SynthesizeSpeechResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + */ + protected $audio_content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio_content + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + * @return string + */ + public function getAudioContent() + { + return $this->audio_content; + } + + /** + * The audio data bytes encoded as specified in the request, including the + * header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). + * For LINEAR16 audio, we include the WAV header. Note: as + * with all bytes fields, protobuffers use a pure binary representation, + * whereas JSON representations use base64. + * + * Generated from protobuf field bytes audio_content = 1; + * @param string $var + * @return $this + */ + public function setAudioContent($var) + { + GPBUtil::checkString($var, False); + $this->audio_content = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php new file mode 100644 index 00000000000..f5364296539 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/Voice.php @@ -0,0 +1,177 @@ +google.cloud.texttospeech.v1.Voice + */ +class Voice extends \Google\Protobuf\Internal\Message +{ + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + */ + private $language_codes; + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + */ + protected $ssml_gender = 0; + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + */ + protected $natural_sample_rate_hertz = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * @type string $name + * The name of this voice. Each distinct voice has a unique name. + * @type int $ssml_gender + * The gender of this voice. + * @type int $natural_sample_rate_hertz + * The natural sample rate (in hertz) for this voice. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageCodes() + { + return $this->language_codes; + } + + /** + * The languages that this voice supports, expressed as + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. + * "en-US", "es-419", "cmn-tw"). + * + * Generated from protobuf field repeated string language_codes = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_codes = $arr; + + return $this; + } + + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this voice. Each distinct voice has a unique name. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @return int + */ + public function getSsmlGender() + { + return $this->ssml_gender; + } + + /** + * The gender of this voice. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @param int $var + * @return $this + */ + public function setSsmlGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); + $this->ssml_gender = $var; + + return $this; + } + + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + * @return int + */ + public function getNaturalSampleRateHertz() + { + return $this->natural_sample_rate_hertz; + } + + /** + * The natural sample rate (in hertz) for this voice. + * + * Generated from protobuf field int32 natural_sample_rate_hertz = 4; + * @param int $var + * @return $this + */ + public function setNaturalSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->natural_sample_rate_hertz = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php new file mode 100644 index 00000000000..18d2d67c212 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/proto/src/Google/Cloud/TextToSpeech/V1/VoiceSelectionParams.php @@ -0,0 +1,247 @@ +google.cloud.texttospeech.v1.VoiceSelectionParams + */ +class VoiceSelectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + /** + * The name of the voice. If not set, the service will choose a + * voice based on the other parameters such as language_code and gender. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + */ + protected $ssml_gender = 0; + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + */ + protected $custom_voice = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * @type string $name + * The name of the voice. If not set, the service will choose a + * voice based on the other parameters such as language_code and gender. + * @type int $ssml_gender + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * @type \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $custom_voice + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Texttospeech\V1\CloudTts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. The language (and potentially also the region) of the voice + * expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag, e.g. "en-US". This should not include a script tag (e.g. use + * "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred + * from the input provided in the SynthesisInput. The TTS service + * will use this parameter to help choose an appropriate voice. Note that + * the TTS service may choose a voice with a slightly different language code + * than the one selected; it may substitute a different region + * (e.g. using en-US rather than en-CA if there isn't a Canadian voice + * available), or even a different language, e.g. using "nb" (Norwegian + * Bokmal) instead of "no" (Norwegian)". + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The name of the voice. If not set, the service will choose a + * voice based on the other parameters such as language_code and gender. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the voice. If not set, the service will choose a + * voice based on the other parameters such as language_code and gender. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @return int + */ + public function getSsmlGender() + { + return $this->ssml_gender; + } + + /** + * The preferred gender of the voice. If not set, the service will + * choose a voice based on the other parameters such as language_code and + * name. Note that this is only a preference, not requirement; if a + * voice of the appropriate gender is not available, the synthesizer should + * substitute a voice with a different gender rather than failing the request. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.SsmlVoiceGender ssml_gender = 3; + * @param int $var + * @return $this + */ + public function setSsmlGender($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\TextToSpeech\V1\SsmlVoiceGender::class); + $this->ssml_gender = $var; + + return $this; + } + + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + * @return \Google\Cloud\TextToSpeech\V1\CustomVoiceParams|null + */ + public function getCustomVoice() + { + return $this->custom_voice; + } + + public function hasCustomVoice() + { + return isset($this->custom_voice); + } + + public function clearCustomVoice() + { + unset($this->custom_voice); + } + + /** + * The configuration for a custom voice. If [CustomVoiceParams.model] is set, + * the service will choose the custom voice matching the specified + * configuration. + * + * Generated from protobuf field .google.cloud.texttospeech.v1.CustomVoiceParams custom_voice = 4; + * @param \Google\Cloud\TextToSpeech\V1\CustomVoiceParams $var + * @return $this + */ + public function setCustomVoice($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\TextToSpeech\V1\CustomVoiceParams::class); + $this->custom_voice = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php new file mode 100644 index 00000000000..2a4357540ab --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/list_voices.php @@ -0,0 +1,57 @@ +listVoices($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END texttospeech_v1_generated_TextToSpeech_ListVoices_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php new file mode 100644 index 00000000000..f6bac9ae2c3 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechClient/synthesize_speech.php @@ -0,0 +1,94 @@ +setLanguageCode($voiceLanguageCode); + $audioConfig = (new AudioConfig()) + ->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + + // Call the API and handle any network failures. + try { + /** @var SynthesizeSpeechResponse $response */ + $response = $textToSpeechClient->synthesizeSpeech($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $voiceLanguageCode = '[LANGUAGE_CODE]'; + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + + synthesize_speech_sample($voiceLanguageCode, $audioConfigAudioEncoding); +} +// [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php new file mode 100644 index 00000000000..cf9eaa3f258 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php @@ -0,0 +1,89 @@ +setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var SynthesizeLongAudioResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + + synthesize_long_audio_sample($audioConfigAudioEncoding); +} +// [END texttospeech_v1_generated_TextToSpeechLongAudioSynthesize_SynthesizeLongAudio_sync] diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php new file mode 100644 index 00000000000..73a2719a621 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechClient.php @@ -0,0 +1,269 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName(string $project, string $location, string $model): string + { + return self::getPathTemplate('model')->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'texttospeech.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Returns a list of Voice supported for synthesis. + * + * The async variant is {@see TextToSpeechClient::listVoicesAsync()} . + * + * @example samples/V1/TextToSpeechClient/list_voices.php + * + * @param ListVoicesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ListVoicesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listVoices(ListVoicesRequest $request, array $callOptions = []): ListVoicesResponse + { + return $this->startApiCall('ListVoices', $request, $callOptions)->wait(); + } + + /** + * Synthesizes speech synchronously: receive results after all text input + * has been processed. + * + * The async variant is {@see TextToSpeechClient::synthesizeSpeechAsync()} . + * + * @example samples/V1/TextToSpeechClient/synthesize_speech.php + * + * @param SynthesizeSpeechRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 SynthesizeSpeechResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function synthesizeSpeech(SynthesizeSpeechRequest $request, array $callOptions = []): SynthesizeSpeechResponse + { + return $this->startApiCall('SynthesizeSpeech', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php new file mode 100644 index 00000000000..2e91b8f6acf --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Client/TextToSpeechLongAudioSynthesizeClient.php @@ -0,0 +1,274 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName(string $project, string $location, string $model): string + { + return self::getPathTemplate('model')->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'texttospeech.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Synthesizes long form text asynchronously. + * + * The async variant is + * {@see TextToSpeechLongAudioSynthesizeClient::synthesizeLongAudioAsync()} . + * + * @example samples/V1/TextToSpeechLongAudioSynthesizeClient/synthesize_long_audio.php + * + * @param SynthesizeLongAudioRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function synthesizeLongAudio(SynthesizeLongAudioRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('SynthesizeLongAudio', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php new file mode 100644 index 00000000000..fabf3098897 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechGapicClient.php @@ -0,0 +1,342 @@ +listVoices(); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechClient}. + */ +class TextToSpeechGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeech'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.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 static $modelNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_rest_client_config.php', + ], + ], + ]; + } + + private static function getModelNameTemplate() + { + if (self::$modelNameTemplate == null) { + self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); + } + + return self::$modelNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'model' => self::getModelNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName($project, $location, $model) + { + return self::getModelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'texttospeech.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); + } + + /** + * Returns a list of Voice supported for synthesis. + * + * Sample code: + * ``` + * $textToSpeechClient = new TextToSpeechClient(); + * try { + * $response = $textToSpeechClient->listVoices(); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * Optional. Recommended. + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * If not specified, the API will return all supported voices. + * If specified, the ListVoices call will only return voices that can be used + * to synthesize this language_code. For example, if you specify `"en-NZ"`, + * all `"en-NZ"` voices will be returned. If you specify `"no"`, both + * `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be + * returned. + * @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\TextToSpeech\V1\ListVoicesResponse + * + * @throws ApiException if the remote call fails + */ + public function listVoices(array $optionalArgs = []) + { + $request = new ListVoicesRequest(); + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + return $this->startCall('ListVoices', ListVoicesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Synthesizes speech synchronously: receive results after all text input + * has been processed. + * + * Sample code: + * ``` + * $textToSpeechClient = new TextToSpeechClient(); + * try { + * $input = new SynthesisInput(); + * $voice = new VoiceSelectionParams(); + * $audioConfig = new AudioConfig(); + * $response = $textToSpeechClient->synthesizeSpeech($input, $voice, $audioConfig); + * } finally { + * $textToSpeechClient->close(); + * } + * ``` + * + * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * @param VoiceSelectionParams $voice Required. The desired voice of the synthesized audio. + * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * @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\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse + * + * @throws ApiException if the remote call fails + */ + public function synthesizeSpeech($input, $voice, $audioConfig, array $optionalArgs = []) + { + $request = new SynthesizeSpeechRequest(); + $request->setInput($input); + $request->setVoice($voice); + $request->setAudioConfig($audioConfig); + return $this->startCall('SynthesizeSpeech', SynthesizeSpeechResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php new file mode 100644 index 00000000000..95e91b9997e --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/Gapic/TextToSpeechLongAudioSynthesizeGapicClient.php @@ -0,0 +1,404 @@ +synthesizeLongAudio($input, $audioConfig); + * $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 = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $textToSpeechLongAudioSynthesizeClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\TextToSpeech\V1\Client\TextToSpeechLongAudioSynthesizeClient}. + */ +class TextToSpeechLongAudioSynthesizeGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'texttospeech.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'texttospeech.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 static $modelNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/text_to_speech_long_audio_synthesize_rest_client_config.php', + ], + ], + ]; + } + + private static function getModelNameTemplate() + { + if (self::$modelNameTemplate == null) { + self::$modelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/models/{model}'); + } + + return self::$modelNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'model' => self::getModelNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a model + * resource. + * + * @param string $project + * @param string $location + * @param string $model + * + * @return string The formatted model resource. + */ + public static function modelName($project, $location, $model) + { + return self::getModelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'model' => $model, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - model: projects/{project}/locations/{location}/models/{model} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'texttospeech.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); + } + + /** + * Synthesizes long form text asynchronously. + * + * Sample code: + * ``` + * $textToSpeechLongAudioSynthesizeClient = new TextToSpeechLongAudioSynthesizeClient(); + * try { + * $input = new SynthesisInput(); + * $audioConfig = new AudioConfig(); + * $operationResponse = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $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 = $textToSpeechLongAudioSynthesizeClient->synthesizeLongAudio($input, $audioConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $textToSpeechLongAudioSynthesizeClient->resumeOperation($operationName, 'synthesizeLongAudio'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $textToSpeechLongAudioSynthesizeClient->close(); + * } + * ``` + * + * @param SynthesisInput $input Required. The Synthesizer requires either plain text or SSML as input. + * While Long Audio is in preview, SSML is temporarily unsupported. + * @param AudioConfig $audioConfig Required. The configuration of the synthesized audio. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * The resource states of the request in the form of + * `projects/*/locations/*`. + * @type string $outputGcsUri + * Required. Specifies a Cloud Storage URI for the synthesis results. Must be + * specified in the format: `gs://bucket_name/object_name`, and the bucket + * must already exist. + * @type VoiceSelectionParams $voice + * Required. The desired voice of the synthesized audio. + * @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 synthesizeLongAudio($input, $audioConfig, array $optionalArgs = []) + { + $request = new SynthesizeLongAudioRequest(); + $requestParamHeaders = []; + $request->setInput($input); + $request->setAudioConfig($audioConfig); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['outputGcsUri'])) { + $request->setOutputGcsUri($optionalArgs['outputGcsUri']); + } + + if (isset($optionalArgs['voice'])) { + $request->setVoice($optionalArgs['voice']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('SynthesizeLongAudio', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php b/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php new file mode 100644 index 00000000000..0942280d085 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/TextToSpeechClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeech' => [ + 'ListVoices' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\TextToSpeech\V1\ListVoicesResponse', + ], + 'SynthesizeSpeech' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\TextToSpeech\V1\SynthesizeSpeechResponse', + ], + 'templateMap' => [ + 'model' => 'projects/{project}/locations/{location}/models/{model}', + ], + ], + ], +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json new file mode 100644 index 00000000000..1f2cda4e7cf --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_client_config.json @@ -0,0 +1,37 @@ +{ + "interfaces": { + "google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 5000000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 5000000, + "total_timeout_millis": 5000000 + } + }, + "methods": { + "SynthesizeLongAudio": { + "timeout_millis": 5000000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php new file mode 100644 index 00000000000..56245da1690 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_descriptor_config.php @@ -0,0 +1,30 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ + 'SynthesizeLongAudio' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioResponse', + 'metadataReturnType' => '\Google\Cloud\TextToSpeech\V1\SynthesizeLongAudioMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'model' => 'projects/{project}/locations/{location}/models/{model}', + ], + ], + ], +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php new file mode 100644 index 00000000000..48d198772c9 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_long_audio_synthesize_rest_client_config.php @@ -0,0 +1,45 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeechLongAudioSynthesize' => [ + 'SynthesizeLongAudio' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:synthesizeLongAudio', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php new file mode 100644 index 00000000000..c3996623a6d --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/src/V1/resources/text_to_speech_rest_client_config.php @@ -0,0 +1,42 @@ + [ + 'google.cloud.texttospeech.v1.TextToSpeech' => [ + 'ListVoices' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/voices', + ], + 'SynthesizeSpeech' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/text:synthesize', + 'body' => '*', + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php new file mode 100644 index 00000000000..ab6c490a52e --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechClientTest.php @@ -0,0 +1,228 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechClient($options); + } + + /** @test */ + public function listVoicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $request = new ListVoicesRequest(); + $response = $gapicClient->listVoices($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVoicesExceptionTest() + { + $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); + $request = new ListVoicesRequest(); + try { + $gapicClient->listVoices($request); + // 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()); + } + + /** @test */ + public function synthesizeSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new SynthesizeSpeechResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeSpeech($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); + $actualValue = $actualRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualRequestObject->getVoice(); + $this->assertProtobufEquals($voice, $actualValue); + $actualValue = $actualRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechExceptionTest() + { + $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 + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeSpeechRequest()) + ->setInput($input) + ->setVoice($voice) + ->setAudioConfig($audioConfig); + try { + $gapicClient->synthesizeSpeech($request); + // 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()); + } + + /** @test */ + public function listVoicesAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $request = new ListVoicesRequest(); + $response = $gapicClient->listVoicesAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php new file mode 100644 index 00000000000..ca56e0e2c17 --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/Client/TextToSpeechLongAudioSynthesizeClientTest.php @@ -0,0 +1,270 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechLongAudioSynthesizeClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechLongAudioSynthesizeClient($options); + } + + /** @test */ + public function synthesizeLongAudioTest() + { + $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/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudio($request); + $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.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $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 synthesizeLongAudioExceptionTest() + { + $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/synthesizeLongAudioTest'); + $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 + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudio($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + 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 synthesizeLongAudioAsyncTest() + { + $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/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $request = (new SynthesizeLongAudioRequest()) + ->setInput($input) + ->setAudioConfig($audioConfig); + $response = $gapicClient->synthesizeLongAudioAsync($request)->wait(); + $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.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $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()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php new file mode 100644 index 00000000000..377807d61dc --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechClientTest.php @@ -0,0 +1,194 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechClient($options); + } + + /** @test */ + public function listVoicesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListVoicesResponse(); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listVoices(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/ListVoices', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVoicesExceptionTest() + { + $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); + try { + $gapicClient->listVoices(); + // 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()); + } + + /** @test */ + public function synthesizeSpeechTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $audioContent = '16'; + $expectedResponse = new SynthesizeSpeechResponse(); + $expectedResponse->setAudioContent($audioContent); + $transport->addResponse($expectedResponse); + // Mock request + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.texttospeech.v1.TextToSpeech/SynthesizeSpeech', $actualFuncCall); + $actualValue = $actualRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualRequestObject->getVoice(); + $this->assertProtobufEquals($voice, $actualValue); + $actualValue = $actualRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function synthesizeSpeechExceptionTest() + { + $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 + $input = new SynthesisInput(); + $voice = new VoiceSelectionParams(); + $voiceLanguageCode = 'voiceLanguageCode-686472265'; + $voice->setLanguageCode($voiceLanguageCode); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + try { + $gapicClient->synthesizeSpeech($input, $voice, $audioConfig); + // 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()); + } +} diff --git a/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php new file mode 100644 index 00000000000..0b386e4c2de --- /dev/null +++ b/owl-bot-staging/TextToSpeech/v1/tests/Unit/V1/TextToSpeechLongAudioSynthesizeClientTest.php @@ -0,0 +1,193 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TextToSpeechLongAudioSynthesizeClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TextToSpeechLongAudioSynthesizeClient($options); + } + + /** @test */ + public function synthesizeLongAudioTest() + { + $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/synthesizeLongAudioTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SynthesizeLongAudioResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/synthesizeLongAudioTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); + $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.texttospeech.v1.TextToSpeechLongAudioSynthesize/SynthesizeLongAudio', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getAudioConfig(); + $this->assertProtobufEquals($audioConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + $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 synthesizeLongAudioExceptionTest() + { + $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/synthesizeLongAudioTest'); + $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 + $input = new SynthesisInput(); + $audioConfig = new AudioConfig(); + $audioConfigAudioEncoding = AudioEncoding::AUDIO_ENCODING_UNSPECIFIED; + $audioConfig->setAudioEncoding($audioConfigAudioEncoding); + $response = $gapicClient->synthesizeLongAudio($input, $audioConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/synthesizeLongAudioTest'); + 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()); + } +} diff --git a/owl-bot-staging/Tpu/v1/proto/src/GPBMetadata/Google/Cloud/Tpu/V1/CloudTpu.php b/owl-bot-staging/Tpu/v1/proto/src/GPBMetadata/Google/Cloud/Tpu/V1/CloudTpu.php new file mode 100644 index 00000000000..e088051a70f Binary files /dev/null and b/owl-bot-staging/Tpu/v1/proto/src/GPBMetadata/Google/Cloud/Tpu/V1/CloudTpu.php differ diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/AcceleratorType.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/AcceleratorType.php new file mode 100644 index 00000000000..a83457de33c --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/AcceleratorType.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v1.AcceleratorType + */ +class AcceleratorType extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * the accelerator type. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * @type string $type + * the accelerator type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * the accelerator type. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * the accelerator type. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/CreateNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/CreateNodeRequest.php new file mode 100644 index 00000000000..c64762275f5 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/CreateNodeRequest.php @@ -0,0 +1,145 @@ +google.cloud.tpu.v1.CreateNodeRequest + */ +class CreateNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + */ + protected $node_id = ''; + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $node = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type string $node_id + * The unqualified resource name. + * @type \Google\Cloud\Tpu\V1\Node $node + * Required. The node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + * @return string + */ + public function getNodeId() + { + return $this->node_id; + } + + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + * @param string $var + * @return $this + */ + public function setNodeId($var) + { + GPBUtil::checkString($var, True); + $this->node_id = $var; + + return $this; + } + + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Tpu\V1\Node|null + */ + public function getNode() + { + return $this->node; + } + + public function hasNode() + { + return isset($this->node); + } + + public function clearNode() + { + unset($this->node); + } + + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Tpu\V1\Node $var + * @return $this + */ + public function setNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V1\Node::class); + $this->node = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/DeleteNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/DeleteNodeRequest.php new file mode 100644 index 00000000000..3eb256de47f --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/DeleteNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v1.DeleteNodeRequest + */ +class DeleteNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetAcceleratorTypeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetAcceleratorTypeRequest.php new file mode 100644 index 00000000000..30719823c9a --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetAcceleratorTypeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v1.GetAcceleratorTypeRequest + */ +class GetAcceleratorTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetNodeRequest.php new file mode 100644 index 00000000000..baaa8d1d81c --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v1.GetNodeRequest + */ +class GetNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetTensorFlowVersionRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetTensorFlowVersionRequest.php new file mode 100644 index 00000000000..f0347012a60 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/GetTensorFlowVersionRequest.php @@ -0,0 +1,68 @@ +google.cloud.tpu.v1.GetTensorFlowVersionRequest + */ +class GetTensorFlowVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesRequest.php new file mode 100644 index 00000000000..606cdb3ac2b --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesRequest.php @@ -0,0 +1,204 @@ +google.cloud.tpu.v1.ListAcceleratorTypesRequest + */ +class ListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * List filter. + * @type string $order_by + * Sort results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesResponse.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesResponse.php new file mode 100644 index 00000000000..cae7e8f79e1 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListAcceleratorTypesResponse.php @@ -0,0 +1,136 @@ +google.cloud.tpu.v1.ListAcceleratorTypesResponse + */ +class ListAcceleratorTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; + */ + private $accelerator_types; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V1\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $accelerator_types + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAcceleratorTypes() + { + return $this->accelerator_types; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.AcceleratorType accelerator_types = 1; + * @param array<\Google\Cloud\Tpu\V1\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAcceleratorTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\AcceleratorType::class); + $this->accelerator_types = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesRequest.php new file mode 100644 index 00000000000..95228886da7 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesRequest.php @@ -0,0 +1,135 @@ +google.cloud.tpu.v1.ListNodesRequest + */ +class ListNodesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesResponse.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesResponse.php new file mode 100644 index 00000000000..e2c5a0b7462 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListNodesResponse.php @@ -0,0 +1,135 @@ +google.cloud.tpu.v1.ListNodesResponse + */ +class ListNodesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; + */ + private $nodes; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V1\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Node nodes = 1; + * @param array<\Google\Cloud\Tpu\V1\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsRequest.php new file mode 100644 index 00000000000..c5f8aee0832 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsRequest.php @@ -0,0 +1,204 @@ +google.cloud.tpu.v1.ListTensorFlowVersionsRequest + */ +class ListTensorFlowVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * List filter. + * @type string $order_by + * Sort results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsResponse.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsResponse.php new file mode 100644 index 00000000000..0d01cd3d2c6 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ListTensorFlowVersionsResponse.php @@ -0,0 +1,136 @@ +google.cloud.tpu.v1.ListTensorFlowVersionsResponse + */ +class ListTensorFlowVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; + */ + private $tensorflow_versions; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V1\TensorFlowVersion>|\Google\Protobuf\Internal\RepeatedField $tensorflow_versions + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTensorflowVersions() + { + return $this->tensorflow_versions; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.TensorFlowVersion tensorflow_versions = 1; + * @param array<\Google\Cloud\Tpu\V1\TensorFlowVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTensorflowVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\TensorFlowVersion::class); + $this->tensorflow_versions = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/NetworkEndpoint.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/NetworkEndpoint.php new file mode 100644 index 00000000000..815d81fd007 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/NetworkEndpoint.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v1.NetworkEndpoint + */ +class NetworkEndpoint extends \Google\Protobuf\Internal\Message +{ + /** + * The IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + */ + protected $ip_address = ''; + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + */ + protected $port = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ip_address + * The IP address of this network endpoint. + * @type int $port + * The port of this network endpoint. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * The IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node.php new file mode 100644 index 00000000000..a2b4917aa1e --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node.php @@ -0,0 +1,797 @@ +google.cloud.tpu.v1.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Immutable. The name of the TPU + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Required. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $accelerator_type = ''; + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network address for the TPU Node as visible to Compute Engine + * instances. + * + * Generated from protobuf field string ip_address = 8 [deprecated = true]; + * @deprecated + */ + protected $ip_address = ''; + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network port for the TPU Node as visible to Compute Engine instances. + * + * Generated from protobuf field string port = 14 [deprecated = true]; + * @deprecated + */ + protected $port = ''; + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $health_description = ''; + /** + * Required. The version of Tensorflow running in the Node. + * + * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tensorflow_version = ''; + /** + * The name of a network they wish to peer the TPU node to. It must be a + * preexisting Compute Engine network inside of the project on which this API + * has been activated. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 12; + */ + protected $network = ''; + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + */ + protected $cidr_block = ''; + /** + * Output only. The service account used to run the tensor flow services + * within the node. To share resources, including Google Cloud Storage data, + * with the Tensorflow job running in the Node, this account must have + * permissions to that data. + * + * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $service_account = ''; + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; + */ + protected $scheduling_config = null; + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that Tensorflow clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $network_endpoints; + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; + */ + protected $health = 0; + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + */ + private $labels; + /** + * Whether the VPC peering for the node is set up through Service Networking + * API. The VPC Peering should be set up before provisioning the node. + * If this field is set, cidr_block field should not be specified. If the + * network, that you want to peer the TPU Node to, is Shared VPC networks, + * the node must be created with this this field enabled. + * + * Generated from protobuf field bool use_service_networking = 27; + */ + protected $use_service_networking = false; + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = 0; + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $symptoms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Immutable. The name of the TPU + * @type string $description + * The user-supplied description of the TPU. Maximum of 512 characters. + * @type string $accelerator_type + * Required. The type of hardware accelerators associated with this node. + * @type string $ip_address + * Output only. DEPRECATED! Use network_endpoints instead. + * The network address for the TPU Node as visible to Compute Engine + * instances. + * @type string $port + * Output only. DEPRECATED! Use network_endpoints instead. + * The network port for the TPU Node as visible to Compute Engine instances. + * @type int $state + * Output only. The current state for the TPU Node. + * @type string $health_description + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * @type string $tensorflow_version + * Required. The version of Tensorflow running in the Node. + * @type string $network + * The name of a network they wish to peer the TPU node to. It must be a + * preexisting Compute Engine network inside of the project on which this API + * has been activated. If none is provided, "default" will be used. + * @type string $cidr_block + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * @type string $service_account + * Output only. The service account used to run the tensor flow services + * within the node. To share resources, including Google Cloud Storage data, + * with the Tensorflow job running in the Node, this account must have + * permissions to that data. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the node was created. + * @type \Google\Cloud\Tpu\V1\SchedulingConfig $scheduling_config + * The scheduling options for this node. + * @type array<\Google\Cloud\Tpu\V1\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $network_endpoints + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that Tensorflow clients of the node reach out + * to the 0th entry in this map first. + * @type int $health + * The health status of the TPU node. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Resource labels to represent user-provided metadata. + * @type bool $use_service_networking + * Whether the VPC peering for the node is set up through Service Networking + * API. The VPC Peering should be set up before provisioning the node. + * If this field is set, cidr_block field should not be specified. If the + * network, that you want to peer the TPU Node to, is Shared VPC networks, + * the node must be created with this this field enabled. + * @type int $api_version + * Output only. The API version that created this Node. + * @type array<\Google\Cloud\Tpu\V1\Symptom>|\Google\Protobuf\Internal\RepeatedField $symptoms + * Output only. The Symptoms that have occurred to the TPU Node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Immutable. The name of the TPU + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Immutable. The name of the TPU + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Required. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAcceleratorType() + { + return $this->accelerator_type; + } + + /** + * Required. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAcceleratorType($var) + { + GPBUtil::checkString($var, True); + $this->accelerator_type = $var; + + return $this; + } + + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network address for the TPU Node as visible to Compute Engine + * instances. + * + * Generated from protobuf field string ip_address = 8 [deprecated = true]; + * @return string + * @deprecated + */ + public function getIpAddress() + { + @trigger_error('ip_address is deprecated.', E_USER_DEPRECATED); + return $this->ip_address; + } + + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network address for the TPU Node as visible to Compute Engine + * instances. + * + * Generated from protobuf field string ip_address = 8 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setIpAddress($var) + { + @trigger_error('ip_address is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network port for the TPU Node as visible to Compute Engine instances. + * + * Generated from protobuf field string port = 14 [deprecated = true]; + * @return string + * @deprecated + */ + public function getPort() + { + @trigger_error('port is deprecated.', E_USER_DEPRECATED); + return $this->port; + } + + /** + * Output only. DEPRECATED! Use network_endpoints instead. + * The network port for the TPU Node as visible to Compute Engine instances. + * + * Generated from protobuf field string port = 14 [deprecated = true]; + * @param string $var + * @return $this + * @deprecated + */ + public function setPort($var) + { + @trigger_error('port is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->port = $var; + + return $this; + } + + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getHealthDescription() + { + return $this->health_description; + } + + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setHealthDescription($var) + { + GPBUtil::checkString($var, True); + $this->health_description = $var; + + return $this; + } + + /** + * Required. The version of Tensorflow running in the Node. + * + * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTensorflowVersion() + { + return $this->tensorflow_version; + } + + /** + * Required. The version of Tensorflow running in the Node. + * + * Generated from protobuf field string tensorflow_version = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTensorflowVersion($var) + { + GPBUtil::checkString($var, True); + $this->tensorflow_version = $var; + + return $this; + } + + /** + * The name of a network they wish to peer the TPU node to. It must be a + * preexisting Compute Engine network inside of the project on which this API + * has been activated. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 12; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * The name of a network they wish to peer the TPU node to. It must be a + * preexisting Compute Engine network inside of the project on which this API + * has been activated. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 12; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + * @return string + */ + public function getCidrBlock() + { + return $this->cidr_block; + } + + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + * @param string $var + * @return $this + */ + public function setCidrBlock($var) + { + GPBUtil::checkString($var, True); + $this->cidr_block = $var; + + return $this; + } + + /** + * Output only. The service account used to run the tensor flow services + * within the node. To share resources, including Google Cloud Storage data, + * with the Tensorflow job running in the Node, this account must have + * permissions to that data. + * + * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Output only. The service account used to run the tensor flow services + * within the node. To share resources, including Google Cloud Storage data, + * with the Tensorflow job running in the Node, this account must have + * permissions to that data. + * + * Generated from protobuf field string service_account = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; + * @return \Google\Cloud\Tpu\V1\SchedulingConfig|null + */ + public function getSchedulingConfig() + { + return $this->scheduling_config; + } + + public function hasSchedulingConfig() + { + return isset($this->scheduling_config); + } + + public function clearSchedulingConfig() + { + unset($this->scheduling_config); + } + + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v1.SchedulingConfig scheduling_config = 17; + * @param \Google\Cloud\Tpu\V1\SchedulingConfig $var + * @return $this + */ + public function setSchedulingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V1\SchedulingConfig::class); + $this->scheduling_config = $var; + + return $this; + } + + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that Tensorflow clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkEndpoints() + { + return $this->network_endpoints; + } + + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that Tensorflow clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Tpu\V1\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkEndpoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\NetworkEndpoint::class); + $this->network_endpoints = $arr; + + return $this; + } + + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; + * @return int + */ + public function getHealth() + { + return $this->health; + } + + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.Health health = 22; + * @param int $var + * @return $this + */ + public function setHealth($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\Health::class); + $this->health = $var; + + return $this; + } + + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Whether the VPC peering for the node is set up through Service Networking + * API. The VPC Peering should be set up before provisioning the node. + * If this field is set, cidr_block field should not be specified. If the + * network, that you want to peer the TPU Node to, is Shared VPC networks, + * the node must be created with this this field enabled. + * + * Generated from protobuf field bool use_service_networking = 27; + * @return bool + */ + public function getUseServiceNetworking() + { + return $this->use_service_networking; + } + + /** + * Whether the VPC peering for the node is set up through Service Networking + * API. The VPC Peering should be set up before provisioning the node. + * If this field is set, cidr_block field should not be specified. If the + * network, that you want to peer the TPU Node to, is Shared VPC networks, + * the node must be created with this this field enabled. + * + * Generated from protobuf field bool use_service_networking = 27; + * @param bool $var + * @return $this + */ + public function setUseServiceNetworking($var) + { + GPBUtil::checkBool($var); + $this->use_service_networking = $var; + + return $this; + } + + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v1.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Node\ApiVersion::class); + $this->api_version = $var; + + return $this; + } + + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSymptoms() + { + return $this->symptoms; + } + + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v1.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Tpu\V1\Symptom>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSymptoms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V1\Symptom::class); + $this->symptoms = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/ApiVersion.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/ApiVersion.php new file mode 100644 index 00000000000..9554026fddf --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/ApiVersion.php @@ -0,0 +1,71 @@ +google.cloud.tpu.v1.Node.ApiVersion + */ +class ApiVersion +{ + /** + * API version is unknown. + * + * Generated from protobuf enum API_VERSION_UNSPECIFIED = 0; + */ + const API_VERSION_UNSPECIFIED = 0; + /** + * TPU API V1Alpha1 version. + * + * Generated from protobuf enum V1_ALPHA1 = 1; + */ + const V1_ALPHA1 = 1; + /** + * TPU API V1 version. + * + * Generated from protobuf enum V1 = 2; + */ + const V1 = 2; + /** + * TPU API V2Alpha1 version. + * + * Generated from protobuf enum V2_ALPHA1 = 3; + */ + const V2_ALPHA1 = 3; + + private static $valueToName = [ + self::API_VERSION_UNSPECIFIED => 'API_VERSION_UNSPECIFIED', + self::V1_ALPHA1 => 'V1_ALPHA1', + self::V1 => 'V1', + self::V2_ALPHA1 => 'V2_ALPHA1', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApiVersion::class, \Google\Cloud\Tpu\V1\Node_ApiVersion::class); + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/Health.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/Health.php new file mode 100644 index 00000000000..3ecf7cbae53 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/Health.php @@ -0,0 +1,87 @@ +google.cloud.tpu.v1.Node.Health + */ +class Health +{ + /** + * Health status is unknown: not initialized or failed to retrieve. + * + * Generated from protobuf enum HEALTH_UNSPECIFIED = 0; + */ + const HEALTH_UNSPECIFIED = 0; + /** + * The resource is healthy. + * + * Generated from protobuf enum HEALTHY = 1; + */ + const HEALTHY = 1; + /** + * The resource is unhealthy. + * + * Generated from protobuf enum DEPRECATED_UNHEALTHY = 2; + */ + const DEPRECATED_UNHEALTHY = 2; + /** + * The resource is unresponsive. + * + * Generated from protobuf enum TIMEOUT = 3; + */ + const TIMEOUT = 3; + /** + * The in-guest ML stack is unhealthy. + * + * Generated from protobuf enum UNHEALTHY_TENSORFLOW = 4; + */ + const UNHEALTHY_TENSORFLOW = 4; + /** + * The node is under maintenance/priority boost caused rescheduling and + * will resume running once rescheduled. + * + * Generated from protobuf enum UNHEALTHY_MAINTENANCE = 5; + */ + const UNHEALTHY_MAINTENANCE = 5; + + private static $valueToName = [ + self::HEALTH_UNSPECIFIED => 'HEALTH_UNSPECIFIED', + self::HEALTHY => 'HEALTHY', + self::DEPRECATED_UNHEALTHY => 'DEPRECATED_UNHEALTHY', + self::TIMEOUT => 'TIMEOUT', + self::UNHEALTHY_TENSORFLOW => 'UNHEALTHY_TENSORFLOW', + self::UNHEALTHY_MAINTENANCE => 'UNHEALTHY_MAINTENANCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Health::class, \Google\Cloud\Tpu\V1\Node_Health::class); + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/State.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/State.php new file mode 100644 index 00000000000..de2ffa8f5e3 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Node/State.php @@ -0,0 +1,150 @@ +google.cloud.tpu.v1.Node.State + */ +class State +{ + /** + * TPU node state is not known/set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * TPU node is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * TPU node has been created. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * TPU node is restarting. + * + * Generated from protobuf enum RESTARTING = 3; + */ + const RESTARTING = 3; + /** + * TPU node is undergoing reimaging. + * + * Generated from protobuf enum REIMAGING = 4; + */ + const REIMAGING = 4; + /** + * TPU node is being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + /** + * TPU node is being repaired and may be unusable. Details can be + * found in the `help_description` field. + * + * Generated from protobuf enum REPAIRING = 6; + */ + const REPAIRING = 6; + /** + * TPU node is stopped. + * + * Generated from protobuf enum STOPPED = 8; + */ + const STOPPED = 8; + /** + * TPU node is currently stopping. + * + * Generated from protobuf enum STOPPING = 9; + */ + const STOPPING = 9; + /** + * TPU node is currently starting. + * + * Generated from protobuf enum STARTING = 10; + */ + const STARTING = 10; + /** + * TPU node has been preempted. Only applies to Preemptible TPU Nodes. + * + * Generated from protobuf enum PREEMPTED = 11; + */ + const PREEMPTED = 11; + /** + * TPU node has been terminated due to maintenance or has reached the end of + * its life cycle (for preemptible nodes). + * + * Generated from protobuf enum TERMINATED = 12; + */ + const TERMINATED = 12; + /** + * TPU node is currently hiding. + * + * Generated from protobuf enum HIDING = 13; + */ + const HIDING = 13; + /** + * TPU node has been hidden. + * + * Generated from protobuf enum HIDDEN = 14; + */ + const HIDDEN = 14; + /** + * TPU node is currently unhiding. + * + * Generated from protobuf enum UNHIDING = 15; + */ + const UNHIDING = 15; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::RESTARTING => 'RESTARTING', + self::REIMAGING => 'REIMAGING', + self::DELETING => 'DELETING', + self::REPAIRING => 'REPAIRING', + self::STOPPED => 'STOPPED', + self::STOPPING => 'STOPPING', + self::STARTING => 'STARTING', + self::PREEMPTED => 'PREEMPTED', + self::TERMINATED => 'TERMINATED', + self::HIDING => 'HIDING', + self::HIDDEN => 'HIDDEN', + self::UNHIDING => 'UNHIDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Tpu\V1\Node_State::class); + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/OperationMetadata.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/OperationMetadata.php new file mode 100644 index 00000000000..eaff8552467 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/OperationMetadata.php @@ -0,0 +1,295 @@ +google.cloud.tpu.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + */ + protected $status_detail = ''; + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + */ + protected $cancel_requested = false; + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * @type string $verb + * Name of the verb executed by the operation. + * @type string $status_detail + * Human-readable status of the operation, if any. + * @type bool $cancel_requested + * Specifies if cancellation was requested for the operation. + * @type string $api_version + * API version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @return string + */ + public function getStatusDetail() + { + return $this->status_detail; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @param string $var + * @return $this + */ + public function setStatusDetail($var) + { + GPBUtil::checkString($var, True); + $this->status_detail = $var; + + return $this; + } + + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + * @return bool + */ + public function getCancelRequested() + { + return $this->cancel_requested; + } + + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + * @param bool $var + * @return $this + */ + public function setCancelRequested($var) + { + GPBUtil::checkBool($var); + $this->cancel_requested = $var; + + return $this; + } + + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ReimageNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ReimageNodeRequest.php new file mode 100644 index 00000000000..7223eed48da --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/ReimageNodeRequest.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v1.ReimageNodeRequest + */ +class ReimageNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The version for reimage to create. + * + * Generated from protobuf field string tensorflow_version = 2; + */ + protected $tensorflow_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * @type string $tensorflow_version + * The version for reimage to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The version for reimage to create. + * + * Generated from protobuf field string tensorflow_version = 2; + * @return string + */ + public function getTensorflowVersion() + { + return $this->tensorflow_version; + } + + /** + * The version for reimage to create. + * + * Generated from protobuf field string tensorflow_version = 2; + * @param string $var + * @return $this + */ + public function setTensorflowVersion($var) + { + GPBUtil::checkString($var, True); + $this->tensorflow_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/SchedulingConfig.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/SchedulingConfig.php new file mode 100644 index 00000000000..5d8d5689861 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/SchedulingConfig.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v1.SchedulingConfig + */ +class SchedulingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + */ + protected $preemptible = false; + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + */ + protected $reserved = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $preemptible + * Defines whether the node is preemptible. + * @type bool $reserved + * Whether the node is created under a reservation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + * @return bool + */ + public function getPreemptible() + { + return $this->preemptible; + } + + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + * @param bool $var + * @return $this + */ + public function setPreemptible($var) + { + GPBUtil::checkBool($var); + $this->preemptible = $var; + + return $this; + } + + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + * @return bool + */ + public function getReserved() + { + return $this->reserved; + } + + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + * @param bool $var + * @return $this + */ + public function setReserved($var) + { + GPBUtil::checkBool($var); + $this->reserved = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StartNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StartNodeRequest.php new file mode 100644 index 00000000000..bcb6fdf73a3 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StartNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v1.StartNodeRequest + */ +class StartNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StopNodeRequest.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StopNodeRequest.php new file mode 100644 index 00000000000..a1d1c4ac971 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/StopNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v1.StopNodeRequest + */ +class StopNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom.php new file mode 100644 index 00000000000..d3ff773b4c6 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom.php @@ -0,0 +1,179 @@ +google.cloud.tpu.v1.Symptom + */ +class Symptom extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; + */ + protected $symptom_type = 0; + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + */ + protected $details = ''; + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + */ + protected $worker_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Timestamp when the Symptom is created. + * @type int $symptom_type + * Type of the Symptom. + * @type string $details + * Detailed information of the current Symptom. + * @type string $worker_id + * A string used to uniquely distinguish a worker within a TPU node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; + * @return int + */ + public function getSymptomType() + { + return $this->symptom_type; + } + + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v1.Symptom.SymptomType symptom_type = 2; + * @param int $var + * @return $this + */ + public function setSymptomType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V1\Symptom\SymptomType::class); + $this->symptom_type = $var; + + return $this; + } + + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + * @return string + */ + public function getWorkerId() + { + return $this->worker_id; + } + + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + * @param string $var + * @return $this + */ + public function setWorkerId($var) + { + GPBUtil::checkString($var, True); + $this->worker_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom/SymptomType.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom/SymptomType.php new file mode 100644 index 00000000000..18acc672691 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/Symptom/SymptomType.php @@ -0,0 +1,94 @@ +google.cloud.tpu.v1.Symptom.SymptomType + */ +class SymptomType +{ + /** + * Unspecified symptom. + * + * Generated from protobuf enum SYMPTOM_TYPE_UNSPECIFIED = 0; + */ + const SYMPTOM_TYPE_UNSPECIFIED = 0; + /** + * TPU VM memory is low. + * + * Generated from protobuf enum LOW_MEMORY = 1; + */ + const LOW_MEMORY = 1; + /** + * TPU runtime is out of memory. + * + * Generated from protobuf enum OUT_OF_MEMORY = 2; + */ + const OUT_OF_MEMORY = 2; + /** + * TPU runtime execution has timed out. + * + * Generated from protobuf enum EXECUTE_TIMED_OUT = 3; + */ + const EXECUTE_TIMED_OUT = 3; + /** + * TPU runtime fails to construct a mesh that recognizes each TPU device's + * neighbors. + * + * Generated from protobuf enum MESH_BUILD_FAIL = 4; + */ + const MESH_BUILD_FAIL = 4; + /** + * TPU HBM is out of memory. + * + * Generated from protobuf enum HBM_OUT_OF_MEMORY = 5; + */ + const HBM_OUT_OF_MEMORY = 5; + /** + * Abusive behaviors have been identified on the current project. + * + * Generated from protobuf enum PROJECT_ABUSE = 6; + */ + const PROJECT_ABUSE = 6; + + private static $valueToName = [ + self::SYMPTOM_TYPE_UNSPECIFIED => 'SYMPTOM_TYPE_UNSPECIFIED', + self::LOW_MEMORY => 'LOW_MEMORY', + self::OUT_OF_MEMORY => 'OUT_OF_MEMORY', + self::EXECUTE_TIMED_OUT => 'EXECUTE_TIMED_OUT', + self::MESH_BUILD_FAIL => 'MESH_BUILD_FAIL', + self::HBM_OUT_OF_MEMORY => 'HBM_OUT_OF_MEMORY', + self::PROJECT_ABUSE => 'PROJECT_ABUSE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SymptomType::class, \Google\Cloud\Tpu\V1\Symptom_SymptomType::class); + diff --git a/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/TensorFlowVersion.php b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/TensorFlowVersion.php new file mode 100644 index 00000000000..cf53dab11a8 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/proto/src/Google/Cloud/Tpu/V1/TensorFlowVersion.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v1.TensorFlowVersion + */ +class TensorFlowVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * the tensorflow version. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * @type string $version + * the tensorflow version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V1\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * the tensorflow version. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * the tensorflow version. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/create_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/create_node.php new file mode 100644 index 00000000000..72e569aa922 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/create_node.php @@ -0,0 +1,90 @@ +setAcceleratorType($nodeAcceleratorType) + ->setTensorflowVersion($nodeTensorflowVersion); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->createNode($formattedParent, $node); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + $nodeAcceleratorType = '[ACCELERATOR_TYPE]'; + $nodeTensorflowVersion = '[TENSORFLOW_VERSION]'; + + create_node_sample($formattedParent, $nodeAcceleratorType, $nodeTensorflowVersion); +} +// [END tpu_v1_generated_Tpu_CreateNode_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/delete_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/delete_node.php new file mode 100644 index 00000000000..04740897dad --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/delete_node.php @@ -0,0 +1,78 @@ +deleteNode($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + delete_node_sample($formattedName); +} +// [END tpu_v1_generated_Tpu_DeleteNode_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_accelerator_type.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_accelerator_type.php new file mode 100644 index 00000000000..1627eafb8dd --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_accelerator_type.php @@ -0,0 +1,66 @@ +getAcceleratorType($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + + get_accelerator_type_sample($formattedName); +} +// [END tpu_v1_generated_Tpu_GetAcceleratorType_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_location.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_location.php new file mode 100644 index 00000000000..ccfd9866cf6 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v1_generated_Tpu_GetLocation_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_node.php new file mode 100644 index 00000000000..483410a2b4a --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_node.php @@ -0,0 +1,66 @@ +getNode($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + get_node_sample($formattedName); +} +// [END tpu_v1_generated_Tpu_GetNode_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_tensor_flow_version.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_tensor_flow_version.php new file mode 100644 index 00000000000..d041df473c9 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/get_tensor_flow_version.php @@ -0,0 +1,70 @@ +getTensorFlowVersion($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::tensorFlowVersionName( + '[PROJECT]', + '[LOCATION]', + '[TENSOR_FLOW_VERSION]' + ); + + get_tensor_flow_version_sample($formattedName); +} +// [END tpu_v1_generated_Tpu_GetTensorFlowVersion_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_accelerator_types.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_accelerator_types.php new file mode 100644 index 00000000000..c14bff499b7 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_accelerator_types.php @@ -0,0 +1,71 @@ +listAcceleratorTypes($formattedParent); + + /** @var AcceleratorType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + + list_accelerator_types_sample($formattedParent); +} +// [END tpu_v1_generated_Tpu_ListAcceleratorTypes_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_locations.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_locations.php new file mode 100644 index 00000000000..a9494b94d88 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v1_generated_Tpu_ListLocations_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_nodes.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_nodes.php new file mode 100644 index 00000000000..20d40dac599 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_nodes.php @@ -0,0 +1,71 @@ +listNodes($formattedParent); + + /** @var Node $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + + list_nodes_sample($formattedParent); +} +// [END tpu_v1_generated_Tpu_ListNodes_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_tensor_flow_versions.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_tensor_flow_versions.php new file mode 100644 index 00000000000..3669b40c6b1 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/list_tensor_flow_versions.php @@ -0,0 +1,75 @@ +listTensorFlowVersions($formattedParent); + + /** @var TensorFlowVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::tensorFlowVersionName( + '[PROJECT]', + '[LOCATION]', + '[TENSOR_FLOW_VERSION]' + ); + + list_tensor_flow_versions_sample($formattedParent); +} +// [END tpu_v1_generated_Tpu_ListTensorFlowVersions_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/reimage_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/reimage_node.php new file mode 100644 index 00000000000..05fc7269ebb --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/reimage_node.php @@ -0,0 +1,65 @@ +reimageNode(); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v1_generated_Tpu_ReimageNode_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/start_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/start_node.php new file mode 100644 index 00000000000..57b0668e169 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/start_node.php @@ -0,0 +1,65 @@ +startNode(); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v1_generated_Tpu_StartNode_sync] diff --git a/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/stop_node.php b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/stop_node.php new file mode 100644 index 00000000000..f0cb4284a44 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/samples/V1/TpuClient/stop_node.php @@ -0,0 +1,65 @@ +stopNode(); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v1_generated_Tpu_StopNode_sync] diff --git a/owl-bot-staging/Tpu/v1/src/V1/Gapic/TpuGapicClient.php b/owl-bot-staging/Tpu/v1/src/V1/Gapic/TpuGapicClient.php new file mode 100644 index 00000000000..a1cac6eb069 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/src/V1/Gapic/TpuGapicClient.php @@ -0,0 +1,1237 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $node = new Node(); + * $operationResponse = $tpuClient->createNode($formattedParent, $node); + * $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 = $tpuClient->createNode($formattedParent, $node); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'createNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated This class will be removed in the next major version update. + */ +class TpuGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.tpu.v1.Tpu'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'tpu.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'tpu.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 static $acceleratorTypeNameTemplate; + + private static $locationNameTemplate; + + private static $nodeNameTemplate; + + private static $tensorFlowVersionNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/tpu_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/tpu_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/tpu_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/tpu_rest_client_config.php', + ], + ], + ]; + } + + private static function getAcceleratorTypeNameTemplate() + { + if (self::$acceleratorTypeNameTemplate == null) { + self::$acceleratorTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}'); + } + + return self::$acceleratorTypeNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getNodeNameTemplate() + { + if (self::$nodeNameTemplate == null) { + self::$nodeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/nodes/{node}'); + } + + return self::$nodeNameTemplate; + } + + private static function getTensorFlowVersionNameTemplate() + { + if (self::$tensorFlowVersionNameTemplate == null) { + self::$tensorFlowVersionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version}'); + } + + return self::$tensorFlowVersionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'acceleratorType' => self::getAcceleratorTypeNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'node' => self::getNodeNameTemplate(), + 'tensorFlowVersion' => self::getTensorFlowVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * accelerator_type resource. + * + * @param string $project + * @param string $location + * @param string $acceleratorType + * + * @return string The formatted accelerator_type resource. + */ + public static function acceleratorTypeName($project, $location, $acceleratorType) + { + return self::getAcceleratorTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'accelerator_type' => $acceleratorType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node + * resource. + * + * @param string $project + * @param string $location + * @param string $node + * + * @return string The formatted node resource. + */ + public static function nodeName($project, $location, $node) + { + return self::getNodeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'node' => $node, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * tensor_flow_version resource. + * + * @param string $project + * @param string $location + * @param string $tensorFlowVersion + * + * @return string The formatted tensor_flow_version resource. + */ + public static function tensorFlowVersionName($project, $location, $tensorFlowVersion) + { + return self::getTensorFlowVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'tensor_flow_version' => $tensorFlowVersion, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - acceleratorType: projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type} + * - location: projects/{project}/locations/{location} + * - node: projects/{project}/locations/{location}/nodes/{node} + * - tensorFlowVersion: projects/{project}/locations/{location}/tensorFlowVersions/{tensor_flow_version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'tpu.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); + } + + /** + * Creates a node. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedParent = $tpuClient->locationName('[PROJECT]', '[LOCATION]'); + * $node = new Node(); + * $operationResponse = $tpuClient->createNode($formattedParent, $node); + * $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 = $tpuClient->createNode($formattedParent, $node); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'createNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name. + * @param Node $node Required. The node. + * @param array $optionalArgs { + * Optional. + * + * @type string $nodeId + * The unqualified resource name. + * @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 createNode($parent, $node, array $optionalArgs = []) + { + $request = new CreateNodeRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNode($node); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['nodeId'])) { + $request->setNodeId($optionalArgs['nodeId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a node. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedName = $tpuClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + * $operationResponse = $tpuClient->deleteNode($formattedName); + * $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 = $tpuClient->deleteNode($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'deleteNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name. + * @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 deleteNode($name, array $optionalArgs = []) + { + $request = new DeleteNodeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets AcceleratorType. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedName = $tpuClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + * $response = $tpuClient->getAcceleratorType($formattedName); + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name. + * @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\Cloud\Tpu\V1\AcceleratorType + * + * @throws ApiException if the remote call fails + */ + public function getAcceleratorType($name, array $optionalArgs = []) + { + $request = new GetAcceleratorTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAcceleratorType', AcceleratorType::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the details of a node. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedName = $tpuClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + * $response = $tpuClient->getNode($formattedName); + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name. + * @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\Cloud\Tpu\V1\Node + * + * @throws ApiException if the remote call fails + */ + public function getNode($name, array $optionalArgs = []) + { + $request = new GetNodeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNode', Node::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets TensorFlow Version. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedName = $tpuClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + * $response = $tpuClient->getTensorFlowVersion($formattedName); + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name. + * @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\Cloud\Tpu\V1\TensorFlowVersion + * + * @throws ApiException if the remote call fails + */ + public function getTensorFlowVersion($name, array $optionalArgs = []) + { + $request = new GetTensorFlowVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTensorFlowVersion', TensorFlowVersion::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists accelerator types supported by this API. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedParent = $tpuClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + * // Iterate over pages of elements + * $pagedResponse = $tpuClient->listAcceleratorTypes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $tpuClient->listAcceleratorTypes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * List filter. + * @type string $orderBy + * Sort results. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAcceleratorTypes($parent, array $optionalArgs = []) + { + $request = new ListAcceleratorTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAcceleratorTypes', $optionalArgs, ListAcceleratorTypesResponse::class, $request); + } + + /** + * Lists nodes. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedParent = $tpuClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $tpuClient->listNodes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $tpuClient->listNodes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNodes($parent, array $optionalArgs = []) + { + $request = new ListNodesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNodes', $optionalArgs, ListNodesResponse::class, $request); + } + + /** + * List TensorFlow versions supported by this API. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $formattedParent = $tpuClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + * // Iterate over pages of elements + * $pagedResponse = $tpuClient->listTensorFlowVersions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $tpuClient->listTensorFlowVersions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * List filter. + * @type string $orderBy + * Sort results. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTensorFlowVersions($parent, array $optionalArgs = []) + { + $request = new ListTensorFlowVersionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTensorFlowVersions', $optionalArgs, ListTensorFlowVersionsResponse::class, $request); + } + + /** + * Reimages a node's OS. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $operationResponse = $tpuClient->reimageNode(); + * $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 = $tpuClient->reimageNode(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'reimageNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource name. + * @type string $tensorflowVersion + * The version for reimage to create. + * @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 reimageNode(array $optionalArgs = []) + { + $request = new ReimageNodeRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['tensorflowVersion'])) { + $request->setTensorflowVersion($optionalArgs['tensorflowVersion']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ReimageNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Starts a node. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $operationResponse = $tpuClient->startNode(); + * $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 = $tpuClient->startNode(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'startNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource name. + * @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 startNode(array $optionalArgs = []) + { + $request = new StartNodeRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('StartNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Stops a node, this operation is only available with single TPU nodes. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $operationResponse = $tpuClient->stopNode(); + * $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 = $tpuClient->stopNode(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $tpuClient->resumeOperation($operationName, 'stopNode'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource name. + * @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 stopNode(array $optionalArgs = []) + { + $request = new StopNodeRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('StopNode', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * $response = $tpuClient->getLocation(); + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $tpuClient = new TpuClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $tpuClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $tpuClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $tpuClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/Tpu/v1/src/V1/TpuClient.php b/owl-bot-staging/Tpu/v1/src/V1/TpuClient.php new file mode 100644 index 00000000000..085dae53c3e --- /dev/null +++ b/owl-bot-staging/Tpu/v1/src/V1/TpuClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.tpu.v1.Tpu' => [ + 'CreateNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ReimageNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'StartNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'StopNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V1\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListAcceleratorTypes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAcceleratorTypes', + ], + ], + 'ListNodes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNodes', + ], + ], + 'ListTensorFlowVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTensorflowVersions', + ], + ], + 'GetLocation' => [ + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + ], + ], +]; diff --git a/owl-bot-staging/Tpu/v1/src/V1/resources/tpu_rest_client_config.php b/owl-bot-staging/Tpu/v1/src/V1/resources/tpu_rest_client_config.php new file mode 100644 index 00000000000..f997e45607d --- /dev/null +++ b/owl-bot-staging/Tpu/v1/src/V1/resources/tpu_rest_client_config.php @@ -0,0 +1,204 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.tpu.v1.Tpu' => [ + 'CreateNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/nodes', + 'body' => 'node', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNode' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAcceleratorType' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/acceleratorTypes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNode' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTensorFlowVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/tensorflowVersions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAcceleratorTypes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/acceleratorTypes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/nodes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListTensorFlowVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/tensorflowVersions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ReimageNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:reimage', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StartNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:start', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StopNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodes/*}:stop', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Tpu/v1/tests/Unit/V1/TpuClientTest.php b/owl-bot-staging/Tpu/v1/tests/Unit/V1/TpuClientTest.php new file mode 100644 index 00000000000..875a5029126 --- /dev/null +++ b/owl-bot-staging/Tpu/v1/tests/Unit/V1/TpuClientTest.php @@ -0,0 +1,1289 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TpuClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TpuClient($options); + } + + /** @test */ + public function createNodeTest() + { + $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/createNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion = 'tensorflowVersion-1353701984'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $node = new Node(); + $nodeAcceleratorType = 'nodeAcceleratorType-620315165'; + $node->setAcceleratorType($nodeAcceleratorType); + $nodeTensorflowVersion = 'nodeTensorflowVersion-1950315537'; + $node->setTensorflowVersion($nodeTensorflowVersion); + $response = $gapicClient->createNode($formattedParent, $node); + $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.tpu.v1.Tpu/CreateNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNode(); + $this->assertProtobufEquals($node, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeTest'); + $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 createNodeExceptionTest() + { + $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/createNodeTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $node = new Node(); + $nodeAcceleratorType = 'nodeAcceleratorType-620315165'; + $node->setAcceleratorType($nodeAcceleratorType); + $nodeTensorflowVersion = 'nodeTensorflowVersion-1950315537'; + $node->setTensorflowVersion($nodeTensorflowVersion); + $response = $gapicClient->createNode($formattedParent, $node); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeTest'); + 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 deleteNodeTest() + { + $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/deleteNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion = 'tensorflowVersion-1353701984'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $response = $gapicClient->deleteNode($formattedName); + $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.tpu.v1.Tpu/DeleteNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); + $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 deleteNodeExceptionTest() + { + $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/deleteNodeTest'); + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $response = $gapicClient->deleteNode($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); + 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 getAcceleratorTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $expectedResponse = new AcceleratorType(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + $response = $gapicClient->getAcceleratorType($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/GetAcceleratorType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAcceleratorTypeExceptionTest() + { + $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 + $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + try { + $gapicClient->getAcceleratorType($formattedName); + // 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()); + } + + /** @test */ + public function getNodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion = 'tensorflowVersion-1353701984'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $response = $gapicClient->getNode($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/GetNode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + try { + $gapicClient->getNode($formattedName); + // 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()); + } + + /** @test */ + public function getTensorFlowVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $expectedResponse = new TensorFlowVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + $response = $gapicClient->getTensorFlowVersion($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/GetTensorFlowVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTensorFlowVersionExceptionTest() + { + $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 + $formattedName = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + try { + $gapicClient->getTensorFlowVersion($formattedName); + // 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()); + } + + /** @test */ + public function listAcceleratorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $acceleratorTypesElement = new AcceleratorType(); + $acceleratorTypes = [ + $acceleratorTypesElement, + ]; + $expectedResponse = new ListAcceleratorTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAcceleratorTypes($acceleratorTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + $response = $gapicClient->listAcceleratorTypes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAcceleratorTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/ListAcceleratorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAcceleratorTypesExceptionTest() + { + $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 + $formattedParent = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + try { + $gapicClient->listAcceleratorTypes($formattedParent); + // 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()); + } + + /** @test */ + public function listNodesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodesElement = new Node(); + $nodes = [ + $nodesElement, + ]; + $expectedResponse = new ListNodesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodes($nodes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listNodes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/ListNodes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listNodes($formattedParent); + // 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()); + } + + /** @test */ + public function listTensorFlowVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $tensorflowVersionsElement = new TensorFlowVersion(); + $tensorflowVersions = [ + $tensorflowVersionsElement, + ]; + $expectedResponse = new ListTensorFlowVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTensorflowVersions($tensorflowVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + $response = $gapicClient->listTensorFlowVersions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTensorflowVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v1.Tpu/ListTensorFlowVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTensorFlowVersionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->tensorFlowVersionName('[PROJECT]', '[LOCATION]', '[TENSOR_FLOW_VERSION]'); + try { + $gapicClient->listTensorFlowVersions($formattedParent); + // 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()); + } + + /** @test */ + public function reimageNodeTest() + { + $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/reimageNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion2 = 'tensorflowVersion2467487059'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion2); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/reimageNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->reimageNode(); + $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.tpu.v1.Tpu/ReimageNode', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reimageNodeTest'); + $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 reimageNodeExceptionTest() + { + $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/reimageNodeTest'); + $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); + $response = $gapicClient->reimageNode(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reimageNodeTest'); + 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 startNodeTest() + { + $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/startNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion = 'tensorflowVersion-1353701984'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->startNode(); + $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.tpu.v1.Tpu/StartNode', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startNodeTest'); + $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 startNodeExceptionTest() + { + $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/startNodeTest'); + $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); + $response = $gapicClient->startNode(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startNodeTest'); + 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 stopNodeTest() + { + $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/stopNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $ipAddress = 'ipAddress1480014044'; + $port = 'port3446913'; + $healthDescription = 'healthDescription-1057342823'; + $tensorflowVersion = 'tensorflowVersion-1353701984'; + $network = 'network1843485230'; + $cidrBlock = 'cidrBlock313022466'; + $serviceAccount = 'serviceAccount-1948028253'; + $useServiceNetworking = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setPort($port); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setTensorflowVersion($tensorflowVersion); + $expectedResponse->setNetwork($network); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setUseServiceNetworking($useServiceNetworking); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/stopNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->stopNode(); + $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.tpu.v1.Tpu/StopNode', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopNodeTest'); + $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 stopNodeExceptionTest() + { + $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/stopNodeTest'); + $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); + $response = $gapicClient->stopNode(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopNodeTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/Tpu/v2/proto/src/GPBMetadata/Google/Cloud/Tpu/V2/CloudTpu.php b/owl-bot-staging/Tpu/v2/proto/src/GPBMetadata/Google/Cloud/Tpu/V2/CloudTpu.php new file mode 100644 index 00000000000..0e43d7c9ea6 Binary files /dev/null and b/owl-bot-staging/Tpu/v2/proto/src/GPBMetadata/Google/Cloud/Tpu/V2/CloudTpu.php differ diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig.php new file mode 100644 index 00000000000..7c50941774d --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v2.AcceleratorConfig + */ +class AcceleratorConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Type of TPU. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig.Type type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Required. Topology of TPU in chips. + * + * Generated from protobuf field string topology = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $topology = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Required. Type of TPU. + * @type string $topology + * Required. Topology of TPU in chips. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. Type of TPU. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig.Type type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. Type of TPU. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig.Type type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\AcceleratorConfig\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Required. Topology of TPU in chips. + * + * Generated from protobuf field string topology = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTopology() + { + return $this->topology; + } + + /** + * Required. Topology of TPU in chips. + * + * Generated from protobuf field string topology = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTopology($var) + { + GPBUtil::checkString($var, True); + $this->topology = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig/Type.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig/Type.php new file mode 100644 index 00000000000..acc1fb827c6 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorConfig/Type.php @@ -0,0 +1,71 @@ +google.cloud.tpu.v2.AcceleratorConfig.Type + */ +class Type +{ + /** + * Unspecified version. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * TPU v2. + * + * Generated from protobuf enum V2 = 2; + */ + const V2 = 2; + /** + * TPU v3. + * + * Generated from protobuf enum V3 = 4; + */ + const V3 = 4; + /** + * TPU v4. + * + * Generated from protobuf enum V4 = 7; + */ + const V4 = 7; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::V2 => 'V2', + self::V3 => 'V3', + self::V4 => 'V4', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Tpu\V2\AcceleratorConfig_Type::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorType.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorType.php new file mode 100644 index 00000000000..eeb1b245c88 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AcceleratorType.php @@ -0,0 +1,135 @@ +google.cloud.tpu.v2.AcceleratorType + */ +class AcceleratorType extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The accelerator type. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * The accelerator config. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorConfig accelerator_configs = 3; + */ + private $accelerator_configs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * @type string $type + * The accelerator type. + * @type array<\Google\Cloud\Tpu\V2\AcceleratorConfig>|\Google\Protobuf\Internal\RepeatedField $accelerator_configs + * The accelerator config. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The accelerator type. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The accelerator type. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The accelerator config. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorConfig accelerator_configs = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAcceleratorConfigs() + { + return $this->accelerator_configs; + } + + /** + * The accelerator config. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorConfig accelerator_configs = 3; + * @param array<\Google\Cloud\Tpu\V2\AcceleratorConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAcceleratorConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\AcceleratorConfig::class); + $this->accelerator_configs = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AccessConfig.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AccessConfig.php new file mode 100644 index 00000000000..3b041666ea5 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AccessConfig.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.AccessConfig + */ +class AccessConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. An external IP address associated with the TPU worker. + * + * Generated from protobuf field string external_ip = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $external_ip = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $external_ip + * Output only. An external IP address associated with the TPU worker. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Output only. An external IP address associated with the TPU worker. + * + * Generated from protobuf field string external_ip = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getExternalIp() + { + return $this->external_ip; + } + + /** + * Output only. An external IP address associated with the TPU worker. + * + * Generated from protobuf field string external_ip = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setExternalIp($var) + { + GPBUtil::checkString($var, True); + $this->external_ip = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk.php new file mode 100644 index 00000000000..246f0f6075c --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk.php @@ -0,0 +1,114 @@ +google.cloud.tpu.v2.AttachedDisk + */ +class AttachedDisk extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the full path to an existing disk. + * For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + * + * Generated from protobuf field string source_disk = 3; + */ + protected $source_disk = ''; + /** + * The mode in which to attach this disk. + * If not specified, the default is READ_WRITE mode. + * Only applicable to data_disks. + * + * Generated from protobuf field .google.cloud.tpu.v2.AttachedDisk.DiskMode mode = 4; + */ + protected $mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $source_disk + * Specifies the full path to an existing disk. + * For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + * @type int $mode + * The mode in which to attach this disk. + * If not specified, the default is READ_WRITE mode. + * Only applicable to data_disks. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the full path to an existing disk. + * For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + * + * Generated from protobuf field string source_disk = 3; + * @return string + */ + public function getSourceDisk() + { + return $this->source_disk; + } + + /** + * Specifies the full path to an existing disk. + * For example: "projects/my-project/zones/us-central1-c/disks/my-disk". + * + * Generated from protobuf field string source_disk = 3; + * @param string $var + * @return $this + */ + public function setSourceDisk($var) + { + GPBUtil::checkString($var, True); + $this->source_disk = $var; + + return $this; + } + + /** + * The mode in which to attach this disk. + * If not specified, the default is READ_WRITE mode. + * Only applicable to data_disks. + * + * Generated from protobuf field .google.cloud.tpu.v2.AttachedDisk.DiskMode mode = 4; + * @return int + */ + public function getMode() + { + return $this->mode; + } + + /** + * The mode in which to attach this disk. + * If not specified, the default is READ_WRITE mode. + * Only applicable to data_disks. + * + * Generated from protobuf field .google.cloud.tpu.v2.AttachedDisk.DiskMode mode = 4; + * @param int $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\AttachedDisk\DiskMode::class); + $this->mode = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk/DiskMode.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk/DiskMode.php new file mode 100644 index 00000000000..eea643e2e00 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/AttachedDisk/DiskMode.php @@ -0,0 +1,66 @@ +google.cloud.tpu.v2.AttachedDisk.DiskMode + */ +class DiskMode +{ + /** + * The disk mode is not known/set. + * + * Generated from protobuf enum DISK_MODE_UNSPECIFIED = 0; + */ + const DISK_MODE_UNSPECIFIED = 0; + /** + * Attaches the disk in read-write mode. Only one TPU node can attach a disk + * in read-write mode at a time. + * + * Generated from protobuf enum READ_WRITE = 1; + */ + const READ_WRITE = 1; + /** + * Attaches the disk in read-only mode. Multiple TPU nodes can attach + * a disk in read-only mode at a time. + * + * Generated from protobuf enum READ_ONLY = 2; + */ + const READ_ONLY = 2; + + private static $valueToName = [ + self::DISK_MODE_UNSPECIFIED => 'DISK_MODE_UNSPECIFIED', + self::READ_WRITE => 'READ_WRITE', + self::READ_ONLY => 'READ_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DiskMode::class, \Google\Cloud\Tpu\V2\AttachedDisk_DiskMode::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/CreateNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/CreateNodeRequest.php new file mode 100644 index 00000000000..969d7fa4a37 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/CreateNodeRequest.php @@ -0,0 +1,163 @@ +google.cloud.tpu.v2.CreateNodeRequest + */ +class CreateNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + */ + protected $node_id = ''; + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $node = null; + + /** + * @param string $parent Required. The parent resource name. Please see + * {@see TpuClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Tpu\V2\Node $node Required. The node. + * @param string $nodeId The unqualified resource name. + * + * @return \Google\Cloud\Tpu\V2\CreateNodeRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Tpu\V2\Node $node, string $nodeId): self + { + return (new self()) + ->setParent($parent) + ->setNode($node) + ->setNodeId($nodeId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type string $node_id + * The unqualified resource name. + * @type \Google\Cloud\Tpu\V2\Node $node + * Required. The node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + * @return string + */ + public function getNodeId() + { + return $this->node_id; + } + + /** + * The unqualified resource name. + * + * Generated from protobuf field string node_id = 2; + * @param string $var + * @return $this + */ + public function setNodeId($var) + { + GPBUtil::checkString($var, True); + $this->node_id = $var; + + return $this; + } + + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Tpu\V2\Node|null + */ + public function getNode() + { + return $this->node; + } + + public function hasNode() + { + return isset($this->node); + } + + public function clearNode() + { + unset($this->node); + } + + /** + * Required. The node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Tpu\V2\Node $var + * @return $this + */ + public function setNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\Node::class); + $this->node = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/DeleteNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/DeleteNodeRequest.php new file mode 100644 index 00000000000..44f643988ba --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/DeleteNodeRequest.php @@ -0,0 +1,81 @@ +google.cloud.tpu.v2.DeleteNodeRequest + */ +class DeleteNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name. Please see + * {@see TpuClient::nodeName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\DeleteNodeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityRequest.php new file mode 100644 index 00000000000..7dd5df7d149 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityRequest.php @@ -0,0 +1,68 @@ +google.cloud.tpu.v2.GenerateServiceIdentityRequest + */ +class GenerateServiceIdentityRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityResponse.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityResponse.php new file mode 100644 index 00000000000..81731c6854a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GenerateServiceIdentityResponse.php @@ -0,0 +1,78 @@ +google.cloud.tpu.v2.GenerateServiceIdentityResponse + */ +class GenerateServiceIdentityResponse extends \Google\Protobuf\Internal\Message +{ + /** + * ServiceIdentity that was created or retrieved. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceIdentity identity = 1; + */ + protected $identity = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tpu\V2\ServiceIdentity $identity + * ServiceIdentity that was created or retrieved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * ServiceIdentity that was created or retrieved. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceIdentity identity = 1; + * @return \Google\Cloud\Tpu\V2\ServiceIdentity|null + */ + public function getIdentity() + { + return $this->identity; + } + + public function hasIdentity() + { + return isset($this->identity); + } + + public function clearIdentity() + { + unset($this->identity); + } + + /** + * ServiceIdentity that was created or retrieved. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceIdentity identity = 1; + * @param \Google\Cloud\Tpu\V2\ServiceIdentity $var + * @return $this + */ + public function setIdentity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\ServiceIdentity::class); + $this->identity = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetAcceleratorTypeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetAcceleratorTypeRequest.php new file mode 100644 index 00000000000..55bb38fc7fa --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetAcceleratorTypeRequest.php @@ -0,0 +1,81 @@ +google.cloud.tpu.v2.GetAcceleratorTypeRequest + */ +class GetAcceleratorTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name. Please see + * {@see TpuClient::acceleratorTypeName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\GetAcceleratorTypeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesRequest.php new file mode 100644 index 00000000000..74e47599eae --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesRequest.php @@ -0,0 +1,139 @@ +google.cloud.tpu.v2.GetGuestAttributesRequest + */ +class GetGuestAttributesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The guest attributes path to be queried. + * + * Generated from protobuf field string query_path = 2; + */ + protected $query_path = ''; + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + * + * Generated from protobuf field repeated string worker_ids = 3; + */ + private $worker_ids; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * @type string $query_path + * The guest attributes path to be queried. + * @type array|\Google\Protobuf\Internal\RepeatedField $worker_ids + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The guest attributes path to be queried. + * + * Generated from protobuf field string query_path = 2; + * @return string + */ + public function getQueryPath() + { + return $this->query_path; + } + + /** + * The guest attributes path to be queried. + * + * Generated from protobuf field string query_path = 2; + * @param string $var + * @return $this + */ + public function setQueryPath($var) + { + GPBUtil::checkString($var, True); + $this->query_path = $var; + + return $this; + } + + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + * + * Generated from protobuf field repeated string worker_ids = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkerIds() + { + return $this->worker_ids; + } + + /** + * The 0-based worker ID. If it is empty, all workers' GuestAttributes will be + * returned. + * + * Generated from protobuf field repeated string worker_ids = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkerIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->worker_ids = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesResponse.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesResponse.php new file mode 100644 index 00000000000..7765fae22da --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetGuestAttributesResponse.php @@ -0,0 +1,68 @@ +google.cloud.tpu.v2.GetGuestAttributesResponse + */ +class GetGuestAttributesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The guest attributes for the TPU workers. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributes guest_attributes = 1; + */ + private $guest_attributes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V2\GuestAttributes>|\Google\Protobuf\Internal\RepeatedField $guest_attributes + * The guest attributes for the TPU workers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The guest attributes for the TPU workers. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributes guest_attributes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGuestAttributes() + { + return $this->guest_attributes; + } + + /** + * The guest attributes for the TPU workers. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributes guest_attributes = 1; + * @param array<\Google\Cloud\Tpu\V2\GuestAttributes>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGuestAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\GuestAttributes::class); + $this->guest_attributes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetNodeRequest.php new file mode 100644 index 00000000000..087299e90ca --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetNodeRequest.php @@ -0,0 +1,81 @@ +google.cloud.tpu.v2.GetNodeRequest + */ +class GetNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name. Please see + * {@see TpuClient::nodeName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\GetNodeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetRuntimeVersionRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetRuntimeVersionRequest.php new file mode 100644 index 00000000000..dde6c2194dd --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GetRuntimeVersionRequest.php @@ -0,0 +1,81 @@ +google.cloud.tpu.v2.GetRuntimeVersionRequest + */ +class GetRuntimeVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name. Please see + * {@see TpuClient::runtimeVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\GetRuntimeVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributes.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributes.php new file mode 100644 index 00000000000..b87b881016a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributes.php @@ -0,0 +1,119 @@ +google.cloud.tpu.v2.GuestAttributes + */ +class GuestAttributes extends \Google\Protobuf\Internal\Message +{ + /** + * The path to be queried. This can be the default namespace ('/') or a + * nested namespace ('/\/') or a specified key + * ('/\/\') + * + * Generated from protobuf field string query_path = 1; + */ + protected $query_path = ''; + /** + * The value of the requested queried path. + * + * Generated from protobuf field .google.cloud.tpu.v2.GuestAttributesValue query_value = 2; + */ + protected $query_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $query_path + * The path to be queried. This can be the default namespace ('/') or a + * nested namespace ('/\/') or a specified key + * ('/\/\') + * @type \Google\Cloud\Tpu\V2\GuestAttributesValue $query_value + * The value of the requested queried path. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The path to be queried. This can be the default namespace ('/') or a + * nested namespace ('/\/') or a specified key + * ('/\/\') + * + * Generated from protobuf field string query_path = 1; + * @return string + */ + public function getQueryPath() + { + return $this->query_path; + } + + /** + * The path to be queried. This can be the default namespace ('/') or a + * nested namespace ('/\/') or a specified key + * ('/\/\') + * + * Generated from protobuf field string query_path = 1; + * @param string $var + * @return $this + */ + public function setQueryPath($var) + { + GPBUtil::checkString($var, True); + $this->query_path = $var; + + return $this; + } + + /** + * The value of the requested queried path. + * + * Generated from protobuf field .google.cloud.tpu.v2.GuestAttributesValue query_value = 2; + * @return \Google\Cloud\Tpu\V2\GuestAttributesValue|null + */ + public function getQueryValue() + { + return $this->query_value; + } + + public function hasQueryValue() + { + return isset($this->query_value); + } + + public function clearQueryValue() + { + unset($this->query_value); + } + + /** + * The value of the requested queried path. + * + * Generated from protobuf field .google.cloud.tpu.v2.GuestAttributesValue query_value = 2; + * @param \Google\Cloud\Tpu\V2\GuestAttributesValue $var + * @return $this + */ + public function setQueryValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\GuestAttributesValue::class); + $this->query_value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesEntry.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesEntry.php new file mode 100644 index 00000000000..e854d48559e --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesEntry.php @@ -0,0 +1,135 @@ +google.cloud.tpu.v2.GuestAttributesEntry + */ +class GuestAttributesEntry extends \Google\Protobuf\Internal\Message +{ + /** + * Namespace for the guest attribute entry. + * + * Generated from protobuf field string namespace = 1; + */ + protected $namespace = ''; + /** + * Key for the guest attribute entry. + * + * Generated from protobuf field string key = 2; + */ + protected $key = ''; + /** + * Value for the guest attribute entry. + * + * Generated from protobuf field string value = 3; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $namespace + * Namespace for the guest attribute entry. + * @type string $key + * Key for the guest attribute entry. + * @type string $value + * Value for the guest attribute entry. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Namespace for the guest attribute entry. + * + * Generated from protobuf field string namespace = 1; + * @return string + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Namespace for the guest attribute entry. + * + * Generated from protobuf field string namespace = 1; + * @param string $var + * @return $this + */ + public function setNamespace($var) + { + GPBUtil::checkString($var, True); + $this->namespace = $var; + + return $this; + } + + /** + * Key for the guest attribute entry. + * + * Generated from protobuf field string key = 2; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Key for the guest attribute entry. + * + * Generated from protobuf field string key = 2; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Value for the guest attribute entry. + * + * Generated from protobuf field string value = 3; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Value for the guest attribute entry. + * + * Generated from protobuf field string value = 3; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesValue.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesValue.php new file mode 100644 index 00000000000..38a060bdb1c --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/GuestAttributesValue.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.GuestAttributesValue + */ +class GuestAttributesValue extends \Google\Protobuf\Internal\Message +{ + /** + * The list of guest attributes entries. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributesEntry items = 1; + */ + private $items; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V2\GuestAttributesEntry>|\Google\Protobuf\Internal\RepeatedField $items + * The list of guest attributes entries. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The list of guest attributes entries. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributesEntry items = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItems() + { + return $this->items; + } + + /** + * The list of guest attributes entries. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.GuestAttributesEntry items = 1; + * @param array<\Google\Cloud\Tpu\V2\GuestAttributesEntry>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItems($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\GuestAttributesEntry::class); + $this->items = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesRequest.php new file mode 100644 index 00000000000..e9bc2618b21 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesRequest.php @@ -0,0 +1,218 @@ +google.cloud.tpu.v2.ListAcceleratorTypesRequest + */ +class ListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent resource name. Please see + * {@see TpuClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\ListAcceleratorTypesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * List filter. + * @type string $order_by + * Sort results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesResponse.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesResponse.php new file mode 100644 index 00000000000..da739205691 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListAcceleratorTypesResponse.php @@ -0,0 +1,136 @@ +google.cloud.tpu.v2.ListAcceleratorTypesResponse + */ +class ListAcceleratorTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorType accelerator_types = 1; + */ + private $accelerator_types; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V2\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $accelerator_types + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorType accelerator_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAcceleratorTypes() + { + return $this->accelerator_types; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AcceleratorType accelerator_types = 1; + * @param array<\Google\Cloud\Tpu\V2\AcceleratorType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAcceleratorTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\AcceleratorType::class); + $this->accelerator_types = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesRequest.php new file mode 100644 index 00000000000..5c500f37efd --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesRequest.php @@ -0,0 +1,149 @@ +google.cloud.tpu.v2.ListNodesRequest + */ +class ListNodesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent resource name. Please see + * {@see TpuClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\ListNodesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesResponse.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesResponse.php new file mode 100644 index 00000000000..de31a212e25 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListNodesResponse.php @@ -0,0 +1,135 @@ +google.cloud.tpu.v2.ListNodesResponse + */ +class ListNodesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Node nodes = 1; + */ + private $nodes; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V2\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Node nodes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Node nodes = 1; + * @param array<\Google\Cloud\Tpu\V2\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsRequest.php new file mode 100644 index 00000000000..fd9596d6d19 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsRequest.php @@ -0,0 +1,218 @@ +google.cloud.tpu.v2.ListRuntimeVersionsRequest + */ +class ListRuntimeVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + */ + protected $filter = ''; + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent resource name. Please see + * {@see TpuClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Tpu\V2\ListRuntimeVersionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * List filter. + * @type string $order_by + * Sort results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * List filter. + * + * Generated from protobuf field string filter = 5; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sort results. + * + * Generated from protobuf field string order_by = 6; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsResponse.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsResponse.php new file mode 100644 index 00000000000..30b41ec3e8a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ListRuntimeVersionsResponse.php @@ -0,0 +1,136 @@ +google.cloud.tpu.v2.ListRuntimeVersionsResponse + */ +class ListRuntimeVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.RuntimeVersion runtime_versions = 1; + */ + private $runtime_versions; + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Tpu\V2\RuntimeVersion>|\Google\Protobuf\Internal\RepeatedField $runtime_versions + * The listed nodes. + * @type string $next_page_token + * The next page token or empty if none. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.RuntimeVersion runtime_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRuntimeVersions() + { + return $this->runtime_versions; + } + + /** + * The listed nodes. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.RuntimeVersion runtime_versions = 1; + * @param array<\Google\Cloud\Tpu\V2\RuntimeVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRuntimeVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\RuntimeVersion::class); + $this->runtime_versions = $arr; + + return $this; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next page token or empty if none. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkConfig.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkConfig.php new file mode 100644 index 00000000000..34fdb30cd9e --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkConfig.php @@ -0,0 +1,197 @@ +google.cloud.tpu.v2.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the network for the TPU node. It must be a preexisting Google + * Compute Engine network. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 1; + */ + protected $network = ''; + /** + * The name of the subnetwork for the TPU node. It must be a preexisting + * Google Compute Engine subnetwork. If none is provided, "default" will be + * used. + * + * Generated from protobuf field string subnetwork = 2; + */ + protected $subnetwork = ''; + /** + * Indicates that external IP addresses would be associated with the TPU + * workers. If set to false, the specified subnetwork or network should have + * Private Google Access enabled. + * + * Generated from protobuf field bool enable_external_ips = 3; + */ + protected $enable_external_ips = false; + /** + * Allows the TPU node to send and receive packets with non-matching + * destination or source IPs. This is required if you plan to use the TPU + * workers to forward routes. + * + * Generated from protobuf field bool can_ip_forward = 4; + */ + protected $can_ip_forward = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network + * The name of the network for the TPU node. It must be a preexisting Google + * Compute Engine network. If none is provided, "default" will be used. + * @type string $subnetwork + * The name of the subnetwork for the TPU node. It must be a preexisting + * Google Compute Engine subnetwork. If none is provided, "default" will be + * used. + * @type bool $enable_external_ips + * Indicates that external IP addresses would be associated with the TPU + * workers. If set to false, the specified subnetwork or network should have + * Private Google Access enabled. + * @type bool $can_ip_forward + * Allows the TPU node to send and receive packets with non-matching + * destination or source IPs. This is required if you plan to use the TPU + * workers to forward routes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The name of the network for the TPU node. It must be a preexisting Google + * Compute Engine network. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 1; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * The name of the network for the TPU node. It must be a preexisting Google + * Compute Engine network. If none is provided, "default" will be used. + * + * Generated from protobuf field string network = 1; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The name of the subnetwork for the TPU node. It must be a preexisting + * Google Compute Engine subnetwork. If none is provided, "default" will be + * used. + * + * Generated from protobuf field string subnetwork = 2; + * @return string + */ + public function getSubnetwork() + { + return $this->subnetwork; + } + + /** + * The name of the subnetwork for the TPU node. It must be a preexisting + * Google Compute Engine subnetwork. If none is provided, "default" will be + * used. + * + * Generated from protobuf field string subnetwork = 2; + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->subnetwork = $var; + + return $this; + } + + /** + * Indicates that external IP addresses would be associated with the TPU + * workers. If set to false, the specified subnetwork or network should have + * Private Google Access enabled. + * + * Generated from protobuf field bool enable_external_ips = 3; + * @return bool + */ + public function getEnableExternalIps() + { + return $this->enable_external_ips; + } + + /** + * Indicates that external IP addresses would be associated with the TPU + * workers. If set to false, the specified subnetwork or network should have + * Private Google Access enabled. + * + * Generated from protobuf field bool enable_external_ips = 3; + * @param bool $var + * @return $this + */ + public function setEnableExternalIps($var) + { + GPBUtil::checkBool($var); + $this->enable_external_ips = $var; + + return $this; + } + + /** + * Allows the TPU node to send and receive packets with non-matching + * destination or source IPs. This is required if you plan to use the TPU + * workers to forward routes. + * + * Generated from protobuf field bool can_ip_forward = 4; + * @return bool + */ + public function getCanIpForward() + { + return $this->can_ip_forward; + } + + /** + * Allows the TPU node to send and receive packets with non-matching + * destination or source IPs. This is required if you plan to use the TPU + * workers to forward routes. + * + * Generated from protobuf field bool can_ip_forward = 4; + * @param bool $var + * @return $this + */ + public function setCanIpForward($var) + { + GPBUtil::checkBool($var); + $this->can_ip_forward = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkEndpoint.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkEndpoint.php new file mode 100644 index 00000000000..96c0447e55c --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/NetworkEndpoint.php @@ -0,0 +1,145 @@ +google.cloud.tpu.v2.NetworkEndpoint + */ +class NetworkEndpoint extends \Google\Protobuf\Internal\Message +{ + /** + * The internal IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + */ + protected $ip_address = ''; + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + */ + protected $port = 0; + /** + * The access config for the TPU worker. + * + * Generated from protobuf field .google.cloud.tpu.v2.AccessConfig access_config = 5; + */ + protected $access_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ip_address + * The internal IP address of this network endpoint. + * @type int $port + * The port of this network endpoint. + * @type \Google\Cloud\Tpu\V2\AccessConfig $access_config + * The access config for the TPU worker. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The internal IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * The internal IP address of this network endpoint. + * + * Generated from protobuf field string ip_address = 1; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * The port of this network endpoint. + * + * Generated from protobuf field int32 port = 2; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * The access config for the TPU worker. + * + * Generated from protobuf field .google.cloud.tpu.v2.AccessConfig access_config = 5; + * @return \Google\Cloud\Tpu\V2\AccessConfig|null + */ + public function getAccessConfig() + { + return $this->access_config; + } + + public function hasAccessConfig() + { + return isset($this->access_config); + } + + public function clearAccessConfig() + { + unset($this->access_config); + } + + /** + * The access config for the TPU worker. + * + * Generated from protobuf field .google.cloud.tpu.v2.AccessConfig access_config = 5; + * @param \Google\Cloud\Tpu\V2\AccessConfig $var + * @return $this + */ + public function setAccessConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\AccessConfig::class); + $this->access_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node.php new file mode 100644 index 00000000000..d8cb3157b60 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node.php @@ -0,0 +1,965 @@ +google.cloud.tpu.v2.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Immutable. The name of the TPU. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Optional. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $accelerator_type = ''; + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $health_description = ''; + /** + * Required. The runtime version running in the Node. + * + * Generated from protobuf field string runtime_version = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $runtime_version = ''; + /** + * Network configurations for the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.NetworkConfig network_config = 36; + */ + protected $network_config = null; + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + */ + protected $cidr_block = ''; + /** + * The Google Cloud Platform Service Account to be used by the TPU node VMs. + * If None is specified, the default compute service account will be used. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceAccount service_account = 37; + */ + protected $service_account = null; + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v2.SchedulingConfig scheduling_config = 17; + */ + protected $scheduling_config = null; + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that runtime clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $network_endpoints; + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.Health health = 22; + */ + protected $health = 0; + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + */ + private $labels; + /** + * Custom metadata to apply to the TPU Node. + * Can set startup-script and shutdown-script + * + * Generated from protobuf field map metadata = 34; + */ + private $metadata; + /** + * Tags to apply to the TPU Node. Tags are used to identify valid sources or + * targets for network firewalls. + * + * Generated from protobuf field repeated string tags = 40; + */ + private $tags; + /** + * Output only. The unique identifier for the TPU Node. + * + * Generated from protobuf field int64 id = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $id = 0; + /** + * The additional data disks for the Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AttachedDisk data_disks = 41; + */ + private $data_disks; + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = 0; + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $symptoms; + /** + * Shielded Instance options. + * + * Generated from protobuf field .google.cloud.tpu.v2.ShieldedInstanceConfig shielded_instance_config = 45; + */ + protected $shielded_instance_config = null; + /** + * The AccleratorConfig for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig accelerator_config = 46; + */ + protected $accelerator_config = null; + /** + * Output only. The qualified name of the QueuedResource that requested this + * Node. + * + * Generated from protobuf field string queued_resource = 47 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $queued_resource = ''; + /** + * Output only. Whether the Node belongs to a Multislice group. + * + * Generated from protobuf field bool multislice_node = 48 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $multislice_node = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Immutable. The name of the TPU. + * @type string $description + * The user-supplied description of the TPU. Maximum of 512 characters. + * @type string $accelerator_type + * Optional. The type of hardware accelerators associated with this node. + * @type int $state + * Output only. The current state for the TPU Node. + * @type string $health_description + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * @type string $runtime_version + * Required. The runtime version running in the Node. + * @type \Google\Cloud\Tpu\V2\NetworkConfig $network_config + * Network configurations for the TPU node. + * @type string $cidr_block + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * @type \Google\Cloud\Tpu\V2\ServiceAccount $service_account + * The Google Cloud Platform Service Account to be used by the TPU node VMs. + * If None is specified, the default compute service account will be used. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time when the node was created. + * @type \Google\Cloud\Tpu\V2\SchedulingConfig $scheduling_config + * The scheduling options for this node. + * @type array<\Google\Cloud\Tpu\V2\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $network_endpoints + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that runtime clients of the node reach out + * to the 0th entry in this map first. + * @type int $health + * The health status of the TPU node. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Resource labels to represent user-provided metadata. + * @type array|\Google\Protobuf\Internal\MapField $metadata + * Custom metadata to apply to the TPU Node. + * Can set startup-script and shutdown-script + * @type array|\Google\Protobuf\Internal\RepeatedField $tags + * Tags to apply to the TPU Node. Tags are used to identify valid sources or + * targets for network firewalls. + * @type int|string $id + * Output only. The unique identifier for the TPU Node. + * @type array<\Google\Cloud\Tpu\V2\AttachedDisk>|\Google\Protobuf\Internal\RepeatedField $data_disks + * The additional data disks for the Node. + * @type int $api_version + * Output only. The API version that created this Node. + * @type array<\Google\Cloud\Tpu\V2\Symptom>|\Google\Protobuf\Internal\RepeatedField $symptoms + * Output only. The Symptoms that have occurred to the TPU Node. + * @type \Google\Cloud\Tpu\V2\ShieldedInstanceConfig $shielded_instance_config + * Shielded Instance options. + * @type \Google\Cloud\Tpu\V2\AcceleratorConfig $accelerator_config + * The AccleratorConfig for the TPU Node. + * @type string $queued_resource + * Output only. The qualified name of the QueuedResource that requested this + * Node. + * @type bool $multislice_node + * Output only. Whether the Node belongs to a Multislice group. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Immutable. The name of the TPU. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Immutable. The name of the TPU. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The user-supplied description of the TPU. Maximum of 512 characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Optional. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAcceleratorType() + { + return $this->accelerator_type; + } + + /** + * Optional. The type of hardware accelerators associated with this node. + * + * Generated from protobuf field string accelerator_type = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAcceleratorType($var) + { + GPBUtil::checkString($var, True); + $this->accelerator_type = $var; + + return $this; + } + + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.State state = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\Node\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getHealthDescription() + { + return $this->health_description; + } + + /** + * Output only. If this field is populated, it contains a description of why + * the TPU Node is unhealthy. + * + * Generated from protobuf field string health_description = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setHealthDescription($var) + { + GPBUtil::checkString($var, True); + $this->health_description = $var; + + return $this; + } + + /** + * Required. The runtime version running in the Node. + * + * Generated from protobuf field string runtime_version = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRuntimeVersion() + { + return $this->runtime_version; + } + + /** + * Required. The runtime version running in the Node. + * + * Generated from protobuf field string runtime_version = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRuntimeVersion($var) + { + GPBUtil::checkString($var, True); + $this->runtime_version = $var; + + return $this; + } + + /** + * Network configurations for the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.NetworkConfig network_config = 36; + * @return \Google\Cloud\Tpu\V2\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Network configurations for the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.NetworkConfig network_config = 36; + * @param \Google\Cloud\Tpu\V2\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + * @return string + */ + public function getCidrBlock() + { + return $this->cidr_block; + } + + /** + * The CIDR block that the TPU node will use when selecting an IP address. + * This CIDR block must be a /29 block; the Compute Engine networks API + * forbids a smaller block, and using a larger block would be wasteful (a + * node can only consume one IP address). Errors will occur if the CIDR block + * has already been used for a currently existing TPU node, the CIDR block + * conflicts with any subnetworks in the user's provided network, or the + * provided network is peered with another network that is using that CIDR + * block. + * + * Generated from protobuf field string cidr_block = 13; + * @param string $var + * @return $this + */ + public function setCidrBlock($var) + { + GPBUtil::checkString($var, True); + $this->cidr_block = $var; + + return $this; + } + + /** + * The Google Cloud Platform Service Account to be used by the TPU node VMs. + * If None is specified, the default compute service account will be used. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceAccount service_account = 37; + * @return \Google\Cloud\Tpu\V2\ServiceAccount|null + */ + public function getServiceAccount() + { + return $this->service_account; + } + + public function hasServiceAccount() + { + return isset($this->service_account); + } + + public function clearServiceAccount() + { + unset($this->service_account); + } + + /** + * The Google Cloud Platform Service Account to be used by the TPU node VMs. + * If None is specified, the default compute service account will be used. + * + * Generated from protobuf field .google.cloud.tpu.v2.ServiceAccount service_account = 37; + * @param \Google\Cloud\Tpu\V2\ServiceAccount $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\ServiceAccount::class); + $this->service_account = $var; + + return $this; + } + + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time when the node was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v2.SchedulingConfig scheduling_config = 17; + * @return \Google\Cloud\Tpu\V2\SchedulingConfig|null + */ + public function getSchedulingConfig() + { + return $this->scheduling_config; + } + + public function hasSchedulingConfig() + { + return isset($this->scheduling_config); + } + + public function clearSchedulingConfig() + { + unset($this->scheduling_config); + } + + /** + * The scheduling options for this node. + * + * Generated from protobuf field .google.cloud.tpu.v2.SchedulingConfig scheduling_config = 17; + * @param \Google\Cloud\Tpu\V2\SchedulingConfig $var + * @return $this + */ + public function setSchedulingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\SchedulingConfig::class); + $this->scheduling_config = $var; + + return $this; + } + + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that runtime clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkEndpoints() + { + return $this->network_endpoints; + } + + /** + * Output only. The network endpoints where TPU workers can be accessed and + * sent work. It is recommended that runtime clients of the node reach out + * to the 0th entry in this map first. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.NetworkEndpoint network_endpoints = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Tpu\V2\NetworkEndpoint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkEndpoints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\NetworkEndpoint::class); + $this->network_endpoints = $arr; + + return $this; + } + + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.Health health = 22; + * @return int + */ + public function getHealth() + { + return $this->health; + } + + /** + * The health status of the TPU node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.Health health = 22; + * @param int $var + * @return $this + */ + public function setHealth($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\Node\Health::class); + $this->health = $var; + + return $this; + } + + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Resource labels to represent user-provided metadata. + * + * Generated from protobuf field map labels = 24; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Custom metadata to apply to the TPU Node. + * Can set startup-script and shutdown-script + * + * Generated from protobuf field map metadata = 34; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * Custom metadata to apply to the TPU Node. + * Can set startup-script and shutdown-script + * + * Generated from protobuf field map metadata = 34; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + + /** + * Tags to apply to the TPU Node. Tags are used to identify valid sources or + * targets for network firewalls. + * + * Generated from protobuf field repeated string tags = 40; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTags() + { + return $this->tags; + } + + /** + * Tags to apply to the TPU Node. Tags are used to identify valid sources or + * targets for network firewalls. + * + * Generated from protobuf field repeated string tags = 40; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * Output only. The unique identifier for the TPU Node. + * + * Generated from protobuf field int64 id = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * Output only. The unique identifier for the TPU Node. + * + * Generated from protobuf field int64 id = 33 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + + /** + * The additional data disks for the Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AttachedDisk data_disks = 41; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataDisks() + { + return $this->data_disks; + } + + /** + * The additional data disks for the Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.AttachedDisk data_disks = 41; + * @param array<\Google\Cloud\Tpu\V2\AttachedDisk>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataDisks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\AttachedDisk::class); + $this->data_disks = $arr; + + return $this; + } + + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. The API version that created this Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node.ApiVersion api_version = 38 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\Node\ApiVersion::class); + $this->api_version = $var; + + return $this; + } + + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSymptoms() + { + return $this->symptoms; + } + + /** + * Output only. The Symptoms that have occurred to the TPU Node. + * + * Generated from protobuf field repeated .google.cloud.tpu.v2.Symptom symptoms = 39 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Tpu\V2\Symptom>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSymptoms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Tpu\V2\Symptom::class); + $this->symptoms = $arr; + + return $this; + } + + /** + * Shielded Instance options. + * + * Generated from protobuf field .google.cloud.tpu.v2.ShieldedInstanceConfig shielded_instance_config = 45; + * @return \Google\Cloud\Tpu\V2\ShieldedInstanceConfig|null + */ + public function getShieldedInstanceConfig() + { + return $this->shielded_instance_config; + } + + public function hasShieldedInstanceConfig() + { + return isset($this->shielded_instance_config); + } + + public function clearShieldedInstanceConfig() + { + unset($this->shielded_instance_config); + } + + /** + * Shielded Instance options. + * + * Generated from protobuf field .google.cloud.tpu.v2.ShieldedInstanceConfig shielded_instance_config = 45; + * @param \Google\Cloud\Tpu\V2\ShieldedInstanceConfig $var + * @return $this + */ + public function setShieldedInstanceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\ShieldedInstanceConfig::class); + $this->shielded_instance_config = $var; + + return $this; + } + + /** + * The AccleratorConfig for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig accelerator_config = 46; + * @return \Google\Cloud\Tpu\V2\AcceleratorConfig|null + */ + public function getAcceleratorConfig() + { + return $this->accelerator_config; + } + + public function hasAcceleratorConfig() + { + return isset($this->accelerator_config); + } + + public function clearAcceleratorConfig() + { + unset($this->accelerator_config); + } + + /** + * The AccleratorConfig for the TPU Node. + * + * Generated from protobuf field .google.cloud.tpu.v2.AcceleratorConfig accelerator_config = 46; + * @param \Google\Cloud\Tpu\V2\AcceleratorConfig $var + * @return $this + */ + public function setAcceleratorConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\AcceleratorConfig::class); + $this->accelerator_config = $var; + + return $this; + } + + /** + * Output only. The qualified name of the QueuedResource that requested this + * Node. + * + * Generated from protobuf field string queued_resource = 47 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getQueuedResource() + { + return $this->queued_resource; + } + + /** + * Output only. The qualified name of the QueuedResource that requested this + * Node. + * + * Generated from protobuf field string queued_resource = 47 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setQueuedResource($var) + { + GPBUtil::checkString($var, True); + $this->queued_resource = $var; + + return $this; + } + + /** + * Output only. Whether the Node belongs to a Multislice group. + * + * Generated from protobuf field bool multislice_node = 48 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getMultisliceNode() + { + return $this->multislice_node; + } + + /** + * Output only. Whether the Node belongs to a Multislice group. + * + * Generated from protobuf field bool multislice_node = 48 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setMultisliceNode($var) + { + GPBUtil::checkBool($var); + $this->multislice_node = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/ApiVersion.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/ApiVersion.php new file mode 100644 index 00000000000..61fc55ced29 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/ApiVersion.php @@ -0,0 +1,78 @@ +google.cloud.tpu.v2.Node.ApiVersion + */ +class ApiVersion +{ + /** + * API version is unknown. + * + * Generated from protobuf enum API_VERSION_UNSPECIFIED = 0; + */ + const API_VERSION_UNSPECIFIED = 0; + /** + * TPU API V1Alpha1 version. + * + * Generated from protobuf enum V1_ALPHA1 = 1; + */ + const V1_ALPHA1 = 1; + /** + * TPU API V1 version. + * + * Generated from protobuf enum V1 = 2; + */ + const V1 = 2; + /** + * TPU API V2Alpha1 version. + * + * Generated from protobuf enum V2_ALPHA1 = 3; + */ + const V2_ALPHA1 = 3; + /** + * TPU API V2 version. + * + * Generated from protobuf enum V2 = 4; + */ + const V2 = 4; + + private static $valueToName = [ + self::API_VERSION_UNSPECIFIED => 'API_VERSION_UNSPECIFIED', + self::V1_ALPHA1 => 'V1_ALPHA1', + self::V1 => 'V1', + self::V2_ALPHA1 => 'V2_ALPHA1', + self::V2 => 'V2', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApiVersion::class, \Google\Cloud\Tpu\V2\Node_ApiVersion::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/Health.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/Health.php new file mode 100644 index 00000000000..0c29dd2c488 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/Health.php @@ -0,0 +1,80 @@ +google.cloud.tpu.v2.Node.Health + */ +class Health +{ + /** + * Health status is unknown: not initialized or failed to retrieve. + * + * Generated from protobuf enum HEALTH_UNSPECIFIED = 0; + */ + const HEALTH_UNSPECIFIED = 0; + /** + * The resource is healthy. + * + * Generated from protobuf enum HEALTHY = 1; + */ + const HEALTHY = 1; + /** + * The resource is unresponsive. + * + * Generated from protobuf enum TIMEOUT = 3; + */ + const TIMEOUT = 3; + /** + * The in-guest ML stack is unhealthy. + * + * Generated from protobuf enum UNHEALTHY_TENSORFLOW = 4; + */ + const UNHEALTHY_TENSORFLOW = 4; + /** + * The node is under maintenance/priority boost caused rescheduling and + * will resume running once rescheduled. + * + * Generated from protobuf enum UNHEALTHY_MAINTENANCE = 5; + */ + const UNHEALTHY_MAINTENANCE = 5; + + private static $valueToName = [ + self::HEALTH_UNSPECIFIED => 'HEALTH_UNSPECIFIED', + self::HEALTHY => 'HEALTHY', + self::TIMEOUT => 'TIMEOUT', + self::UNHEALTHY_TENSORFLOW => 'UNHEALTHY_TENSORFLOW', + self::UNHEALTHY_MAINTENANCE => 'UNHEALTHY_MAINTENANCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Health::class, \Google\Cloud\Tpu\V2\Node_Health::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/State.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/State.php new file mode 100644 index 00000000000..79805f3f2f9 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Node/State.php @@ -0,0 +1,150 @@ +google.cloud.tpu.v2.Node.State + */ +class State +{ + /** + * TPU node state is not known/set. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * TPU node is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * TPU node has been created. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * TPU node is restarting. + * + * Generated from protobuf enum RESTARTING = 3; + */ + const RESTARTING = 3; + /** + * TPU node is undergoing reimaging. + * + * Generated from protobuf enum REIMAGING = 4; + */ + const REIMAGING = 4; + /** + * TPU node is being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + /** + * TPU node is being repaired and may be unusable. Details can be + * found in the 'help_description' field. + * + * Generated from protobuf enum REPAIRING = 6; + */ + const REPAIRING = 6; + /** + * TPU node is stopped. + * + * Generated from protobuf enum STOPPED = 8; + */ + const STOPPED = 8; + /** + * TPU node is currently stopping. + * + * Generated from protobuf enum STOPPING = 9; + */ + const STOPPING = 9; + /** + * TPU node is currently starting. + * + * Generated from protobuf enum STARTING = 10; + */ + const STARTING = 10; + /** + * TPU node has been preempted. Only applies to Preemptible TPU Nodes. + * + * Generated from protobuf enum PREEMPTED = 11; + */ + const PREEMPTED = 11; + /** + * TPU node has been terminated due to maintenance or has reached the end of + * its life cycle (for preemptible nodes). + * + * Generated from protobuf enum TERMINATED = 12; + */ + const TERMINATED = 12; + /** + * TPU node is currently hiding. + * + * Generated from protobuf enum HIDING = 13; + */ + const HIDING = 13; + /** + * TPU node has been hidden. + * + * Generated from protobuf enum HIDDEN = 14; + */ + const HIDDEN = 14; + /** + * TPU node is currently unhiding. + * + * Generated from protobuf enum UNHIDING = 15; + */ + const UNHIDING = 15; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::RESTARTING => 'RESTARTING', + self::REIMAGING => 'REIMAGING', + self::DELETING => 'DELETING', + self::REPAIRING => 'REPAIRING', + self::STOPPED => 'STOPPED', + self::STOPPING => 'STOPPING', + self::STARTING => 'STARTING', + self::PREEMPTED => 'PREEMPTED', + self::TERMINATED => 'TERMINATED', + self::HIDING => 'HIDING', + self::HIDDEN => 'HIDDEN', + self::UNHIDING => 'UNHIDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Tpu\V2\Node_State::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/OperationMetadata.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/OperationMetadata.php new file mode 100644 index 00000000000..a379c95e6f1 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/OperationMetadata.php @@ -0,0 +1,295 @@ +google.cloud.tpu.v2.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + */ + protected $status_detail = ''; + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + */ + protected $cancel_requested = false; + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * @type string $verb + * Name of the verb executed by the operation. + * @type string $status_detail + * Human-readable status of the operation, if any. + * @type bool $cancel_requested + * Specifies if cancellation was requested for the operation. + * @type string $api_version + * API version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Target of the operation - for example + * projects/project-1/connectivityTests/test-1 + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @return string + */ + public function getStatusDetail() + { + return $this->status_detail; + } + + /** + * Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_detail = 5; + * @param string $var + * @return $this + */ + public function setStatusDetail($var) + { + GPBUtil::checkString($var, True); + $this->status_detail = $var; + + return $this; + } + + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + * @return bool + */ + public function getCancelRequested() + { + return $this->cancel_requested; + } + + /** + * Specifies if cancellation was requested for the operation. + * + * Generated from protobuf field bool cancel_requested = 6; + * @param bool $var + * @return $this + */ + public function setCancelRequested($var) + { + GPBUtil::checkBool($var); + $this->cancel_requested = $var; + + return $this; + } + + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version. + * + * Generated from protobuf field string api_version = 7; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/RuntimeVersion.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/RuntimeVersion.php new file mode 100644 index 00000000000..f22ae02ff60 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/RuntimeVersion.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v2.RuntimeVersion + */ +class RuntimeVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The runtime version. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name. + * @type string $version + * The runtime version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The runtime version. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The runtime version. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/SchedulingConfig.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/SchedulingConfig.php new file mode 100644 index 00000000000..b4da318b761 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/SchedulingConfig.php @@ -0,0 +1,101 @@ +google.cloud.tpu.v2.SchedulingConfig + */ +class SchedulingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + */ + protected $preemptible = false; + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + */ + protected $reserved = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $preemptible + * Defines whether the node is preemptible. + * @type bool $reserved + * Whether the node is created under a reservation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + * @return bool + */ + public function getPreemptible() + { + return $this->preemptible; + } + + /** + * Defines whether the node is preemptible. + * + * Generated from protobuf field bool preemptible = 1; + * @param bool $var + * @return $this + */ + public function setPreemptible($var) + { + GPBUtil::checkBool($var); + $this->preemptible = $var; + + return $this; + } + + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + * @return bool + */ + public function getReserved() + { + return $this->reserved; + } + + /** + * Whether the node is created under a reservation. + * + * Generated from protobuf field bool reserved = 2; + * @param bool $var + * @return $this + */ + public function setReserved($var) + { + GPBUtil::checkBool($var); + $this->reserved = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceAccount.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceAccount.php new file mode 100644 index 00000000000..d60a1baef2b --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceAccount.php @@ -0,0 +1,109 @@ +google.cloud.tpu.v2.ServiceAccount + */ +class ServiceAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Email address of the service account. If empty, default Compute service + * account will be used. + * + * Generated from protobuf field string email = 1; + */ + protected $email = ''; + /** + * The list of scopes to be made available for this service account. If empty, + * access to all Cloud APIs will be allowed. + * + * Generated from protobuf field repeated string scope = 2; + */ + private $scope; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $email + * Email address of the service account. If empty, default Compute service + * account will be used. + * @type array|\Google\Protobuf\Internal\RepeatedField $scope + * The list of scopes to be made available for this service account. If empty, + * access to all Cloud APIs will be allowed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Email address of the service account. If empty, default Compute service + * account will be used. + * + * Generated from protobuf field string email = 1; + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Email address of the service account. If empty, default Compute service + * account will be used. + * + * Generated from protobuf field string email = 1; + * @param string $var + * @return $this + */ + public function setEmail($var) + { + GPBUtil::checkString($var, True); + $this->email = $var; + + return $this; + } + + /** + * The list of scopes to be made available for this service account. If empty, + * access to all Cloud APIs will be allowed. + * + * Generated from protobuf field repeated string scope = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScope() + { + return $this->scope; + } + + /** + * The list of scopes to be made available for this service account. If empty, + * access to all Cloud APIs will be allowed. + * + * Generated from protobuf field repeated string scope = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScope($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->scope = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceIdentity.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceIdentity.php new file mode 100644 index 00000000000..2e2ead14fdf --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ServiceIdentity.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.ServiceIdentity + */ +class ServiceIdentity extends \Google\Protobuf\Internal\Message +{ + /** + * The email address of the service identity. + * + * Generated from protobuf field string email = 1; + */ + protected $email = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $email + * The email address of the service identity. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * The email address of the service identity. + * + * Generated from protobuf field string email = 1; + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * The email address of the service identity. + * + * Generated from protobuf field string email = 1; + * @param string $var + * @return $this + */ + public function setEmail($var) + { + GPBUtil::checkString($var, True); + $this->email = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ShieldedInstanceConfig.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ShieldedInstanceConfig.php new file mode 100644 index 00000000000..26d25713071 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/ShieldedInstanceConfig.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.ShieldedInstanceConfig + */ +class ShieldedInstanceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Defines whether the instance has Secure Boot enabled. + * + * Generated from protobuf field bool enable_secure_boot = 1; + */ + protected $enable_secure_boot = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_secure_boot + * Defines whether the instance has Secure Boot enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Defines whether the instance has Secure Boot enabled. + * + * Generated from protobuf field bool enable_secure_boot = 1; + * @return bool + */ + public function getEnableSecureBoot() + { + return $this->enable_secure_boot; + } + + /** + * Defines whether the instance has Secure Boot enabled. + * + * Generated from protobuf field bool enable_secure_boot = 1; + * @param bool $var + * @return $this + */ + public function setEnableSecureBoot($var) + { + GPBUtil::checkBool($var); + $this->enable_secure_boot = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StartNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StartNodeRequest.php new file mode 100644 index 00000000000..31f7c5bc5c1 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StartNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.StartNodeRequest + */ +class StartNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StopNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StopNodeRequest.php new file mode 100644 index 00000000000..ffa5a6bf091 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/StopNodeRequest.php @@ -0,0 +1,67 @@ +google.cloud.tpu.v2.StopNodeRequest + */ +class StopNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom.php new file mode 100644 index 00000000000..647e1eb91a0 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom.php @@ -0,0 +1,179 @@ +google.cloud.tpu.v2.Symptom + */ +class Symptom extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v2.Symptom.SymptomType symptom_type = 2; + */ + protected $symptom_type = 0; + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + */ + protected $details = ''; + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + */ + protected $worker_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Timestamp when the Symptom is created. + * @type int $symptom_type + * Type of the Symptom. + * @type string $details + * Detailed information of the current Symptom. + * @type string $worker_id + * A string used to uniquely distinguish a worker within a TPU node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Timestamp when the Symptom is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v2.Symptom.SymptomType symptom_type = 2; + * @return int + */ + public function getSymptomType() + { + return $this->symptom_type; + } + + /** + * Type of the Symptom. + * + * Generated from protobuf field .google.cloud.tpu.v2.Symptom.SymptomType symptom_type = 2; + * @param int $var + * @return $this + */ + public function setSymptomType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Tpu\V2\Symptom\SymptomType::class); + $this->symptom_type = $var; + + return $this; + } + + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Detailed information of the current Symptom. + * + * Generated from protobuf field string details = 3; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + * @return string + */ + public function getWorkerId() + { + return $this->worker_id; + } + + /** + * A string used to uniquely distinguish a worker within a TPU node. + * + * Generated from protobuf field string worker_id = 4; + * @param string $var + * @return $this + */ + public function setWorkerId($var) + { + GPBUtil::checkString($var, True); + $this->worker_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom/SymptomType.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom/SymptomType.php new file mode 100644 index 00000000000..63ba37fe0b4 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/Symptom/SymptomType.php @@ -0,0 +1,94 @@ +google.cloud.tpu.v2.Symptom.SymptomType + */ +class SymptomType +{ + /** + * Unspecified symptom. + * + * Generated from protobuf enum SYMPTOM_TYPE_UNSPECIFIED = 0; + */ + const SYMPTOM_TYPE_UNSPECIFIED = 0; + /** + * TPU VM memory is low. + * + * Generated from protobuf enum LOW_MEMORY = 1; + */ + const LOW_MEMORY = 1; + /** + * TPU runtime is out of memory. + * + * Generated from protobuf enum OUT_OF_MEMORY = 2; + */ + const OUT_OF_MEMORY = 2; + /** + * TPU runtime execution has timed out. + * + * Generated from protobuf enum EXECUTE_TIMED_OUT = 3; + */ + const EXECUTE_TIMED_OUT = 3; + /** + * TPU runtime fails to construct a mesh that recognizes each TPU device's + * neighbors. + * + * Generated from protobuf enum MESH_BUILD_FAIL = 4; + */ + const MESH_BUILD_FAIL = 4; + /** + * TPU HBM is out of memory. + * + * Generated from protobuf enum HBM_OUT_OF_MEMORY = 5; + */ + const HBM_OUT_OF_MEMORY = 5; + /** + * Abusive behaviors have been identified on the current project. + * + * Generated from protobuf enum PROJECT_ABUSE = 6; + */ + const PROJECT_ABUSE = 6; + + private static $valueToName = [ + self::SYMPTOM_TYPE_UNSPECIFIED => 'SYMPTOM_TYPE_UNSPECIFIED', + self::LOW_MEMORY => 'LOW_MEMORY', + self::OUT_OF_MEMORY => 'OUT_OF_MEMORY', + self::EXECUTE_TIMED_OUT => 'EXECUTE_TIMED_OUT', + self::MESH_BUILD_FAIL => 'MESH_BUILD_FAIL', + self::HBM_OUT_OF_MEMORY => 'HBM_OUT_OF_MEMORY', + self::PROJECT_ABUSE => 'PROJECT_ABUSE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SymptomType::class, \Google\Cloud\Tpu\V2\Symptom_SymptomType::class); + diff --git a/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/UpdateNodeRequest.php b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/UpdateNodeRequest.php new file mode 100644 index 00000000000..ccf8a1a8a1a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/proto/src/Google/Cloud/Tpu/V2/UpdateNodeRequest.php @@ -0,0 +1,146 @@ +google.cloud.tpu.v2.UpdateNodeRequest + */ +class UpdateNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The node. Only fields specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $node = null; + + /** + * @param \Google\Cloud\Tpu\V2\Node $node Required. The node. Only fields specified in update_mask are updated. + * @param \Google\Protobuf\FieldMask $updateMask Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * + * @return \Google\Cloud\Tpu\V2\UpdateNodeRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Tpu\V2\Node $node, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setNode($node) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * @type \Google\Cloud\Tpu\V2\Node $node + * Required. The node. Only fields specified in update_mask are updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Tpu\V2\CloudTpu::initOnce(); + parent::__construct($data); + } + + /** + * Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Mask of fields from [Node][Tpu.Node] to update. + * Supported fields: [description, tags, labels, metadata, + * network_config.enable_external_ips]. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The node. Only fields specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Tpu\V2\Node|null + */ + public function getNode() + { + return $this->node; + } + + public function hasNode() + { + return isset($this->node); + } + + public function clearNode() + { + unset($this->node); + } + + /** + * Required. The node. Only fields specified in update_mask are updated. + * + * Generated from protobuf field .google.cloud.tpu.v2.Node node = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Tpu\V2\Node $var + * @return $this + */ + public function setNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Tpu\V2\Node::class); + $this->node = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/create_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/create_node.php new file mode 100644 index 00000000000..ce91ceaa31e --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/create_node.php @@ -0,0 +1,88 @@ +setRuntimeVersion($nodeRuntimeVersion); + $request = (new CreateNodeRequest()) + ->setParent($formattedParent) + ->setNode($node); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->createNode($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + $nodeRuntimeVersion = '[RUNTIME_VERSION]'; + + create_node_sample($formattedParent, $nodeRuntimeVersion); +} +// [END tpu_v2_generated_Tpu_CreateNode_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/delete_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/delete_node.php new file mode 100644 index 00000000000..5fc7f8cecce --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/delete_node.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->deleteNode($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + delete_node_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_DeleteNode_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/generate_service_identity.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/generate_service_identity.php new file mode 100644 index 00000000000..d2a38e6cbda --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/generate_service_identity.php @@ -0,0 +1,71 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var GenerateServiceIdentityResponse $response */ + $response = $tpuClient->generateServiceIdentity($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + + generate_service_identity_sample($formattedParent); +} +// [END tpu_v2_generated_Tpu_GenerateServiceIdentity_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_accelerator_type.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_accelerator_type.php new file mode 100644 index 00000000000..72be76c87df --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_accelerator_type.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AcceleratorType $response */ + $response = $tpuClient->getAcceleratorType($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + + get_accelerator_type_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_GetAcceleratorType_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_guest_attributes.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_guest_attributes.php new file mode 100644 index 00000000000..b7db1bcc83a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_guest_attributes.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var GetGuestAttributesResponse $response */ + $response = $tpuClient->getGuestAttributes($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + get_guest_attributes_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_GetGuestAttributes_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_location.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_location.php new file mode 100644 index 00000000000..d646747809a --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v2_generated_Tpu_GetLocation_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_node.php new file mode 100644 index 00000000000..62de241f7e9 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_node.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Node $response */ + $response = $tpuClient->getNode($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + get_node_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_GetNode_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_runtime_version.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_runtime_version.php new file mode 100644 index 00000000000..7145700a02c --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/get_runtime_version.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RuntimeVersion $response */ + $response = $tpuClient->getRuntimeVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::runtimeVersionName('[PROJECT]', '[LOCATION]', '[RUNTIME_VERSION]'); + + get_runtime_version_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_GetRuntimeVersion_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_accelerator_types.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_accelerator_types.php new file mode 100644 index 00000000000..050e231be85 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_accelerator_types.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $tpuClient->listAcceleratorTypes($request); + + /** @var AcceleratorType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + + list_accelerator_types_sample($formattedParent); +} +// [END tpu_v2_generated_Tpu_ListAcceleratorTypes_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_locations.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_locations.php new file mode 100644 index 00000000000..33ac01cf10e --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END tpu_v2_generated_Tpu_ListLocations_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_nodes.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_nodes.php new file mode 100644 index 00000000000..1aa01332f81 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_nodes.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $tpuClient->listNodes($request); + + /** @var Node $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + + list_nodes_sample($formattedParent); +} +// [END tpu_v2_generated_Tpu_ListNodes_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_runtime_versions.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_runtime_versions.php new file mode 100644 index 00000000000..334e1b0a7fe --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/list_runtime_versions.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $tpuClient->listRuntimeVersions($request); + + /** @var RuntimeVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TpuClient::locationName('[PROJECT]', '[LOCATION]'); + + list_runtime_versions_sample($formattedParent); +} +// [END tpu_v2_generated_Tpu_ListRuntimeVersions_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/start_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/start_node.php new file mode 100644 index 00000000000..391c83536eb --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/start_node.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->startNode($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + start_node_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_StartNode_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/stop_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/stop_node.php new file mode 100644 index 00000000000..089b6892942 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/stop_node.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->stopNode($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TpuClient::nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + + stop_node_sample($formattedName); +} +// [END tpu_v2_generated_Tpu_StopNode_sync] diff --git a/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/update_node.php b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/update_node.php new file mode 100644 index 00000000000..7509f0a2ee4 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/samples/V2/TpuClient/update_node.php @@ -0,0 +1,87 @@ +setRuntimeVersion($nodeRuntimeVersion); + $request = (new UpdateNodeRequest()) + ->setUpdateMask($updateMask) + ->setNode($node); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $tpuClient->updateNode($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Node $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $nodeRuntimeVersion = '[RUNTIME_VERSION]'; + + update_node_sample($nodeRuntimeVersion); +} +// [END tpu_v2_generated_Tpu_UpdateNode_sync] diff --git a/owl-bot-staging/Tpu/v2/src/V2/Client/TpuClient.php b/owl-bot-staging/Tpu/v2/src/V2/Client/TpuClient.php new file mode 100644 index 00000000000..8eef51f1017 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/src/V2/Client/TpuClient.php @@ -0,0 +1,732 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/tpu_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/tpu_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/tpu_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/tpu_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * accelerator_type resource. + * + * @param string $project + * @param string $location + * @param string $acceleratorType + * + * @return string The formatted accelerator_type resource. + */ + public static function acceleratorTypeName(string $project, string $location, string $acceleratorType): string + { + return self::getPathTemplate('acceleratorType')->render([ + 'project' => $project, + 'location' => $location, + 'accelerator_type' => $acceleratorType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node + * resource. + * + * @param string $project + * @param string $location + * @param string $node + * + * @return string The formatted node resource. + */ + public static function nodeName(string $project, string $location, string $node): string + { + return self::getPathTemplate('node')->render([ + 'project' => $project, + 'location' => $location, + 'node' => $node, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * runtime_version resource. + * + * @param string $project + * @param string $location + * @param string $runtimeVersion + * + * @return string The formatted runtime_version resource. + */ + public static function runtimeVersionName(string $project, string $location, string $runtimeVersion): string + { + return self::getPathTemplate('runtimeVersion')->render([ + 'project' => $project, + 'location' => $location, + 'runtime_version' => $runtimeVersion, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - acceleratorType: projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type} + * - location: projects/{project}/locations/{location} + * - node: projects/{project}/locations/{location}/nodes/{node} + * - runtimeVersion: projects/{project}/locations/{location}/runtimeVersions/{runtime_version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'tpu.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a node. + * + * The async variant is {@see TpuClient::createNodeAsync()} . + * + * @example samples/V2/TpuClient/create_node.php + * + * @param CreateNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNode(CreateNodeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateNode', $request, $callOptions)->wait(); + } + + /** + * Deletes a node. + * + * The async variant is {@see TpuClient::deleteNodeAsync()} . + * + * @example samples/V2/TpuClient/delete_node.php + * + * @param DeleteNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteNode(DeleteNodeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteNode', $request, $callOptions)->wait(); + } + + /** + * Generates the Cloud TPU service identity for the project. + * + * The async variant is {@see TpuClient::generateServiceIdentityAsync()} . + * + * @example samples/V2/TpuClient/generate_service_identity.php + * + * @param GenerateServiceIdentityRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 GenerateServiceIdentityResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateServiceIdentity(GenerateServiceIdentityRequest $request, array $callOptions = []): GenerateServiceIdentityResponse + { + return $this->startApiCall('GenerateServiceIdentity', $request, $callOptions)->wait(); + } + + /** + * Gets AcceleratorType. + * + * The async variant is {@see TpuClient::getAcceleratorTypeAsync()} . + * + * @example samples/V2/TpuClient/get_accelerator_type.php + * + * @param GetAcceleratorTypeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 AcceleratorType + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAcceleratorType(GetAcceleratorTypeRequest $request, array $callOptions = []): AcceleratorType + { + return $this->startApiCall('GetAcceleratorType', $request, $callOptions)->wait(); + } + + /** + * Retrieves the guest attributes for the node. + * + * The async variant is {@see TpuClient::getGuestAttributesAsync()} . + * + * @example samples/V2/TpuClient/get_guest_attributes.php + * + * @param GetGuestAttributesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 GetGuestAttributesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function getGuestAttributes(GetGuestAttributesRequest $request, array $callOptions = []): GetGuestAttributesResponse + { + return $this->startApiCall('GetGuestAttributes', $request, $callOptions)->wait(); + } + + /** + * Gets the details of a node. + * + * The async variant is {@see TpuClient::getNodeAsync()} . + * + * @example samples/V2/TpuClient/get_node.php + * + * @param GetNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Node + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNode(GetNodeRequest $request, array $callOptions = []): Node + { + return $this->startApiCall('GetNode', $request, $callOptions)->wait(); + } + + /** + * Gets a runtime version. + * + * The async variant is {@see TpuClient::getRuntimeVersionAsync()} . + * + * @example samples/V2/TpuClient/get_runtime_version.php + * + * @param GetRuntimeVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 RuntimeVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function getRuntimeVersion(GetRuntimeVersionRequest $request, array $callOptions = []): RuntimeVersion + { + return $this->startApiCall('GetRuntimeVersion', $request, $callOptions)->wait(); + } + + /** + * Lists accelerator types supported by this API. + * + * The async variant is {@see TpuClient::listAcceleratorTypesAsync()} . + * + * @example samples/V2/TpuClient/list_accelerator_types.php + * + * @param ListAcceleratorTypesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAcceleratorTypes(ListAcceleratorTypesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAcceleratorTypes', $request, $callOptions); + } + + /** + * Lists nodes. + * + * The async variant is {@see TpuClient::listNodesAsync()} . + * + * @example samples/V2/TpuClient/list_nodes.php + * + * @param ListNodesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNodes(ListNodesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNodes', $request, $callOptions); + } + + /** + * Lists runtime versions supported by this API. + * + * The async variant is {@see TpuClient::listRuntimeVersionsAsync()} . + * + * @example samples/V2/TpuClient/list_runtime_versions.php + * + * @param ListRuntimeVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listRuntimeVersions(ListRuntimeVersionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListRuntimeVersions', $request, $callOptions); + } + + /** + * Starts a node. + * + * The async variant is {@see TpuClient::startNodeAsync()} . + * + * @example samples/V2/TpuClient/start_node.php + * + * @param StartNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function startNode(StartNodeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('StartNode', $request, $callOptions)->wait(); + } + + /** + * Stops a node. This operation is only available with single TPU nodes. + * + * The async variant is {@see TpuClient::stopNodeAsync()} . + * + * @example samples/V2/TpuClient/stop_node.php + * + * @param StopNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function stopNode(StopNodeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('StopNode', $request, $callOptions)->wait(); + } + + /** + * Updates the configurations of a node. + * + * The async variant is {@see TpuClient::updateNodeAsync()} . + * + * @example samples/V2/TpuClient/update_node.php + * + * @param UpdateNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNode(UpdateNodeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateNode', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see TpuClient::getLocationAsync()} . + * + * @example samples/V2/TpuClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see TpuClient::listLocationsAsync()} . + * + * @example samples/V2/TpuClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Tpu/v2/src/V2/gapic_metadata.json b/owl-bot-staging/Tpu/v2/src/V2/gapic_metadata.json new file mode 100644 index 00000000000..578c9042f1c --- /dev/null +++ b/owl-bot-staging/Tpu/v2/src/V2/gapic_metadata.json @@ -0,0 +1,93 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.tpu.v2", + "libraryPackage": "Google\\Cloud\\Tpu\\V2", + "services": { + "Tpu": { + "clients": { + "grpc": { + "libraryClient": "TpuGapicClient", + "rpcs": { + "CreateNode": { + "methods": [ + "createNode" + ] + }, + "DeleteNode": { + "methods": [ + "deleteNode" + ] + }, + "GenerateServiceIdentity": { + "methods": [ + "generateServiceIdentity" + ] + }, + "GetAcceleratorType": { + "methods": [ + "getAcceleratorType" + ] + }, + "GetGuestAttributes": { + "methods": [ + "getGuestAttributes" + ] + }, + "GetNode": { + "methods": [ + "getNode" + ] + }, + "GetRuntimeVersion": { + "methods": [ + "getRuntimeVersion" + ] + }, + "ListAcceleratorTypes": { + "methods": [ + "listAcceleratorTypes" + ] + }, + "ListNodes": { + "methods": [ + "listNodes" + ] + }, + "ListRuntimeVersions": { + "methods": [ + "listRuntimeVersions" + ] + }, + "StartNode": { + "methods": [ + "startNode" + ] + }, + "StopNode": { + "methods": [ + "stopNode" + ] + }, + "UpdateNode": { + "methods": [ + "updateNode" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_client_config.json b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_client_config.json new file mode 100644 index 00000000000..322cbc5f376 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_client_config.json @@ -0,0 +1,107 @@ +{ + "interfaces": { + "google.cloud.tpu.v2.Tpu": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateServiceIdentity": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetAcceleratorType": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetGuestAttributes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetRuntimeVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListAcceleratorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListNodes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListRuntimeVersions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "StartNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "StopNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateNode": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_descriptor_config.php b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_descriptor_config.php new file mode 100644 index 00000000000..6472b5cfffd --- /dev/null +++ b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_descriptor_config.php @@ -0,0 +1,264 @@ + [ + 'google.cloud.tpu.v2.Tpu' => [ + 'CreateNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V2\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Tpu\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'StartNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V2\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'StopNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V2\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateNode' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Tpu\V2\Node', + 'metadataReturnType' => '\Google\Cloud\Tpu\V2\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'node.name', + 'fieldAccessors' => [ + 'getNode', + 'getName', + ], + ], + ], + ], + 'GenerateServiceIdentity' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\GenerateServiceIdentityResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetAcceleratorType' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\AcceleratorType', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetGuestAttributes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\GetGuestAttributesResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNode' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\Node', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetRuntimeVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\RuntimeVersion', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAcceleratorTypes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAcceleratorTypes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\ListAcceleratorTypesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNodes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\ListNodesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimeVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRuntimeVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Tpu\V2\ListRuntimeVersionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'acceleratorType' => 'projects/{project}/locations/{location}/acceleratorTypes/{accelerator_type}', + 'location' => 'projects/{project}/locations/{location}', + 'node' => 'projects/{project}/locations/{location}/nodes/{node}', + 'runtimeVersion' => 'projects/{project}/locations/{location}/runtimeVersions/{runtime_version}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_rest_client_config.php b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_rest_client_config.php new file mode 100644 index 00000000000..b3446b2d736 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/src/V2/resources/tpu_rest_client_config.php @@ -0,0 +1,232 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.tpu.v2.Tpu' => [ + 'CreateNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/nodes', + 'body' => 'node', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteNode' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/nodes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateServiceIdentity' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}:generateServiceIdentity', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetAcceleratorType' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/acceleratorTypes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGuestAttributes' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/nodes/*}:getGuestAttributes', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNode' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/nodes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetRuntimeVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/runtimeVersions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAcceleratorTypes' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/acceleratorTypes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodes' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/nodes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListRuntimeVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/locations/*}/runtimeVersions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'StartNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/nodes/*}:start', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StopNode' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/nodes/*}:stop', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateNode' => [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{node.name=projects/*/locations/*/nodes/*}', + 'body' => 'node', + 'placeholders' => [ + 'node.name' => [ + 'getters' => [ + 'getNode', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}:cancel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Tpu/v2/tests/Unit/V2/Client/TpuClientTest.php b/owl-bot-staging/Tpu/v2/tests/Unit/V2/Client/TpuClientTest.php new file mode 100644 index 00000000000..c2a81711392 --- /dev/null +++ b/owl-bot-staging/Tpu/v2/tests/Unit/V2/Client/TpuClientTest.php @@ -0,0 +1,1552 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TpuClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TpuClient($options); + } + + /** @test */ + public function createNodeTest() + { + $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/createNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $node = new Node(); + $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; + $node->setRuntimeVersion($nodeRuntimeVersion); + $request = (new CreateNodeRequest()) + ->setParent($formattedParent) + ->setNode($node); + $response = $gapicClient->createNode($request); + $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.tpu.v2.Tpu/CreateNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNode(); + $this->assertProtobufEquals($node, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeTest'); + $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 createNodeExceptionTest() + { + $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/createNodeTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $node = new Node(); + $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; + $node->setRuntimeVersion($nodeRuntimeVersion); + $request = (new CreateNodeRequest()) + ->setParent($formattedParent) + ->setNode($node); + $response = $gapicClient->createNode($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeTest'); + 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 deleteNodeTest() + { + $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/deleteNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new DeleteNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNode($request); + $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.tpu.v2.Tpu/DeleteNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); + $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 deleteNodeExceptionTest() + { + $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/deleteNodeTest'); + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new DeleteNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNode($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNodeTest'); + 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 generateServiceIdentityTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GenerateServiceIdentityResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GenerateServiceIdentityRequest()) + ->setParent($formattedParent); + $response = $gapicClient->generateServiceIdentity($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/GenerateServiceIdentity', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateServiceIdentityExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GenerateServiceIdentityRequest()) + ->setParent($formattedParent); + try { + $gapicClient->generateServiceIdentity($request); + // 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()); + } + + /** @test */ + public function getAcceleratorTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $expectedResponse = new AcceleratorType(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + $request = (new GetAcceleratorTypeRequest()) + ->setName($formattedName); + $response = $gapicClient->getAcceleratorType($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/GetAcceleratorType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAcceleratorTypeExceptionTest() + { + $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 + $formattedName = $gapicClient->acceleratorTypeName('[PROJECT]', '[LOCATION]', '[ACCELERATOR_TYPE]'); + $request = (new GetAcceleratorTypeRequest()) + ->setName($formattedName); + try { + $gapicClient->getAcceleratorType($request); + // 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()); + } + + /** @test */ + public function getGuestAttributesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GetGuestAttributesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new GetGuestAttributesRequest()) + ->setName($formattedName); + $response = $gapicClient->getGuestAttributes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/GetGuestAttributes', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGuestAttributesExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new GetGuestAttributesRequest()) + ->setName($formattedName); + try { + $gapicClient->getGuestAttributes($request); + // 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()); + } + + /** @test */ + public function getNodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new GetNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->getNode($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/GetNode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new GetNodeRequest()) + ->setName($formattedName); + try { + $gapicClient->getNode($request); + // 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()); + } + + /** @test */ + public function getRuntimeVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $version = 'version351608024'; + $expectedResponse = new RuntimeVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setVersion($version); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->runtimeVersionName('[PROJECT]', '[LOCATION]', '[RUNTIME_VERSION]'); + $request = (new GetRuntimeVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->getRuntimeVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/GetRuntimeVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getRuntimeVersionExceptionTest() + { + $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 + $formattedName = $gapicClient->runtimeVersionName('[PROJECT]', '[LOCATION]', '[RUNTIME_VERSION]'); + $request = (new GetRuntimeVersionRequest()) + ->setName($formattedName); + try { + $gapicClient->getRuntimeVersion($request); + // 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()); + } + + /** @test */ + public function listAcceleratorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $acceleratorTypesElement = new AcceleratorType(); + $acceleratorTypes = [ + $acceleratorTypesElement, + ]; + $expectedResponse = new ListAcceleratorTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAcceleratorTypes($acceleratorTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAcceleratorTypesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAcceleratorTypes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAcceleratorTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/ListAcceleratorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAcceleratorTypesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAcceleratorTypesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAcceleratorTypes($request); + // 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()); + } + + /** @test */ + public function listNodesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodesElement = new Node(); + $nodes = [ + $nodesElement, + ]; + $expectedResponse = new ListNodesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodes($nodes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNodesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNodes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/ListNodes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNodesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNodes($request); + // 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()); + } + + /** @test */ + public function listRuntimeVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $runtimeVersionsElement = new RuntimeVersion(); + $runtimeVersions = [ + $runtimeVersionsElement, + ]; + $expectedResponse = new ListRuntimeVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRuntimeVersions($runtimeVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRuntimeVersionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listRuntimeVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRuntimeVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.tpu.v2.Tpu/ListRuntimeVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listRuntimeVersionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListRuntimeVersionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listRuntimeVersions($request); + // 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()); + } + + /** @test */ + public function startNodeTest() + { + $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/startNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new StartNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->startNode($request); + $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.tpu.v2.Tpu/StartNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startNodeTest'); + $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 startNodeExceptionTest() + { + $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/startNodeTest'); + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new StartNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->startNode($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startNodeTest'); + 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 stopNodeTest() + { + $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/stopNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/stopNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new StopNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->stopNode($request); + $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.tpu.v2.Tpu/StopNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopNodeTest'); + $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 stopNodeExceptionTest() + { + $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/stopNodeTest'); + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[NODE]'); + $request = (new StopNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->stopNode($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopNodeTest'); + 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 updateNodeTest() + { + $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/updateNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $node = new Node(); + $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; + $node->setRuntimeVersion($nodeRuntimeVersion); + $request = (new UpdateNodeRequest()) + ->setUpdateMask($updateMask) + ->setNode($node); + $response = $gapicClient->updateNode($request); + $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.tpu.v2.Tpu/UpdateNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getNode(); + $this->assertProtobufEquals($node, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNodeTest'); + $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 updateNodeExceptionTest() + { + $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/updateNodeTest'); + $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 + $updateMask = new FieldMask(); + $node = new Node(); + $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; + $node->setRuntimeVersion($nodeRuntimeVersion); + $request = (new UpdateNodeRequest()) + ->setUpdateMask($updateMask) + ->setNode($node); + $response = $gapicClient->updateNode($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNodeTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function createNodeAsyncTest() + { + $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/createNodeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $acceleratorType = 'acceleratorType1748643982'; + $healthDescription = 'healthDescription-1057342823'; + $runtimeVersion = 'runtimeVersion1819622257'; + $cidrBlock = 'cidrBlock313022466'; + $id = 3355; + $queuedResource = 'queuedResource-1642799782'; + $multisliceNode = true; + $expectedResponse = new Node(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setAcceleratorType($acceleratorType); + $expectedResponse->setHealthDescription($healthDescription); + $expectedResponse->setRuntimeVersion($runtimeVersion); + $expectedResponse->setCidrBlock($cidrBlock); + $expectedResponse->setId($id); + $expectedResponse->setQueuedResource($queuedResource); + $expectedResponse->setMultisliceNode($multisliceNode); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNodeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $node = new Node(); + $nodeRuntimeVersion = 'nodeRuntimeVersion-385109886'; + $node->setRuntimeVersion($nodeRuntimeVersion); + $request = (new CreateNodeRequest()) + ->setParent($formattedParent) + ->setNode($node); + $response = $gapicClient->createNodeAsync($request)->wait(); + $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.tpu.v2.Tpu/CreateNode', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNode(); + $this->assertProtobufEquals($node, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNodeTest'); + $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()); + } +} diff --git a/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Trace.php b/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Trace.php new file mode 100644 index 00000000000..24aa0ed04f3 Binary files /dev/null and b/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Trace.php differ diff --git a/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Tracing.php b/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Tracing.php new file mode 100644 index 00000000000..721cc99ca70 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/GPBMetadata/Google/Devtools/Cloudtrace/V2/Tracing.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile( + ' + ++google/devtools/cloudtrace/v2/tracing.protogoogle.devtools.cloudtrace.v2google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto)google/devtools/cloudtrace/v2/trace.protogoogle/protobuf/empty.proto" +BatchWriteSpansRequestA +name ( B3AA- ++cloudresourcemanager.googleapis.com/Project7 +spans ( 2#.google.devtools.cloudtrace.v2.SpanBA2 + TraceService +BatchWriteSpans5.google.devtools.cloudtrace.v2.BatchWriteSpansRequest.google.protobuf.Empty"?A +name,spans,"\'/v2/{name=projects/*}/traces:batchWrite:* + +CreateSpan#.google.devtools.cloudtrace.v2.Span#.google.devtools.cloudtrace.v2.Span"1+"&/v2/{name=projects/*/traces/*/spans/*}:*zAcloudtrace.googleapis.comA[https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/trace.appendB +!com.google.devtools.cloudtrace.v2B TracingProtoPZ/cloud.google.com/go/trace/apiv2/tracepb;tracepbGoogle.Cloud.Trace.V2Google\\Cloud\\Trace\\V2Google::Cloud::Trace::V2bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/AttributeValue.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/AttributeValue.php new file mode 100644 index 00000000000..21c9a6c262c --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/AttributeValue.php @@ -0,0 +1,141 @@ +google.devtools.cloudtrace.v2.AttributeValue + */ +class AttributeValue extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Trace\V2\TruncatableString $string_value + * A string up to 256 bytes long. + * @type int|string $int_value + * A 64-bit signed integer. + * @type bool $bool_value + * A Boolean value represented by `true` or `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * A string up to 256 bytes long. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString string_value = 1; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getStringValue() + { + return $this->readOneof(1); + } + + public function hasStringValue() + { + return $this->hasOneof(1); + } + + /** + * A string up to 256 bytes long. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString string_value = 1; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A 64-bit signed integer. + * + * Generated from protobuf field int64 int_value = 2; + * @return int|string + */ + public function getIntValue() + { + return $this->readOneof(2); + } + + public function hasIntValue() + { + return $this->hasOneof(2); + } + + /** + * A 64-bit signed integer. + * + * Generated from protobuf field int64 int_value = 2; + * @param int|string $var + * @return $this + */ + public function setIntValue($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * A Boolean value represented by `true` or `false`. + * + * Generated from protobuf field bool bool_value = 3; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(3); + } + + public function hasBoolValue() + { + return $this->hasOneof(3); + } + + /** + * A Boolean value represented by `true` or `false`. + * + * Generated from protobuf field bool bool_value = 3; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/BatchWriteSpansRequest.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/BatchWriteSpansRequest.php new file mode 100644 index 00000000000..dc1949df134 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/BatchWriteSpansRequest.php @@ -0,0 +1,127 @@ +google.devtools.cloudtrace.v2.BatchWriteSpansRequest + */ +class BatchWriteSpansRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span spans = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $spans; + + /** + * @param string $name Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. Please see + * {@see TraceServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\Trace\V2\Span[] $spans Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * + * @return \Google\Cloud\Trace\V2\BatchWriteSpansRequest + * + * @experimental + */ + public static function build(string $name, array $spans): self + { + return (new self()) + ->setName($name) + ->setSpans($spans); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. + * @type array<\Google\Cloud\Trace\V2\Span>|\Google\Protobuf\Internal\RepeatedField $spans + * Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Tracing::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span spans = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpans() + { + return $this->spans; + } + + /** + * Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span spans = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Trace\V2\Span>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpans($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span::class); + $this->spans = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Module.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Module.php new file mode 100644 index 00000000000..030ebe5ab66 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Module.php @@ -0,0 +1,129 @@ +google.devtools.cloudtrace.v2.Module + */ +class Module extends \Google\Protobuf\Internal\Message +{ + /** + * For example: main binary, kernel modules, and dynamic libraries + * such as libc.so, sharedlib.so (up to 256 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString module = 1; + */ + protected $module = null; + /** + * A unique identifier for the module, usually a hash of its + * contents (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString build_id = 2; + */ + protected $build_id = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Trace\V2\TruncatableString $module + * For example: main binary, kernel modules, and dynamic libraries + * such as libc.so, sharedlib.so (up to 256 bytes). + * @type \Google\Cloud\Trace\V2\TruncatableString $build_id + * A unique identifier for the module, usually a hash of its + * contents (up to 128 bytes). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * For example: main binary, kernel modules, and dynamic libraries + * such as libc.so, sharedlib.so (up to 256 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString module = 1; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getModule() + { + return $this->module; + } + + public function hasModule() + { + return isset($this->module); + } + + public function clearModule() + { + unset($this->module); + } + + /** + * For example: main binary, kernel modules, and dynamic libraries + * such as libc.so, sharedlib.so (up to 256 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString module = 1; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setModule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->module = $var; + + return $this; + } + + /** + * A unique identifier for the module, usually a hash of its + * contents (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString build_id = 2; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getBuildId() + { + return $this->build_id; + } + + public function hasBuildId() + { + return isset($this->build_id); + } + + public function clearBuildId() + { + unset($this->build_id); + } + + /** + * A unique identifier for the module, usually a hash of its + * contents (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString build_id = 2; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setBuildId($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->build_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span.php new file mode 100644 index 00000000000..b329573dbc8 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span.php @@ -0,0 +1,783 @@ +google.devtools.cloudtrace.v2.Span + */ +class Span extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the span in the following format: + * * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. It should + * not be zero. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. It should not + * be zero. + * . + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The `[SPAN_ID]` portion of the span's resource name. + * + * Generated from protobuf field string span_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $span_id = ''; + /** + * The `[SPAN_ID]` of this span's parent span. If this is a root span, + * then this field must be empty. + * + * Generated from protobuf field string parent_span_id = 3; + */ + protected $parent_span_id = ''; + /** + * Required. A description of the span's operation (up to 128 bytes). + * Cloud Trace displays the description in the + * Cloud console. + * For example, the display name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name within an application and at the same call point. + * This makes it easier to correlate spans in different traces. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString display_name = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = null; + /** + * Required. The start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server + * side, this is the time when the server's application handler starts + * running. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $start_time = null; + /** + * Required. The end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server + * side, this is the time when the server application handler stops running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $end_time = null; + /** + * A set of attributes on the span. You can have up to 32 attributes per + * span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 7; + */ + protected $attributes = null; + /** + * Stack trace captured at the start of the span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace stack_trace = 8; + */ + protected $stack_trace = null; + /** + * A set of time events. You can have up to 32 annotations and 128 message + * events per span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvents time_events = 9; + */ + protected $time_events = null; + /** + * Links associated with the span. You can have up to 128 links per Span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Links links = 10; + */ + protected $links = null; + /** + * Optional. The final status for this span. + * + * Generated from protobuf field .google.rpc.Status status = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $status = null; + /** + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * + * Generated from protobuf field .google.protobuf.BoolValue same_process_as_parent_span = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $same_process_as_parent_span = null; + /** + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * + * Generated from protobuf field .google.protobuf.Int32Value child_span_count = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $child_span_count = null; + /** + * Optional. Distinguishes between spans generated in a particular context. + * For example, two spans with the same name may be distinguished using + * `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.SpanKind span_kind = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $span_kind = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the span in the following format: + * * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. It should + * not be zero. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. It should not + * be zero. + * . + * @type string $span_id + * Required. The `[SPAN_ID]` portion of the span's resource name. + * @type string $parent_span_id + * The `[SPAN_ID]` of this span's parent span. If this is a root span, + * then this field must be empty. + * @type \Google\Cloud\Trace\V2\TruncatableString $display_name + * Required. A description of the span's operation (up to 128 bytes). + * Cloud Trace displays the description in the + * Cloud console. + * For example, the display name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name within an application and at the same call point. + * This makes it easier to correlate spans in different traces. + * @type \Google\Protobuf\Timestamp $start_time + * Required. The start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server + * side, this is the time when the server's application handler starts + * running. + * @type \Google\Protobuf\Timestamp $end_time + * Required. The end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server + * side, this is the time when the server application handler stops running. + * @type \Google\Cloud\Trace\V2\Span\Attributes $attributes + * A set of attributes on the span. You can have up to 32 attributes per + * span. + * @type \Google\Cloud\Trace\V2\StackTrace $stack_trace + * Stack trace captured at the start of the span. + * @type \Google\Cloud\Trace\V2\Span\TimeEvents $time_events + * A set of time events. You can have up to 32 annotations and 128 message + * events per span. + * @type \Google\Cloud\Trace\V2\Span\Links $links + * Links associated with the span. You can have up to 128 links per Span. + * @type \Google\Rpc\Status $status + * Optional. The final status for this span. + * @type \Google\Protobuf\BoolValue $same_process_as_parent_span + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * @type \Google\Protobuf\Int32Value $child_span_count + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * @type int $span_kind + * Optional. Distinguishes between spans generated in a particular context. + * For example, two spans with the same name may be distinguished using + * `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the span in the following format: + * * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. It should + * not be zero. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. It should not + * be zero. + * . + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the span in the following format: + * * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. It should + * not be zero. + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. It should not + * be zero. + * . + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The `[SPAN_ID]` portion of the span's resource name. + * + * Generated from protobuf field string span_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSpanId() + { + return $this->span_id; + } + + /** + * Required. The `[SPAN_ID]` portion of the span's resource name. + * + * Generated from protobuf field string span_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSpanId($var) + { + GPBUtil::checkString($var, True); + $this->span_id = $var; + + return $this; + } + + /** + * The `[SPAN_ID]` of this span's parent span. If this is a root span, + * then this field must be empty. + * + * Generated from protobuf field string parent_span_id = 3; + * @return string + */ + public function getParentSpanId() + { + return $this->parent_span_id; + } + + /** + * The `[SPAN_ID]` of this span's parent span. If this is a root span, + * then this field must be empty. + * + * Generated from protobuf field string parent_span_id = 3; + * @param string $var + * @return $this + */ + public function setParentSpanId($var) + { + GPBUtil::checkString($var, True); + $this->parent_span_id = $var; + + return $this; + } + + /** + * Required. A description of the span's operation (up to 128 bytes). + * Cloud Trace displays the description in the + * Cloud console. + * For example, the display name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name within an application and at the same call point. + * This makes it easier to correlate spans in different traces. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString display_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getDisplayName() + { + return $this->display_name; + } + + public function hasDisplayName() + { + return isset($this->display_name); + } + + public function clearDisplayName() + { + unset($this->display_name); + } + + /** + * Required. A description of the span's operation (up to 128 bytes). + * Cloud Trace displays the description in the + * Cloud console. + * For example, the display name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name within an application and at the same call point. + * This makes it easier to correlate spans in different traces. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString display_name = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->display_name = $var; + + return $this; + } + + /** + * Required. The start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server + * side, this is the time when the server's application handler starts + * running. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Required. The start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server + * side, this is the time when the server's application handler starts + * running. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Required. The end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server + * side, this is the time when the server application handler stops running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Required. The end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server + * side, this is the time when the server application handler stops running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * A set of attributes on the span. You can have up to 32 attributes per + * span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 7; + * @return \Google\Cloud\Trace\V2\Span\Attributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * A set of attributes on the span. You can have up to 32 attributes per + * span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 7; + * @param \Google\Cloud\Trace\V2\Span\Attributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\Attributes::class); + $this->attributes = $var; + + return $this; + } + + /** + * Stack trace captured at the start of the span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace stack_trace = 8; + * @return \Google\Cloud\Trace\V2\StackTrace|null + */ + public function getStackTrace() + { + return $this->stack_trace; + } + + public function hasStackTrace() + { + return isset($this->stack_trace); + } + + public function clearStackTrace() + { + unset($this->stack_trace); + } + + /** + * Stack trace captured at the start of the span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace stack_trace = 8; + * @param \Google\Cloud\Trace\V2\StackTrace $var + * @return $this + */ + public function setStackTrace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace::class); + $this->stack_trace = $var; + + return $this; + } + + /** + * A set of time events. You can have up to 32 annotations and 128 message + * events per span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvents time_events = 9; + * @return \Google\Cloud\Trace\V2\Span\TimeEvents|null + */ + public function getTimeEvents() + { + return $this->time_events; + } + + public function hasTimeEvents() + { + return isset($this->time_events); + } + + public function clearTimeEvents() + { + unset($this->time_events); + } + + /** + * A set of time events. You can have up to 32 annotations and 128 message + * events per span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvents time_events = 9; + * @param \Google\Cloud\Trace\V2\Span\TimeEvents $var + * @return $this + */ + public function setTimeEvents($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\TimeEvents::class); + $this->time_events = $var; + + return $this; + } + + /** + * Links associated with the span. You can have up to 128 links per Span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Links links = 10; + * @return \Google\Cloud\Trace\V2\Span\Links|null + */ + public function getLinks() + { + return $this->links; + } + + public function hasLinks() + { + return isset($this->links); + } + + public function clearLinks() + { + unset($this->links); + } + + /** + * Links associated with the span. You can have up to 128 links per Span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Links links = 10; + * @param \Google\Cloud\Trace\V2\Span\Links $var + * @return $this + */ + public function setLinks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\Links::class); + $this->links = $var; + + return $this; + } + + /** + * Optional. The final status for this span. + * + * Generated from protobuf field .google.rpc.Status status = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * Optional. The final status for this span. + * + * Generated from protobuf field .google.rpc.Status status = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + + /** + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * + * Generated from protobuf field .google.protobuf.BoolValue same_process_as_parent_span = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\BoolValue|null + */ + public function getSameProcessAsParentSpan() + { + return $this->same_process_as_parent_span; + } + + public function hasSameProcessAsParentSpan() + { + return isset($this->same_process_as_parent_span); + } + + public function clearSameProcessAsParentSpan() + { + unset($this->same_process_as_parent_span); + } + + /** + * Returns the unboxed value from getSameProcessAsParentSpan() + + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * + * Generated from protobuf field .google.protobuf.BoolValue same_process_as_parent_span = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool|null + */ + public function getSameProcessAsParentSpanUnwrapped() + { + return $this->readWrapperValue("same_process_as_parent_span"); + } + + /** + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * + * Generated from protobuf field .google.protobuf.BoolValue same_process_as_parent_span = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setSameProcessAsParentSpan($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->same_process_as_parent_span = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object. + + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * + * Generated from protobuf field .google.protobuf.BoolValue same_process_as_parent_span = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool|null $var + * @return $this + */ + public function setSameProcessAsParentSpanUnwrapped($var) + { + $this->writeWrapperValue("same_process_as_parent_span", $var); + return $this;} + + /** + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * + * Generated from protobuf field .google.protobuf.Int32Value child_span_count = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Int32Value|null + */ + public function getChildSpanCount() + { + return $this->child_span_count; + } + + public function hasChildSpanCount() + { + return isset($this->child_span_count); + } + + public function clearChildSpanCount() + { + unset($this->child_span_count); + } + + /** + * Returns the unboxed value from getChildSpanCount() + + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * + * Generated from protobuf field .google.protobuf.Int32Value child_span_count = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|null + */ + public function getChildSpanCountUnwrapped() + { + return $this->readWrapperValue("child_span_count"); + } + + /** + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * + * Generated from protobuf field .google.protobuf.Int32Value child_span_count = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Int32Value $var + * @return $this + */ + public function setChildSpanCount($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int32Value::class); + $this->child_span_count = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int32Value object. + + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * + * Generated from protobuf field .google.protobuf.Int32Value child_span_count = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|null $var + * @return $this + */ + public function setChildSpanCountUnwrapped($var) + { + $this->writeWrapperValue("child_span_count", $var); + return $this;} + + /** + * Optional. Distinguishes between spans generated in a particular context. + * For example, two spans with the same name may be distinguished using + * `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.SpanKind span_kind = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSpanKind() + { + return $this->span_kind; + } + + /** + * Optional. Distinguishes between spans generated in a particular context. + * For example, two spans with the same name may be distinguished using + * `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.SpanKind span_kind = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSpanKind($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Trace\V2\Span\SpanKind::class); + $this->span_kind = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Attributes.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Attributes.php new file mode 100644 index 00000000000..35cf07c116e --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Attributes.php @@ -0,0 +1,132 @@ +google.devtools.cloudtrace.v2.Span.Attributes + */ +class Attributes extends \Google\Protobuf\Internal\Message +{ + /** + * A set of attributes. Each attribute's key can be up to 128 bytes + * long. The value can be a string up to 256 bytes, a signed 64-bit integer, + * or the boolean values `true` or `false`. For example: + * "/instance_id": { "string_value": { "value": "my-instance" } } + * "/http/request_bytes": { "int_value": 300 } + * "abc.com/myattribute": { "bool_value": false } + * + * Generated from protobuf field map attribute_map = 1; + */ + private $attribute_map; + /** + * The number of attributes that were discarded. Attributes can be discarded + * because their keys are too long or because there are too many attributes. + * If this value is 0 then all attributes are valid. + * + * Generated from protobuf field int32 dropped_attributes_count = 2; + */ + protected $dropped_attributes_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $attribute_map + * A set of attributes. Each attribute's key can be up to 128 bytes + * long. The value can be a string up to 256 bytes, a signed 64-bit integer, + * or the boolean values `true` or `false`. For example: + * "/instance_id": { "string_value": { "value": "my-instance" } } + * "/http/request_bytes": { "int_value": 300 } + * "abc.com/myattribute": { "bool_value": false } + * @type int $dropped_attributes_count + * The number of attributes that were discarded. Attributes can be discarded + * because their keys are too long or because there are too many attributes. + * If this value is 0 then all attributes are valid. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * A set of attributes. Each attribute's key can be up to 128 bytes + * long. The value can be a string up to 256 bytes, a signed 64-bit integer, + * or the boolean values `true` or `false`. For example: + * "/instance_id": { "string_value": { "value": "my-instance" } } + * "/http/request_bytes": { "int_value": 300 } + * "abc.com/myattribute": { "bool_value": false } + * + * Generated from protobuf field map attribute_map = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAttributeMap() + { + return $this->attribute_map; + } + + /** + * A set of attributes. Each attribute's key can be up to 128 bytes + * long. The value can be a string up to 256 bytes, a signed 64-bit integer, + * or the boolean values `true` or `false`. For example: + * "/instance_id": { "string_value": { "value": "my-instance" } } + * "/http/request_bytes": { "int_value": 300 } + * "abc.com/myattribute": { "bool_value": false } + * + * Generated from protobuf field map attribute_map = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAttributeMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\AttributeValue::class); + $this->attribute_map = $arr; + + return $this; + } + + /** + * The number of attributes that were discarded. Attributes can be discarded + * because their keys are too long or because there are too many attributes. + * If this value is 0 then all attributes are valid. + * + * Generated from protobuf field int32 dropped_attributes_count = 2; + * @return int + */ + public function getDroppedAttributesCount() + { + return $this->dropped_attributes_count; + } + + /** + * The number of attributes that were discarded. Attributes can be discarded + * because their keys are too long or because there are too many attributes. + * If this value is 0 then all attributes are valid. + * + * Generated from protobuf field int32 dropped_attributes_count = 2; + * @param int $var + * @return $this + */ + public function setDroppedAttributesCount($var) + { + GPBUtil::checkInt32($var); + $this->dropped_attributes_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Attributes::class, \Google\Cloud\Trace\V2\Span_Attributes::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link.php new file mode 100644 index 00000000000..240cefeafd9 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link.php @@ -0,0 +1,189 @@ +google.devtools.cloudtrace.v2.Span.Link + */ +class Link extends \Google\Protobuf\Internal\Message +{ + /** + * The `[TRACE_ID]` for a trace within a project. + * + * Generated from protobuf field string trace_id = 1; + */ + protected $trace_id = ''; + /** + * The `[SPAN_ID]` for a span within a trace. + * + * Generated from protobuf field string span_id = 2; + */ + protected $span_id = ''; + /** + * The relationship of the current span relative to the linked span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Link.Type type = 3; + */ + protected $type = 0; + /** + * A set of attributes on the link. Up to 32 attributes can be + * specified per link. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 4; + */ + protected $attributes = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $trace_id + * The `[TRACE_ID]` for a trace within a project. + * @type string $span_id + * The `[SPAN_ID]` for a span within a trace. + * @type int $type + * The relationship of the current span relative to the linked span. + * @type \Google\Cloud\Trace\V2\Span\Attributes $attributes + * A set of attributes on the link. Up to 32 attributes can be + * specified per link. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * The `[TRACE_ID]` for a trace within a project. + * + * Generated from protobuf field string trace_id = 1; + * @return string + */ + public function getTraceId() + { + return $this->trace_id; + } + + /** + * The `[TRACE_ID]` for a trace within a project. + * + * Generated from protobuf field string trace_id = 1; + * @param string $var + * @return $this + */ + public function setTraceId($var) + { + GPBUtil::checkString($var, True); + $this->trace_id = $var; + + return $this; + } + + /** + * The `[SPAN_ID]` for a span within a trace. + * + * Generated from protobuf field string span_id = 2; + * @return string + */ + public function getSpanId() + { + return $this->span_id; + } + + /** + * The `[SPAN_ID]` for a span within a trace. + * + * Generated from protobuf field string span_id = 2; + * @param string $var + * @return $this + */ + public function setSpanId($var) + { + GPBUtil::checkString($var, True); + $this->span_id = $var; + + return $this; + } + + /** + * The relationship of the current span relative to the linked span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Link.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The relationship of the current span relative to the linked span. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Link.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Trace\V2\Span\Link\Type::class); + $this->type = $var; + + return $this; + } + + /** + * A set of attributes on the link. Up to 32 attributes can be + * specified per link. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 4; + * @return \Google\Cloud\Trace\V2\Span\Attributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * A set of attributes on the link. Up to 32 attributes can be + * specified per link. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 4; + * @param \Google\Cloud\Trace\V2\Span\Attributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\Attributes::class); + $this->attributes = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Link::class, \Google\Cloud\Trace\V2\Span_Link::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link/Type.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link/Type.php new file mode 100644 index 00000000000..ef405db278e --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Link/Type.php @@ -0,0 +1,65 @@ +google.devtools.cloudtrace.v2.Span.Link.Type + */ +class Type +{ + /** + * The relationship of the two spans is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * The linked span is a child of the current span. + * + * Generated from protobuf enum CHILD_LINKED_SPAN = 1; + */ + const CHILD_LINKED_SPAN = 1; + /** + * The linked span is a parent of the current span. + * + * Generated from protobuf enum PARENT_LINKED_SPAN = 2; + */ + const PARENT_LINKED_SPAN = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::CHILD_LINKED_SPAN => 'CHILD_LINKED_SPAN', + self::PARENT_LINKED_SPAN => 'PARENT_LINKED_SPAN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Trace\V2\Span_Link_Type::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Links.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Links.php new file mode 100644 index 00000000000..4a02c6c1783 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/Links.php @@ -0,0 +1,109 @@ +google.devtools.cloudtrace.v2.Span.Links + */ +class Links extends \Google\Protobuf\Internal\Message +{ + /** + * A collection of links. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.Link link = 1; + */ + private $link; + /** + * The number of dropped links after the maximum size was enforced. If + * this value is 0, then no links were dropped. + * + * Generated from protobuf field int32 dropped_links_count = 2; + */ + protected $dropped_links_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Trace\V2\Span\Link>|\Google\Protobuf\Internal\RepeatedField $link + * A collection of links. + * @type int $dropped_links_count + * The number of dropped links after the maximum size was enforced. If + * this value is 0, then no links were dropped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * A collection of links. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.Link link = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLink() + { + return $this->link; + } + + /** + * A collection of links. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.Link link = 1; + * @param array<\Google\Cloud\Trace\V2\Span\Link>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLink($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span\Link::class); + $this->link = $arr; + + return $this; + } + + /** + * The number of dropped links after the maximum size was enforced. If + * this value is 0, then no links were dropped. + * + * Generated from protobuf field int32 dropped_links_count = 2; + * @return int + */ + public function getDroppedLinksCount() + { + return $this->dropped_links_count; + } + + /** + * The number of dropped links after the maximum size was enforced. If + * this value is 0, then no links were dropped. + * + * Generated from protobuf field int32 dropped_links_count = 2; + * @param int $var + * @return $this + */ + public function setDroppedLinksCount($var) + { + GPBUtil::checkInt32($var); + $this->dropped_links_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Links::class, \Google\Cloud\Trace\V2\Span_Links::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/SpanKind.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/SpanKind.php new file mode 100644 index 00000000000..48d69c458c9 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/SpanKind.php @@ -0,0 +1,95 @@ +google.devtools.cloudtrace.v2.Span.SpanKind + */ +class SpanKind +{ + /** + * Unspecified. Do NOT use as default. + * Implementations MAY assume SpanKind.INTERNAL to be default. + * + * Generated from protobuf enum SPAN_KIND_UNSPECIFIED = 0; + */ + const SPAN_KIND_UNSPECIFIED = 0; + /** + * Indicates that the span is used internally. Default value. + * + * Generated from protobuf enum INTERNAL = 1; + */ + const INTERNAL = 1; + /** + * Indicates that the span covers server-side handling of an RPC or other + * remote network request. + * + * Generated from protobuf enum SERVER = 2; + */ + const SERVER = 2; + /** + * Indicates that the span covers the client-side wrapper around an RPC or + * other remote request. + * + * Generated from protobuf enum CLIENT = 3; + */ + const CLIENT = 3; + /** + * Indicates that the span describes producer sending a message to a broker. + * Unlike client and server, there is no direct critical path latency + * relationship between producer and consumer spans (e.g. publishing a + * message to a pubsub service). + * + * Generated from protobuf enum PRODUCER = 4; + */ + const PRODUCER = 4; + /** + * Indicates that the span describes consumer receiving a message from a + * broker. Unlike client and server, there is no direct critical path + * latency relationship between producer and consumer spans (e.g. receiving + * a message from a pubsub service subscription). + * + * Generated from protobuf enum CONSUMER = 5; + */ + const CONSUMER = 5; + + private static $valueToName = [ + self::SPAN_KIND_UNSPECIFIED => 'SPAN_KIND_UNSPECIFIED', + self::INTERNAL => 'INTERNAL', + self::SERVER => 'SERVER', + self::CLIENT => 'CLIENT', + self::PRODUCER => 'PRODUCER', + self::CONSUMER => 'CONSUMER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SpanKind::class, \Google\Cloud\Trace\V2\Span_SpanKind::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent.php new file mode 100644 index 00000000000..56f7b30850f --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent.php @@ -0,0 +1,155 @@ +google.devtools.cloudtrace.v2.Span.TimeEvent + */ +class TimeEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The timestamp indicating the time the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp time = 1; + */ + protected $time = null; + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $time + * The timestamp indicating the time the event occurred. + * @type \Google\Cloud\Trace\V2\Span\TimeEvent\Annotation $annotation + * Text annotation with a set of attributes. + * @type \Google\Cloud\Trace\V2\Span\TimeEvent\MessageEvent $message_event + * An event describing a message sent/received between Spans. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * The timestamp indicating the time the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTime() + { + return $this->time; + } + + public function hasTime() + { + return isset($this->time); + } + + public function clearTime() + { + unset($this->time); + } + + /** + * The timestamp indicating the time the event occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->time = $var; + + return $this; + } + + /** + * Text annotation with a set of attributes. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation annotation = 2; + * @return \Google\Cloud\Trace\V2\Span\TimeEvent\Annotation|null + */ + public function getAnnotation() + { + return $this->readOneof(2); + } + + public function hasAnnotation() + { + return $this->hasOneof(2); + } + + /** + * Text annotation with a set of attributes. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation annotation = 2; + * @param \Google\Cloud\Trace\V2\Span\TimeEvent\Annotation $var + * @return $this + */ + public function setAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\TimeEvent\Annotation::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * An event describing a message sent/received between Spans. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent message_event = 3; + * @return \Google\Cloud\Trace\V2\Span\TimeEvent\MessageEvent|null + */ + public function getMessageEvent() + { + return $this->readOneof(3); + } + + public function hasMessageEvent() + { + return $this->hasOneof(3); + } + + /** + * An event describing a message sent/received between Spans. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent message_event = 3; + * @param \Google\Cloud\Trace\V2\Span\TimeEvent\MessageEvent $var + * @return $this + */ + public function setMessageEvent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\TimeEvent\MessageEvent::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TimeEvent::class, \Google\Cloud\Trace\V2\Span_TimeEvent::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/Annotation.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/Annotation.php new file mode 100644 index 00000000000..20002e12795 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/Annotation.php @@ -0,0 +1,132 @@ +google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation + */ +class Annotation extends \Google\Protobuf\Internal\Message +{ + /** + * A user-supplied message describing the event. The maximum length for + * the description is 256 bytes. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString description = 1; + */ + protected $description = null; + /** + * A set of attributes on the annotation. You can have up to 4 attributes + * per Annotation. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 2; + */ + protected $attributes = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Trace\V2\TruncatableString $description + * A user-supplied message describing the event. The maximum length for + * the description is 256 bytes. + * @type \Google\Cloud\Trace\V2\Span\Attributes $attributes + * A set of attributes on the annotation. You can have up to 4 attributes + * per Annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * A user-supplied message describing the event. The maximum length for + * the description is 256 bytes. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString description = 1; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getDescription() + { + return $this->description; + } + + public function hasDescription() + { + return isset($this->description); + } + + public function clearDescription() + { + unset($this->description); + } + + /** + * A user-supplied message describing the event. The maximum length for + * the description is 256 bytes. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString description = 1; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->description = $var; + + return $this; + } + + /** + * A set of attributes on the annotation. You can have up to 4 attributes + * per Annotation. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 2; + * @return \Google\Cloud\Trace\V2\Span\Attributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * A set of attributes on the annotation. You can have up to 4 attributes + * per Annotation. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.Attributes attributes = 2; + * @param \Google\Cloud\Trace\V2\Span\Attributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span\Attributes::class); + $this->attributes = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Annotation::class, \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent.php new file mode 100644 index 00000000000..598e46a3e82 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent.php @@ -0,0 +1,188 @@ +google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent + */ +class MessageEvent extends \Google\Protobuf\Internal\Message +{ + /** + * Type of MessageEvent. Indicates whether the message was sent or + * received. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type type = 1; + */ + protected $type = 0; + /** + * An identifier for the MessageEvent's message that can be used to match + * `SENT` and `RECEIVED` MessageEvents. + * + * Generated from protobuf field int64 id = 2; + */ + protected $id = 0; + /** + * The number of uncompressed bytes sent or received. + * + * Generated from protobuf field int64 uncompressed_size_bytes = 3; + */ + protected $uncompressed_size_bytes = 0; + /** + * The number of compressed bytes sent or received. If missing, the + * compressed size is assumed to be the same size as the uncompressed + * size. + * + * Generated from protobuf field int64 compressed_size_bytes = 4; + */ + protected $compressed_size_bytes = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Type of MessageEvent. Indicates whether the message was sent or + * received. + * @type int|string $id + * An identifier for the MessageEvent's message that can be used to match + * `SENT` and `RECEIVED` MessageEvents. + * @type int|string $uncompressed_size_bytes + * The number of uncompressed bytes sent or received. + * @type int|string $compressed_size_bytes + * The number of compressed bytes sent or received. If missing, the + * compressed size is assumed to be the same size as the uncompressed + * size. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Type of MessageEvent. Indicates whether the message was sent or + * received. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Type of MessageEvent. Indicates whether the message was sent or + * received. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Trace\V2\Span\TimeEvent\MessageEvent\Type::class); + $this->type = $var; + + return $this; + } + + /** + * An identifier for the MessageEvent's message that can be used to match + * `SENT` and `RECEIVED` MessageEvents. + * + * Generated from protobuf field int64 id = 2; + * @return int|string + */ + public function getId() + { + return $this->id; + } + + /** + * An identifier for the MessageEvent's message that can be used to match + * `SENT` and `RECEIVED` MessageEvents. + * + * Generated from protobuf field int64 id = 2; + * @param int|string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkInt64($var); + $this->id = $var; + + return $this; + } + + /** + * The number of uncompressed bytes sent or received. + * + * Generated from protobuf field int64 uncompressed_size_bytes = 3; + * @return int|string + */ + public function getUncompressedSizeBytes() + { + return $this->uncompressed_size_bytes; + } + + /** + * The number of uncompressed bytes sent or received. + * + * Generated from protobuf field int64 uncompressed_size_bytes = 3; + * @param int|string $var + * @return $this + */ + public function setUncompressedSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->uncompressed_size_bytes = $var; + + return $this; + } + + /** + * The number of compressed bytes sent or received. If missing, the + * compressed size is assumed to be the same size as the uncompressed + * size. + * + * Generated from protobuf field int64 compressed_size_bytes = 4; + * @return int|string + */ + public function getCompressedSizeBytes() + { + return $this->compressed_size_bytes; + } + + /** + * The number of compressed bytes sent or received. If missing, the + * compressed size is assumed to be the same size as the uncompressed + * size. + * + * Generated from protobuf field int64 compressed_size_bytes = 4; + * @param int|string $var + * @return $this + */ + public function setCompressedSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->compressed_size_bytes = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MessageEvent::class, \Google\Cloud\Trace\V2\Span_TimeEvent_MessageEvent::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent/Type.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent/Type.php new file mode 100644 index 00000000000..0bac6fac860 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvent/MessageEvent/Type.php @@ -0,0 +1,64 @@ +google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent.Type + */ +class Type +{ + /** + * Unknown event type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Indicates a sent message. + * + * Generated from protobuf enum SENT = 1; + */ + const SENT = 1; + /** + * Indicates a received message. + * + * Generated from protobuf enum RECEIVED = 2; + */ + const RECEIVED = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::SENT => 'SENT', + self::RECEIVED => 'RECEIVED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Trace\V2\Span_TimeEvent_MessageEvent_Type::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvents.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvents.php new file mode 100644 index 00000000000..d51a25429d7 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/Span/TimeEvents.php @@ -0,0 +1,148 @@ +google.devtools.cloudtrace.v2.Span.TimeEvents + */ +class TimeEvents extends \Google\Protobuf\Internal\Message +{ + /** + * A collection of `TimeEvent`s. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.TimeEvent time_event = 1; + */ + private $time_event; + /** + * The number of dropped annotations in all the included time events. + * If the value is 0, then no annotations were dropped. + * + * Generated from protobuf field int32 dropped_annotations_count = 2; + */ + protected $dropped_annotations_count = 0; + /** + * The number of dropped message events in all the included time events. + * If the value is 0, then no message events were dropped. + * + * Generated from protobuf field int32 dropped_message_events_count = 3; + */ + protected $dropped_message_events_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Trace\V2\Span\TimeEvent>|\Google\Protobuf\Internal\RepeatedField $time_event + * A collection of `TimeEvent`s. + * @type int $dropped_annotations_count + * The number of dropped annotations in all the included time events. + * If the value is 0, then no annotations were dropped. + * @type int $dropped_message_events_count + * The number of dropped message events in all the included time events. + * If the value is 0, then no message events were dropped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * A collection of `TimeEvent`s. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.TimeEvent time_event = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimeEvent() + { + return $this->time_event; + } + + /** + * A collection of `TimeEvent`s. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.Span.TimeEvent time_event = 1; + * @param array<\Google\Cloud\Trace\V2\Span\TimeEvent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimeEvent($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\Span\TimeEvent::class); + $this->time_event = $arr; + + return $this; + } + + /** + * The number of dropped annotations in all the included time events. + * If the value is 0, then no annotations were dropped. + * + * Generated from protobuf field int32 dropped_annotations_count = 2; + * @return int + */ + public function getDroppedAnnotationsCount() + { + return $this->dropped_annotations_count; + } + + /** + * The number of dropped annotations in all the included time events. + * If the value is 0, then no annotations were dropped. + * + * Generated from protobuf field int32 dropped_annotations_count = 2; + * @param int $var + * @return $this + */ + public function setDroppedAnnotationsCount($var) + { + GPBUtil::checkInt32($var); + $this->dropped_annotations_count = $var; + + return $this; + } + + /** + * The number of dropped message events in all the included time events. + * If the value is 0, then no message events were dropped. + * + * Generated from protobuf field int32 dropped_message_events_count = 3; + * @return int + */ + public function getDroppedMessageEventsCount() + { + return $this->dropped_message_events_count; + } + + /** + * The number of dropped message events in all the included time events. + * If the value is 0, then no message events were dropped. + * + * Generated from protobuf field int32 dropped_message_events_count = 3; + * @param int $var + * @return $this + */ + public function setDroppedMessageEventsCount($var) + { + GPBUtil::checkInt32($var); + $this->dropped_message_events_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TimeEvents::class, \Google\Cloud\Trace\V2\Span_TimeEvents::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace.php new file mode 100644 index 00000000000..63ee036a72e --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace.php @@ -0,0 +1,135 @@ +google.devtools.cloudtrace.v2.StackTrace + */ +class StackTrace extends \Google\Protobuf\Internal\Message +{ + /** + * Stack frames in this stack trace. A maximum of 128 frames are allowed. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1; + */ + protected $stack_frames = null; + /** + * The hash ID is used to conserve network bandwidth for duplicate + * stack traces within a single trace. + * Often multiple spans will have identical stack traces. + * The first occurrence of a stack trace should contain both the + * `stackFrame` content and a value in `stackTraceHashId`. + * Subsequent spans within the same request can refer + * to that stack trace by only setting `stackTraceHashId`. + * + * Generated from protobuf field int64 stack_trace_hash_id = 2; + */ + protected $stack_trace_hash_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Trace\V2\StackTrace\StackFrames $stack_frames + * Stack frames in this stack trace. A maximum of 128 frames are allowed. + * @type int|string $stack_trace_hash_id + * The hash ID is used to conserve network bandwidth for duplicate + * stack traces within a single trace. + * Often multiple spans will have identical stack traces. + * The first occurrence of a stack trace should contain both the + * `stackFrame` content and a value in `stackTraceHashId`. + * Subsequent spans within the same request can refer + * to that stack trace by only setting `stackTraceHashId`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Stack frames in this stack trace. A maximum of 128 frames are allowed. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1; + * @return \Google\Cloud\Trace\V2\StackTrace\StackFrames|null + */ + public function getStackFrames() + { + return $this->stack_frames; + } + + public function hasStackFrames() + { + return isset($this->stack_frames); + } + + public function clearStackFrames() + { + unset($this->stack_frames); + } + + /** + * Stack frames in this stack trace. A maximum of 128 frames are allowed. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.StackTrace.StackFrames stack_frames = 1; + * @param \Google\Cloud\Trace\V2\StackTrace\StackFrames $var + * @return $this + */ + public function setStackFrames($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\StackTrace\StackFrames::class); + $this->stack_frames = $var; + + return $this; + } + + /** + * The hash ID is used to conserve network bandwidth for duplicate + * stack traces within a single trace. + * Often multiple spans will have identical stack traces. + * The first occurrence of a stack trace should contain both the + * `stackFrame` content and a value in `stackTraceHashId`. + * Subsequent spans within the same request can refer + * to that stack trace by only setting `stackTraceHashId`. + * + * Generated from protobuf field int64 stack_trace_hash_id = 2; + * @return int|string + */ + public function getStackTraceHashId() + { + return $this->stack_trace_hash_id; + } + + /** + * The hash ID is used to conserve network bandwidth for duplicate + * stack traces within a single trace. + * Often multiple spans will have identical stack traces. + * The first occurrence of a stack trace should contain both the + * `stackFrame` content and a value in `stackTraceHashId`. + * Subsequent spans within the same request can refer + * to that stack trace by only setting `stackTraceHashId`. + * + * Generated from protobuf field int64 stack_trace_hash_id = 2; + * @param int|string $var + * @return $this + */ + public function setStackTraceHashId($var) + { + GPBUtil::checkInt64($var); + $this->stack_trace_hash_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrame.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrame.php new file mode 100644 index 00000000000..38450d2d46d --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrame.php @@ -0,0 +1,348 @@ +google.devtools.cloudtrace.v2.StackTrace.StackFrame + */ +class StackFrame extends \Google\Protobuf\Internal\Message +{ + /** + * The fully-qualified name that uniquely identifies the function or + * method that is active in this frame (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString function_name = 1; + */ + protected $function_name = null; + /** + * An un-mangled function name, if `function_name` is mangled. + * To get information about name mangling, run + * [this search](https://www.google.com/search?q=cxx+name+mangling). + * The name can be fully-qualified (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString original_function_name = 2; + */ + protected $original_function_name = null; + /** + * The name of the source file where the function call appears (up to 256 + * bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString file_name = 3; + */ + protected $file_name = null; + /** + * The line number in `file_name` where the function call appears. + * + * Generated from protobuf field int64 line_number = 4; + */ + protected $line_number = 0; + /** + * The column number where the function call appears, if available. + * This is important in JavaScript because of its anonymous functions. + * + * Generated from protobuf field int64 column_number = 5; + */ + protected $column_number = 0; + /** + * The binary module from where the code was loaded. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Module load_module = 6; + */ + protected $load_module = null; + /** + * The version of the deployed source code (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString source_version = 7; + */ + protected $source_version = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Trace\V2\TruncatableString $function_name + * The fully-qualified name that uniquely identifies the function or + * method that is active in this frame (up to 1024 bytes). + * @type \Google\Cloud\Trace\V2\TruncatableString $original_function_name + * An un-mangled function name, if `function_name` is mangled. + * To get information about name mangling, run + * [this search](https://www.google.com/search?q=cxx+name+mangling). + * The name can be fully-qualified (up to 1024 bytes). + * @type \Google\Cloud\Trace\V2\TruncatableString $file_name + * The name of the source file where the function call appears (up to 256 + * bytes). + * @type int|string $line_number + * The line number in `file_name` where the function call appears. + * @type int|string $column_number + * The column number where the function call appears, if available. + * This is important in JavaScript because of its anonymous functions. + * @type \Google\Cloud\Trace\V2\Module $load_module + * The binary module from where the code was loaded. + * @type \Google\Cloud\Trace\V2\TruncatableString $source_version + * The version of the deployed source code (up to 128 bytes). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * The fully-qualified name that uniquely identifies the function or + * method that is active in this frame (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString function_name = 1; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getFunctionName() + { + return $this->function_name; + } + + public function hasFunctionName() + { + return isset($this->function_name); + } + + public function clearFunctionName() + { + unset($this->function_name); + } + + /** + * The fully-qualified name that uniquely identifies the function or + * method that is active in this frame (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString function_name = 1; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setFunctionName($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->function_name = $var; + + return $this; + } + + /** + * An un-mangled function name, if `function_name` is mangled. + * To get information about name mangling, run + * [this search](https://www.google.com/search?q=cxx+name+mangling). + * The name can be fully-qualified (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString original_function_name = 2; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getOriginalFunctionName() + { + return $this->original_function_name; + } + + public function hasOriginalFunctionName() + { + return isset($this->original_function_name); + } + + public function clearOriginalFunctionName() + { + unset($this->original_function_name); + } + + /** + * An un-mangled function name, if `function_name` is mangled. + * To get information about name mangling, run + * [this search](https://www.google.com/search?q=cxx+name+mangling). + * The name can be fully-qualified (up to 1024 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString original_function_name = 2; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setOriginalFunctionName($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->original_function_name = $var; + + return $this; + } + + /** + * The name of the source file where the function call appears (up to 256 + * bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString file_name = 3; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getFileName() + { + return $this->file_name; + } + + public function hasFileName() + { + return isset($this->file_name); + } + + public function clearFileName() + { + unset($this->file_name); + } + + /** + * The name of the source file where the function call appears (up to 256 + * bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString file_name = 3; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setFileName($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->file_name = $var; + + return $this; + } + + /** + * The line number in `file_name` where the function call appears. + * + * Generated from protobuf field int64 line_number = 4; + * @return int|string + */ + public function getLineNumber() + { + return $this->line_number; + } + + /** + * The line number in `file_name` where the function call appears. + * + * Generated from protobuf field int64 line_number = 4; + * @param int|string $var + * @return $this + */ + public function setLineNumber($var) + { + GPBUtil::checkInt64($var); + $this->line_number = $var; + + return $this; + } + + /** + * The column number where the function call appears, if available. + * This is important in JavaScript because of its anonymous functions. + * + * Generated from protobuf field int64 column_number = 5; + * @return int|string + */ + public function getColumnNumber() + { + return $this->column_number; + } + + /** + * The column number where the function call appears, if available. + * This is important in JavaScript because of its anonymous functions. + * + * Generated from protobuf field int64 column_number = 5; + * @param int|string $var + * @return $this + */ + public function setColumnNumber($var) + { + GPBUtil::checkInt64($var); + $this->column_number = $var; + + return $this; + } + + /** + * The binary module from where the code was loaded. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Module load_module = 6; + * @return \Google\Cloud\Trace\V2\Module|null + */ + public function getLoadModule() + { + return $this->load_module; + } + + public function hasLoadModule() + { + return isset($this->load_module); + } + + public function clearLoadModule() + { + unset($this->load_module); + } + + /** + * The binary module from where the code was loaded. + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.Module load_module = 6; + * @param \Google\Cloud\Trace\V2\Module $var + * @return $this + */ + public function setLoadModule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Module::class); + $this->load_module = $var; + + return $this; + } + + /** + * The version of the deployed source code (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString source_version = 7; + * @return \Google\Cloud\Trace\V2\TruncatableString|null + */ + public function getSourceVersion() + { + return $this->source_version; + } + + public function hasSourceVersion() + { + return isset($this->source_version); + } + + public function clearSourceVersion() + { + unset($this->source_version); + } + + /** + * The version of the deployed source code (up to 128 bytes). + * + * Generated from protobuf field .google.devtools.cloudtrace.v2.TruncatableString source_version = 7; + * @param \Google\Cloud\Trace\V2\TruncatableString $var + * @return $this + */ + public function setSourceVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\TruncatableString::class); + $this->source_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StackFrame::class, \Google\Cloud\Trace\V2\StackTrace_StackFrame::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrames.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrames.php new file mode 100644 index 00000000000..41cff97de5f --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/StackTrace/StackFrames.php @@ -0,0 +1,112 @@ +google.devtools.cloudtrace.v2.StackTrace.StackFrames + */ +class StackFrames extends \Google\Protobuf\Internal\Message +{ + /** + * Stack frames in this call stack. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.StackTrace.StackFrame frame = 1; + */ + private $frame; + /** + * The number of stack frames that were dropped because there + * were too many stack frames. + * If this value is 0, then no stack frames were dropped. + * + * Generated from protobuf field int32 dropped_frames_count = 2; + */ + protected $dropped_frames_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Trace\V2\StackTrace\StackFrame>|\Google\Protobuf\Internal\RepeatedField $frame + * Stack frames in this call stack. + * @type int $dropped_frames_count + * The number of stack frames that were dropped because there + * were too many stack frames. + * If this value is 0, then no stack frames were dropped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Stack frames in this call stack. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.StackTrace.StackFrame frame = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrame() + { + return $this->frame; + } + + /** + * Stack frames in this call stack. + * + * Generated from protobuf field repeated .google.devtools.cloudtrace.v2.StackTrace.StackFrame frame = 1; + * @param array<\Google\Cloud\Trace\V2\StackTrace\StackFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrame($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Trace\V2\StackTrace\StackFrame::class); + $this->frame = $arr; + + return $this; + } + + /** + * The number of stack frames that were dropped because there + * were too many stack frames. + * If this value is 0, then no stack frames were dropped. + * + * Generated from protobuf field int32 dropped_frames_count = 2; + * @return int + */ + public function getDroppedFramesCount() + { + return $this->dropped_frames_count; + } + + /** + * The number of stack frames that were dropped because there + * were too many stack frames. + * If this value is 0, then no stack frames were dropped. + * + * Generated from protobuf field int32 dropped_frames_count = 2; + * @param int $var + * @return $this + */ + public function setDroppedFramesCount($var) + { + GPBUtil::checkInt32($var); + $this->dropped_frames_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StackFrames::class, \Google\Cloud\Trace\V2\StackTrace_StackFrames::class); + diff --git a/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/TruncatableString.php b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/TruncatableString.php new file mode 100644 index 00000000000..fdc645b9b14 --- /dev/null +++ b/owl-bot-staging/Trace/v2/proto/src/Google/Cloud/Trace/V2/TruncatableString.php @@ -0,0 +1,125 @@ +google.devtools.cloudtrace.v2.TruncatableString + */ +class TruncatableString extends \Google\Protobuf\Internal\Message +{ + /** + * The shortened string. For example, if the original string is 500 + * bytes long and the limit of the string is 128 bytes, then + * `value` contains the first 128 bytes of the 500-byte string. + * Truncation always happens on a UTF8 character boundary. If there + * are multi-byte characters in the string, then the length of the + * shortened string might be less than the size limit. + * + * Generated from protobuf field string value = 1; + */ + protected $value = ''; + /** + * The number of bytes removed from the original string. If this + * value is 0, then the string was not shortened. + * + * Generated from protobuf field int32 truncated_byte_count = 2; + */ + protected $truncated_byte_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The shortened string. For example, if the original string is 500 + * bytes long and the limit of the string is 128 bytes, then + * `value` contains the first 128 bytes of the 500-byte string. + * Truncation always happens on a UTF8 character boundary. If there + * are multi-byte characters in the string, then the length of the + * shortened string might be less than the size limit. + * @type int $truncated_byte_count + * The number of bytes removed from the original string. If this + * value is 0, then the string was not shortened. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce(); + parent::__construct($data); + } + + /** + * The shortened string. For example, if the original string is 500 + * bytes long and the limit of the string is 128 bytes, then + * `value` contains the first 128 bytes of the 500-byte string. + * Truncation always happens on a UTF8 character boundary. If there + * are multi-byte characters in the string, then the length of the + * shortened string might be less than the size limit. + * + * Generated from protobuf field string value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The shortened string. For example, if the original string is 500 + * bytes long and the limit of the string is 128 bytes, then + * `value` contains the first 128 bytes of the 500-byte string. + * Truncation always happens on a UTF8 character boundary. If there + * are multi-byte characters in the string, then the length of the + * shortened string might be less than the size limit. + * + * Generated from protobuf field string value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * The number of bytes removed from the original string. If this + * value is 0, then the string was not shortened. + * + * Generated from protobuf field int32 truncated_byte_count = 2; + * @return int + */ + public function getTruncatedByteCount() + { + return $this->truncated_byte_count; + } + + /** + * The number of bytes removed from the original string. If this + * value is 0, then the string was not shortened. + * + * Generated from protobuf field int32 truncated_byte_count = 2; + * @param int $var + * @return $this + */ + public function setTruncatedByteCount($var) + { + GPBUtil::checkInt32($var); + $this->truncated_byte_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/batch_write_spans.php b/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/batch_write_spans.php new file mode 100644 index 00000000000..8366ec42c7d --- /dev/null +++ b/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/batch_write_spans.php @@ -0,0 +1,103 @@ +setName($spansName) + ->setSpanId($spansSpanId) + ->setDisplayName($spansDisplayName) + ->setStartTime($spansStartTime) + ->setEndTime($spansEndTime); + $spans = [$span,]; + $request = (new BatchWriteSpansRequest()) + ->setName($formattedName) + ->setSpans($spans); + + // Call the API and handle any network failures. + try { + $traceServiceClient->batchWriteSpans($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TraceServiceClient::projectName('[PROJECT]'); + $spansName = '[NAME]'; + $spansSpanId = '[SPAN_ID]'; + + batch_write_spans_sample($formattedName, $spansName, $spansSpanId); +} +// [END cloudtrace_v2_generated_TraceService_BatchWriteSpans_sync] diff --git a/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/create_span.php b/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/create_span.php new file mode 100644 index 00000000000..7cc936cd2be --- /dev/null +++ b/owl-bot-staging/Trace/v2/samples/V2/TraceServiceClient/create_span.php @@ -0,0 +1,91 @@ +setName($name) + ->setSpanId($spanId) + ->setDisplayName($displayName) + ->setStartTime($startTime) + ->setEndTime($endTime); + + // Call the API and handle any network failures. + try { + /** @var Span $response */ + $response = $traceServiceClient->createSpan($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + $spanId = '[SPAN_ID]'; + + create_span_sample($name, $spanId); +} +// [END cloudtrace_v2_generated_TraceService_CreateSpan_sync] diff --git a/owl-bot-staging/Trace/v2/src/V2/Client/TraceServiceClient.php b/owl-bot-staging/Trace/v2/src/V2/Client/TraceServiceClient.php new file mode 100644 index 00000000000..6365d6f1d3b --- /dev/null +++ b/owl-bot-staging/Trace/v2/src/V2/Client/TraceServiceClient.php @@ -0,0 +1,288 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/trace_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/trace_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/trace_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/trace_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a span + * resource. + * + * @param string $project + * @param string $trace + * @param string $span + * + * @return string The formatted span resource. + */ + public static function spanName(string $project, string $trace, string $span): string + { + return self::getPathTemplate('span')->render([ + 'project' => $project, + 'trace' => $trace, + 'span' => $span, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * - span: projects/{project}/traces/{trace}/spans/{span} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'cloudtrace.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Batch writes new spans to new or existing traces. You cannot update + * existing spans. + * + * The async variant is {@see TraceServiceClient::batchWriteSpansAsync()} . + * + * @example samples/V2/TraceServiceClient/batch_write_spans.php + * + * @param BatchWriteSpansRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchWriteSpans(BatchWriteSpansRequest $request, array $callOptions = []): void + { + $this->startApiCall('BatchWriteSpans', $request, $callOptions)->wait(); + } + + /** + * Creates a new span. + * + * The async variant is {@see TraceServiceClient::createSpanAsync()} . + * + * @example samples/V2/TraceServiceClient/create_span.php + * + * @param Span $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Span + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSpan(Span $request, array $callOptions = []): Span + { + return $this->startApiCall('CreateSpan', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Trace/v2/src/V2/Gapic/TraceServiceGapicClient.php b/owl-bot-staging/Trace/v2/src/V2/Gapic/TraceServiceGapicClient.php new file mode 100644 index 00000000000..21fed4d2ee4 --- /dev/null +++ b/owl-bot-staging/Trace/v2/src/V2/Gapic/TraceServiceGapicClient.php @@ -0,0 +1,477 @@ +projectName('[PROJECT]'); + * $spans = []; + * $traceServiceClient->batchWriteSpans($formattedName, $spans); + * } finally { + * $traceServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Trace\V2\Client\TraceServiceClient}. + */ +class TraceServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.devtools.cloudtrace.v2.TraceService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'cloudtrace.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'cloudtrace.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', + 'https://www.googleapis.com/auth/trace.append', + ]; + + private static $projectNameTemplate; + + private static $spanNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/trace_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/trace_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/trace_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/trace_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getSpanNameTemplate() + { + if (self::$spanNameTemplate == null) { + self::$spanNameTemplate = new PathTemplate('projects/{project}/traces/{trace}/spans/{span}'); + } + + return self::$spanNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + 'span' => self::getSpanNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a span + * resource. + * + * @param string $project + * @param string $trace + * @param string $span + * + * @return string The formatted span resource. + */ + public static function spanName($project, $trace, $span) + { + return self::getSpanNameTemplate()->render([ + 'project' => $project, + 'trace' => $trace, + 'span' => $span, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * - span: projects/{project}/traces/{trace}/spans/{span} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'cloudtrace.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); + } + + /** + * Batch writes new spans to new or existing traces. You cannot update + * existing spans. + * + * Sample code: + * ``` + * $traceServiceClient = new TraceServiceClient(); + * try { + * $formattedName = $traceServiceClient->projectName('[PROJECT]'); + * $spans = []; + * $traceServiceClient->batchWriteSpans($formattedName, $spans); + * } finally { + * $traceServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the project where the spans belong. The format is + * `projects/[PROJECT_ID]`. + * @param Span[] $spans Required. A list of new spans. The span names must not match existing + * spans, otherwise the results are undefined. + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function batchWriteSpans($name, $spans, array $optionalArgs = []) + { + $request = new BatchWriteSpansRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setSpans($spans); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchWriteSpans', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new span. + * + * Sample code: + * ``` + * $traceServiceClient = new TraceServiceClient(); + * try { + * $name = 'name'; + * $spanId = 'span_id'; + * $displayName = new TruncatableString(); + * $startTime = new Timestamp(); + * $endTime = new Timestamp(); + * $response = $traceServiceClient->createSpan($name, $spanId, $displayName, $startTime, $endTime); + * } finally { + * $traceServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the span in the following format: + * + * * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` + * + * `[TRACE_ID]` is a unique identifier for a trace within a project; + * it is a 32-character hexadecimal encoding of a 16-byte array. It should + * not be zero. + * + * `[SPAN_ID]` is a unique identifier for a span within a trace; it + * is a 16-character hexadecimal encoding of an 8-byte array. It should not + * be zero. + * . + * @param string $spanId Required. The `[SPAN_ID]` portion of the span's resource name. + * @param TruncatableString $displayName Required. A description of the span's operation (up to 128 bytes). + * Cloud Trace displays the description in the + * Cloud console. + * For example, the display name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name within an application and at the same call point. + * This makes it easier to correlate spans in different traces. + * @param Timestamp $startTime Required. The start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server + * side, this is the time when the server's application handler starts + * running. + * @param Timestamp $endTime Required. The end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server + * side, this is the time when the server application handler stops running. + * @param array $optionalArgs { + * Optional. + * + * @type string $parentSpanId + * The `[SPAN_ID]` of this span's parent span. If this is a root span, + * then this field must be empty. + * @type Attributes $attributes + * A set of attributes on the span. You can have up to 32 attributes per + * span. + * @type StackTrace $stackTrace + * Stack trace captured at the start of the span. + * @type TimeEvents $timeEvents + * A set of time events. You can have up to 32 annotations and 128 message + * events per span. + * @type Links $links + * Links associated with the span. You can have up to 128 links per Span. + * @type Status $status + * Optional. The final status for this span. + * @type BoolValue $sameProcessAsParentSpan + * Optional. Set this parameter to indicate whether this span is in + * the same process as its parent. If you do not set this parameter, + * Trace is unable to take advantage of this helpful information. + * @type Int32Value $childSpanCount + * Optional. The number of child spans that were generated while this span + * was active. If set, allows implementation to detect missing child spans. + * @type int $spanKind + * Optional. Distinguishes between spans generated in a particular context. + * For example, two spans with the same name may be distinguished using + * `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call. + * For allowed values, use constants defined on {@see \Google\Cloud\Trace\V2\Span\SpanKind} + * @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\Trace\V2\Span + * + * @throws ApiException if the remote call fails + */ + public function createSpan($name, $spanId, $displayName, $startTime, $endTime, array $optionalArgs = []) + { + $request = new Span(); + $requestParamHeaders = []; + $request->setName($name); + $request->setSpanId($spanId); + $request->setDisplayName($displayName); + $request->setStartTime($startTime); + $request->setEndTime($endTime); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['parentSpanId'])) { + $request->setParentSpanId($optionalArgs['parentSpanId']); + } + + if (isset($optionalArgs['attributes'])) { + $request->setAttributes($optionalArgs['attributes']); + } + + if (isset($optionalArgs['stackTrace'])) { + $request->setStackTrace($optionalArgs['stackTrace']); + } + + if (isset($optionalArgs['timeEvents'])) { + $request->setTimeEvents($optionalArgs['timeEvents']); + } + + if (isset($optionalArgs['links'])) { + $request->setLinks($optionalArgs['links']); + } + + if (isset($optionalArgs['status'])) { + $request->setStatus($optionalArgs['status']); + } + + if (isset($optionalArgs['sameProcessAsParentSpan'])) { + $request->setSameProcessAsParentSpan($optionalArgs['sameProcessAsParentSpan']); + } + + if (isset($optionalArgs['childSpanCount'])) { + $request->setChildSpanCount($optionalArgs['childSpanCount']); + } + + if (isset($optionalArgs['spanKind'])) { + $request->setSpanKind($optionalArgs['spanKind']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSpan', Span::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Trace/v2/src/V2/TraceServiceClient.php b/owl-bot-staging/Trace/v2/src/V2/TraceServiceClient.php new file mode 100644 index 00000000000..462d412571c --- /dev/null +++ b/owl-bot-staging/Trace/v2/src/V2/TraceServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.devtools.cloudtrace.v2.TraceService' => [ + 'BatchWriteSpans' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateSpan' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Trace\V2\Span', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + 'span' => 'projects/{project}/traces/{trace}/spans/{span}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Trace/v2/src/V2/resources/trace_service_rest_client_config.php b/owl-bot-staging/Trace/v2/src/V2/resources/trace_service_rest_client_config.php new file mode 100644 index 00000000000..9b55961440f --- /dev/null +++ b/owl-bot-staging/Trace/v2/src/V2/resources/trace_service_rest_client_config.php @@ -0,0 +1,33 @@ + [ + 'google.devtools.cloudtrace.v2.TraceService' => [ + 'BatchWriteSpans' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*}/traces:batchWrite', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateSpan' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/traces/*/spans/*}', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Trace/v2/tests/Unit/V2/Client/TraceServiceClientTest.php b/owl-bot-staging/Trace/v2/tests/Unit/V2/Client/TraceServiceClientTest.php new file mode 100644 index 00000000000..8ec56307a4b --- /dev/null +++ b/owl-bot-staging/Trace/v2/tests/Unit/V2/Client/TraceServiceClientTest.php @@ -0,0 +1,254 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TraceServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TraceServiceClient($options); + } + + /** @test */ + public function batchWriteSpansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $spans = []; + $request = (new BatchWriteSpansRequest()) + ->setName($formattedName) + ->setSpans($spans); + $gapicClient->batchWriteSpans($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.cloudtrace.v2.TraceService/BatchWriteSpans', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSpans(); + $this->assertProtobufEquals($spans, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteSpansExceptionTest() + { + $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 + $formattedName = $gapicClient->projectName('[PROJECT]'); + $spans = []; + $request = (new BatchWriteSpansRequest()) + ->setName($formattedName) + ->setSpans($spans); + try { + $gapicClient->batchWriteSpans($request); + // 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()); + } + + /** @test */ + public function createSpanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $spanId2 = 'spanId2-643891741'; + $parentSpanId2 = 'parentSpanId2-1321225074'; + $expectedResponse = new Span(); + $expectedResponse->setName($name2); + $expectedResponse->setSpanId($spanId2); + $expectedResponse->setParentSpanId($parentSpanId2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $spanId = 'spanId-2011840976'; + $displayName = new TruncatableString(); + $startTime = new Timestamp(); + $endTime = new Timestamp(); + $request = (new Span()) + ->setName($name) + ->setSpanId($spanId) + ->setDisplayName($displayName) + ->setStartTime($startTime) + ->setEndTime($endTime); + $response = $gapicClient->createSpan($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.cloudtrace.v2.TraceService/CreateSpan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getSpanId(); + $this->assertProtobufEquals($spanId, $actualValue); + $actualValue = $actualRequestObject->getDisplayName(); + $this->assertProtobufEquals($displayName, $actualValue); + $actualValue = $actualRequestObject->getStartTime(); + $this->assertProtobufEquals($startTime, $actualValue); + $actualValue = $actualRequestObject->getEndTime(); + $this->assertProtobufEquals($endTime, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSpanExceptionTest() + { + $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 + $name = 'name3373707'; + $spanId = 'spanId-2011840976'; + $displayName = new TruncatableString(); + $startTime = new Timestamp(); + $endTime = new Timestamp(); + $request = (new Span()) + ->setName($name) + ->setSpanId($spanId) + ->setDisplayName($displayName) + ->setStartTime($startTime) + ->setEndTime($endTime); + try { + $gapicClient->createSpan($request); + // 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()); + } + + /** @test */ + public function batchWriteSpansAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $spans = []; + $request = (new BatchWriteSpansRequest()) + ->setName($formattedName) + ->setSpans($spans); + $gapicClient->batchWriteSpansAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.cloudtrace.v2.TraceService/BatchWriteSpans', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSpans(); + $this->assertProtobufEquals($spans, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Trace/v2/tests/Unit/V2/TraceServiceClientTest.php b/owl-bot-staging/Trace/v2/tests/Unit/V2/TraceServiceClientTest.php new file mode 100644 index 00000000000..e7898694140 --- /dev/null +++ b/owl-bot-staging/Trace/v2/tests/Unit/V2/TraceServiceClientTest.php @@ -0,0 +1,205 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TraceServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TraceServiceClient($options); + } + + /** @test */ + public function batchWriteSpansTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $spans = []; + $gapicClient->batchWriteSpans($formattedName, $spans); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.cloudtrace.v2.TraceService/BatchWriteSpans', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSpans(); + $this->assertProtobufEquals($spans, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteSpansExceptionTest() + { + $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 + $formattedName = $gapicClient->projectName('[PROJECT]'); + $spans = []; + try { + $gapicClient->batchWriteSpans($formattedName, $spans); + // 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()); + } + + /** @test */ + public function createSpanTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $spanId2 = 'spanId2-643891741'; + $parentSpanId2 = 'parentSpanId2-1321225074'; + $expectedResponse = new Span(); + $expectedResponse->setName($name2); + $expectedResponse->setSpanId($spanId2); + $expectedResponse->setParentSpanId($parentSpanId2); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $spanId = 'spanId-2011840976'; + $displayName = new TruncatableString(); + $startTime = new Timestamp(); + $endTime = new Timestamp(); + $response = $gapicClient->createSpan($name, $spanId, $displayName, $startTime, $endTime); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.devtools.cloudtrace.v2.TraceService/CreateSpan', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $actualValue = $actualRequestObject->getSpanId(); + $this->assertProtobufEquals($spanId, $actualValue); + $actualValue = $actualRequestObject->getDisplayName(); + $this->assertProtobufEquals($displayName, $actualValue); + $actualValue = $actualRequestObject->getStartTime(); + $this->assertProtobufEquals($startTime, $actualValue); + $actualValue = $actualRequestObject->getEndTime(); + $this->assertProtobufEquals($endTime, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSpanExceptionTest() + { + $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 + $name = 'name3373707'; + $spanId = 'spanId-2011840976'; + $displayName = new TruncatableString(); + $startTime = new Timestamp(); + $endTime = new Timestamp(); + try { + $gapicClient->createSpan($name, $spanId, $displayName, $startTime, $endTime); + // 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()); + } +} diff --git a/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/AdaptiveMt.php b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/AdaptiveMt.php new file mode 100644 index 00000000000..a8e590af5ef Binary files /dev/null and b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/AdaptiveMt.php differ diff --git a/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/Common.php b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/Common.php new file mode 100644 index 00000000000..a72b2b1e412 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/Common.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile( + ' + +&google/cloud/translate/v3/common.protogoogle.cloud.translation.v3"( +GcsInputSource + input_uri ( BA"Z +FileInputSource + mime_type ( BA +content ( BA + display_name ( BA"6 +GcsOutputDestination +output_uri_prefix ( BAB +com.google.cloud.translate.v3B CommonProtoPZ;cloud.google.com/go/translate/apiv3/translatepb;translatepbGoogle.Cloud.Translate.V3Google\\Cloud\\Translate\\V3Google::Cloud::Translate::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php new file mode 100644 index 00000000000..7ff27f45eae Binary files /dev/null and b/owl-bot-staging/Translate/v3/proto/src/GPBMetadata/Google/Cloud/Translate/V3/TranslationService.php differ diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtDataset.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtDataset.php new file mode 100644 index 00000000000..dce6452a2be --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtDataset.php @@ -0,0 +1,303 @@ +google.cloud.translation.v3.AdaptiveMtDataset + */ +class AdaptiveMtDataset extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the dataset, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The name of the dataset to show in the interface. The name can be + * up to 32 characters long and can consist only of ASCII Latin letters A-Z + * and a-z, underscores (_), and ASCII digits 0-9. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The BCP-47 language code of the source language. + * + * Generated from protobuf field string source_language_code = 3; + */ + protected $source_language_code = ''; + /** + * The BCP-47 language code of the target language. + * + * Generated from protobuf field string target_language_code = 4; + */ + protected $target_language_code = ''; + /** + * The number of examples in the dataset. + * + * Generated from protobuf field int32 example_count = 5; + */ + protected $example_count = 0; + /** + * Output only. Timestamp when this dataset was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Timestamp when this dataset was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the dataset, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` + * @type string $display_name + * The name of the dataset to show in the interface. The name can be + * up to 32 characters long and can consist only of ASCII Latin letters A-Z + * and a-z, underscores (_), and ASCII digits 0-9. + * @type string $source_language_code + * The BCP-47 language code of the source language. + * @type string $target_language_code + * The BCP-47 language code of the target language. + * @type int $example_count + * The number of examples in the dataset. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Timestamp when this dataset was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Timestamp when this dataset was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the dataset, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the dataset, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The name of the dataset to show in the interface. The name can be + * up to 32 characters long and can consist only of ASCII Latin letters A-Z + * and a-z, underscores (_), and ASCII digits 0-9. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The name of the dataset to show in the interface. The name can be + * up to 32 characters long and can consist only of ASCII Latin letters A-Z + * and a-z, underscores (_), and ASCII digits 0-9. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The BCP-47 language code of the source language. + * + * Generated from protobuf field string source_language_code = 3; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * The BCP-47 language code of the source language. + * + * Generated from protobuf field string source_language_code = 3; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * The BCP-47 language code of the target language. + * + * Generated from protobuf field string target_language_code = 4; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * The BCP-47 language code of the target language. + * + * Generated from protobuf field string target_language_code = 4; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * The number of examples in the dataset. + * + * Generated from protobuf field int32 example_count = 5; + * @return int + */ + public function getExampleCount() + { + return $this->example_count; + } + + /** + * The number of examples in the dataset. + * + * Generated from protobuf field int32 example_count = 5; + * @param int $var + * @return $this + */ + public function setExampleCount($var) + { + GPBUtil::checkInt32($var); + $this->example_count = $var; + + return $this; + } + + /** + * Output only. Timestamp when this dataset was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Timestamp when this dataset was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Timestamp when this dataset was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Timestamp when this dataset was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtFile.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtFile.php new file mode 100644 index 00000000000..fcd6d230e4b --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtFile.php @@ -0,0 +1,227 @@ +google.cloud.translation.v3.AdaptiveMtFile + */ +class AdaptiveMtFile extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The file's display name. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The number of entries that the file contains. + * + * Generated from protobuf field int32 entry_count = 3; + */ + protected $entry_count = 0; + /** + * Output only. Timestamp when this file was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Timestamp when this file was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * @type string $display_name + * The file's display name. + * @type int $entry_count + * The number of entries that the file contains. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Timestamp when this file was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Timestamp when this file was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The file's display name. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The file's display name. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The number of entries that the file contains. + * + * Generated from protobuf field int32 entry_count = 3; + * @return int + */ + public function getEntryCount() + { + return $this->entry_count; + } + + /** + * The number of entries that the file contains. + * + * Generated from protobuf field int32 entry_count = 3; + * @param int $var + * @return $this + */ + public function setEntryCount($var) + { + GPBUtil::checkInt32($var); + $this->entry_count = $var; + + return $this; + } + + /** + * Output only. Timestamp when this file was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Timestamp when this file was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Timestamp when this file was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Timestamp when this file was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtSentence.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtSentence.php new file mode 100644 index 00000000000..72c6dfe743d --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtSentence.php @@ -0,0 +1,227 @@ +google.cloud.translation.v3.AdaptiveMtSentence + */ +class AdaptiveMtSentence extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The source sentence. + * + * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_sentence = ''; + /** + * Required. The target sentence. + * + * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_sentence = ''; + /** + * Output only. Timestamp when this sentence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Timestamp when this sentence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` + * @type string $source_sentence + * Required. The source sentence. + * @type string $target_sentence + * Required. The target sentence. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Timestamp when this sentence was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Timestamp when this sentence was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The source sentence. + * + * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceSentence() + { + return $this->source_sentence; + } + + /** + * Required. The source sentence. + * + * Generated from protobuf field string source_sentence = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceSentence($var) + { + GPBUtil::checkString($var, True); + $this->source_sentence = $var; + + return $this; + } + + /** + * Required. The target sentence. + * + * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetSentence() + { + return $this->target_sentence; + } + + /** + * Required. The target sentence. + * + * Generated from protobuf field string target_sentence = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetSentence($var) + { + GPBUtil::checkString($var, True); + $this->target_sentence = $var; + + return $this; + } + + /** + * Output only. Timestamp when this sentence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Timestamp when this sentence was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Timestamp when this sentence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Timestamp when this sentence was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateRequest.php new file mode 100644 index 00000000000..b05d1ec7930 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateRequest.php @@ -0,0 +1,166 @@ +google.cloud.translation.v3.AdaptiveMtTranslateRequest + */ +class AdaptiveMtTranslateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The resource name for the dataset to use for adaptive MT. + * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $dataset = ''; + /** + * Required. The content of the input in string format. + * For now only one sentence per request is supported. + * + * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $content; + + /** + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string[] $content Required. The content of the input in string format. + * For now only one sentence per request is supported. + * + * @return \Google\Cloud\Translate\V3\AdaptiveMtTranslateRequest + * + * @experimental + */ + public static function build(string $parent, array $content): self + { + return (new self()) + ->setParent($parent) + ->setContent($content); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * @type string $dataset + * Required. The resource name for the dataset to use for adaptive MT. + * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + * @type array|\Google\Protobuf\Internal\RepeatedField $content + * Required. The content of the input in string format. + * For now only one sentence per request is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The resource name for the dataset to use for adaptive MT. + * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataset() + { + return $this->dataset; + } + + /** + * Required. The resource name for the dataset to use for adaptive MT. + * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string dataset = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataset($var) + { + GPBUtil::checkString($var, True); + $this->dataset = $var; + + return $this; + } + + /** + * Required. The content of the input in string format. + * For now only one sentence per request is supported. + * + * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContent() + { + return $this->content; + } + + /** + * Required. The content of the input in string format. + * For now only one sentence per request is supported. + * + * Generated from protobuf field repeated string content = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContent($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->content = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateResponse.php new file mode 100644 index 00000000000..096b3b0993e --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslateResponse.php @@ -0,0 +1,101 @@ +google.cloud.translation.v3.AdaptiveMtTranslateResponse + */ +class AdaptiveMtTranslateResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The translation. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $translations; + /** + * Output only. The translation's language code. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\AdaptiveMtTranslation>|\Google\Protobuf\Internal\RepeatedField $translations + * Output only. The translation. + * @type string $language_code + * Output only. The translation's language code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The translation. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTranslations() + { + return $this->translations; + } + + /** + * Output only. The translation. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtTranslation translations = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Translate\V3\AdaptiveMtTranslation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTranslations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtTranslation::class); + $this->translations = $arr; + + return $this; + } + + /** + * Output only. The translation's language code. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Output only. The translation's language code. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslation.php new file mode 100644 index 00000000000..6dd8e9911c6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/AdaptiveMtTranslation.php @@ -0,0 +1,67 @@ +google.cloud.translation.v3.AdaptiveMtTranslation + */ +class AdaptiveMtTranslation extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The translated text. + * + * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $translated_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $translated_text + * Output only. The translated text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The translated text. + * + * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTranslatedText() + { + return $this->translated_text; + } + + /** + * Output only. The translated text. + * + * Generated from protobuf field string translated_text = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTranslatedText($var) + { + GPBUtil::checkString($var, True); + $this->translated_text = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentInputConfig.php new file mode 100644 index 00000000000..43a05b43f1b --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentInputConfig.php @@ -0,0 +1,123 @@ +google.cloud.translation.v3.BatchDocumentInputConfig + */ +class BatchDocumentInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.docx`) or a wildcard (for example, + * `gs://translation-test/*`). + * File mime type is determined based on extension. Supported mime type + * includes: + * - `pdf`, application/pdf + * - `docx`, + * application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - `pptx`, + * application/vnd.openxmlformats-officedocument.presentationml.presentation + * - `xlsx`, + * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. + * The max file size to support for `.pdf` is 1GB and the max page limit is + * 1000 pages. + * The max file size to support for all input documents is 1GB. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php new file mode 100644 index 00000000000..60ecb321713 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchDocumentOutputConfig.php @@ -0,0 +1,186 @@ +google.cloud.translation.v3.BatchDocumentOutputConfig + */ +class BatchDocumentOutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * `gs://translation_output/a_b_c_[trg]_translation.[extension]` + * `glossary_translation_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt` + * `glossary_error_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.txt`. The error + * output is a txt file containing error details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * `gs://translation_output/a_b_c_[trg]_translation.[extension]` + * `glossary_translation_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt` + * `glossary_error_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.txt`. The error + * output is a txt file containing error details. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input document (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateDocumentRequest). + * While the input documents are being processed, we write/update an index + * file `index.csv` under `gcs_destination.output_uri_prefix` (for example, + * gs://translation_output/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_document,target_language_code,translation_output,error_output, + * glossary_translation_output,glossary_error_output + * `input_document` is one file we matched using gcs_source.input_uri. + * `target_language_code` is provided in the request. + * `translation_output` contains the translations. (details provided below) + * `error_output` contains the error message during processing of the file. + * Both translations_file and errors_file could be empty strings if we have + * no content to output. + * `glossary_translation_output` and `glossary_error_output` are the + * translated output/error when we apply glossaries. They could also be + * empty if we have no content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The naming format of translation output files follows (for target + * language code [trg]): `translation_output`: + * `gs://translation_output/a_b_c_[trg]_translation.[extension]` + * `glossary_translation_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The + * output document will maintain the same file format as the input document. + * The naming format of error output files follows (for target language code + * [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt` + * `glossary_error_output`: + * `gs://translation_test/a_b_c_[trg]_glossary_translation.txt`. The error + * output is a txt file containing error details. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php new file mode 100644 index 00000000000..578301767c6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata.php @@ -0,0 +1,411 @@ +google.cloud.translation.v3.BatchTranslateDocumentMetadata + */ +class BatchTranslateDocumentMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + */ + protected $state = 0; + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + */ + protected $total_pages = 0; + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + */ + protected $translated_pages = 0; + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + */ + protected $failed_pages = 0; + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + */ + protected $total_billable_pages = 0; + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + */ + protected $failed_characters = 0; + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + */ + protected $total_billable_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type int|string $total_pages + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $translated_pages + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $failed_pages + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * @type int|string $total_billable_pages + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * @type int|string $total_characters + * Total number of characters (Unicode codepoints) in all documents so far. + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * @type int|string $total_billable_characters + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateDocumentMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + * @return int|string + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * Total number of pages to translate in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 2; + * @param int|string $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt64($var); + $this->total_pages = $var; + + return $this; + } + + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + * @return int|string + */ + public function getTranslatedPages() + { + return $this->translated_pages; + } + + /** + * Number of successfully translated pages in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 3; + * @param int|string $var + * @return $this + */ + public function setTranslatedPages($var) + { + GPBUtil::checkInt64($var); + $this->translated_pages = $var; + + return $this; + } + + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + * @return int|string + */ + public function getFailedPages() + { + return $this->failed_pages; + } + + /** + * Number of pages that failed to process in all documents so far. Documents + * without clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 4; + * @param int|string $var + * @return $this + */ + public function setFailedPages($var) + { + GPBUtil::checkInt64($var); + $this->failed_pages = $var; + + return $this; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + * @return int|string + */ + public function getTotalBillablePages() + { + return $this->total_billable_pages; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) so far. + * + * Generated from protobuf field int64 total_billable_pages = 5; + * @param int|string $var + * @return $this + */ + public function setTotalBillablePages($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_pages = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints) in all documents so far. + * + * Generated from protobuf field int64 total_characters = 6; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents so far. + * + * Generated from protobuf field int64 translated_characters = 7; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents so far. + * + * Generated from protobuf field int64 failed_characters = 8; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + * @return int|string + */ + public function getTotalBillableCharacters() + { + return $this->total_billable_characters; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition (such as XLSX) so far. + * + * Generated from protobuf field int64 total_billable_characters = 9; + * @param int|string $var + * @return $this + */ + public function setTotalBillableCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php new file mode 100644 index 00000000000..6631a48171f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentMetadata/State.php @@ -0,0 +1,88 @@ +google.cloud.translation.v3.BatchTranslateDocumentMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The batch is processed, and at least one item was successfully processed. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The batch is done and no item was successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The batch is done after the user has called the + * longrunning.Operations.CancelOperation. Any records processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentRequest.php new file mode 100644 index 00000000000..6b8310ad887 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentRequest.php @@ -0,0 +1,595 @@ +google.cloud.translation.v3.BatchTranslateDocumentRequest + */ +class BatchTranslateDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_language_codes; + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_configs; + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $models; + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $glossaries; + /** + * Optional. The file format conversion map that is applied to all input + * files. The map key is the original mime_type. The map value is the target + * mime_type of translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $format_conversions; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $customized_attribution = ''; + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_shadow_removal_native_pdf = false; + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_rotation_correction = false; + + /** + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string $sourceLanguageCode Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @param string[] $targetLanguageCodes Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param \Google\Cloud\Translate\V3\BatchDocumentInputConfig[] $inputConfigs Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $outputConfig Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * @return \Google\Cloud\Translate\V3\BatchTranslateDocumentRequest + * + * @experimental + */ + public static function build(string $parent, string $sourceLanguageCode, array $targetLanguageCodes, array $inputConfigs, \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $outputConfig): self + { + return (new self()) + ->setParent($parent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @type string $source_language_code + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @type array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @type \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $output_config + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @type array|\Google\Protobuf\Internal\MapField $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array|\Google\Protobuf\Internal\MapField $glossaries + * Optional. Glossaries to be applied. It's keyed by target language code. + * @type array|\Google\Protobuf\Internal\MapField $format_conversions + * Optional. The file format conversion map that is applied to all input + * files. The map key is the original mime_type. The map value is the target + * mime_type of translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $enable_shadow_removal_native_pdf + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * @type bool $enable_rotation_correction + * Optional. If true, enable auto rotation correction in DVS. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetLanguageCodes() + { + return $this->target_language_codes; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_language_codes = $arr; + + return $this; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputConfigs() + { + return $this->input_configs; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.BatchDocumentInputConfig input_configs = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Translate\V3\BatchDocumentInputConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\BatchDocumentInputConfig::class); + $this->input_configs = $arr; + + return $this; + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\BatchDocumentOutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchDocumentOutputConfig output_config = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\BatchDocumentOutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\BatchDocumentOutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getModels() + { + return $this->models; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->models = $arr; + + return $this; + } + + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * Optional. Glossaries to be applied. It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * Optional. The file format conversion map that is applied to all input + * files. The map key is the original mime_type. The map value is the target + * mime_type of translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getFormatConversions() + { + return $this->format_conversions; + } + + /** + * Optional. The file format conversion map that is applied to all input + * files. The map key is the original mime_type. The map value is the target + * mime_type of translated documents. + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * If nothing specified, output files will be in the same format as the + * original file. + * + * Generated from protobuf field map format_conversions = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setFormatConversions($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->format_conversions = $arr; + + return $this; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableShadowRemovalNativePdf() + { + return $this->enable_shadow_removal_native_pdf; + } + + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableShadowRemovalNativePdf($var) + { + GPBUtil::checkBool($var); + $this->enable_shadow_removal_native_pdf = $var; + + return $this; + } + + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableRotationCorrection() + { + return $this->enable_rotation_correction; + } + + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableRotationCorrection($var) + { + GPBUtil::checkBool($var); + $this->enable_rotation_correction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php new file mode 100644 index 00000000000..ac0c68355f7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateDocumentResponse.php @@ -0,0 +1,432 @@ +google.cloud.translation.v3.BatchTranslateDocumentResponse + */ +class BatchTranslateDocumentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + */ + protected $total_pages = 0; + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + */ + protected $translated_pages = 0; + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + */ + protected $failed_pages = 0; + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + */ + protected $total_billable_pages = 0; + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + */ + protected $failed_characters = 0; + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + */ + protected $total_billable_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + */ + protected $submit_time = null; + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $total_pages + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $translated_pages + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $failed_pages + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * @type int|string $total_billable_pages + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * @type int|string $total_characters + * Total number of characters (Unicode codepoints) in all documents. + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * @type int|string $total_billable_characters + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + * @return int|string + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * Total number of pages to translate in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 total_pages = 1; + * @param int|string $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt64($var); + $this->total_pages = $var; + + return $this; + } + + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + * @return int|string + */ + public function getTranslatedPages() + { + return $this->translated_pages; + } + + /** + * Number of successfully translated pages in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 translated_pages = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedPages($var) + { + GPBUtil::checkInt64($var); + $this->translated_pages = $var; + + return $this; + } + + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + * @return int|string + */ + public function getFailedPages() + { + return $this->failed_pages; + } + + /** + * Number of pages that failed to process in all documents. Documents without + * clear page definition (such as XLSX) are not counted. + * + * Generated from protobuf field int64 failed_pages = 3; + * @param int|string $var + * @return $this + */ + public function setFailedPages($var) + { + GPBUtil::checkInt64($var); + $this->failed_pages = $var; + + return $this; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + * @return int|string + */ + public function getTotalBillablePages() + { + return $this->total_billable_pages; + } + + /** + * Number of billable pages in documents with clear page definition (such as + * PDF, DOCX, PPTX) + * + * Generated from protobuf field int64 total_billable_pages = 4; + * @param int|string $var + * @return $this + */ + public function setTotalBillablePages($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_pages = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints) in all documents. + * + * Generated from protobuf field int64 total_characters = 5; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints) in all + * documents. + * + * Generated from protobuf field int64 translated_characters = 6; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints) in + * all documents. + * + * Generated from protobuf field int64 failed_characters = 7; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + * @return int|string + */ + public function getTotalBillableCharacters() + { + return $this->total_billable_characters; + } + + /** + * Number of billable characters (Unicode codepoints) in documents without + * clear page definition, such as XLSX. + * + * Generated from protobuf field int64 total_billable_characters = 8; + * @param int|string $var + * @return $this + */ + public function setTotalBillableCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_billable_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php new file mode 100644 index 00000000000..088d15ac8a9 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata.php @@ -0,0 +1,225 @@ +google.cloud.translation.v3.BatchTranslateMetadata + */ +class BatchTranslateMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + protected $state = 0; + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + */ + protected $failed_characters = 0; + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + */ + protected $total_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type int|string $translated_characters + * Number of successfully translated characters so far (Unicode codepoints). + * @type int|string $failed_characters + * Number of characters that have failed to process so far (Unicode + * codepoints). + * @type int|string $total_characters + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\BatchTranslateMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters so far (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process so far (Unicode + * codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints). + * This is the total number of codepoints from input files times the number of + * target languages and appears here shortly after the call is submitted. + * + * Generated from protobuf field int64 total_characters = 4; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php new file mode 100644 index 00000000000..287dfff0389 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateMetadata/State.php @@ -0,0 +1,89 @@ +google.cloud.translation.v3.BatchTranslateMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The batch is processed, and at least one item was successfully + * processed. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The batch is done and no item was successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The batch is done after the user has called the + * longrunning.Operations.CancelOperation. Any records processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Translate\V3\BatchTranslateMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateResponse.php new file mode 100644 index 00000000000..dfd33736f5e --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateResponse.php @@ -0,0 +1,234 @@ +google.cloud.translation.v3.BatchTranslateResponse + */ +class BatchTranslateResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + */ + protected $total_characters = 0; + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + */ + protected $translated_characters = 0; + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + */ + protected $failed_characters = 0; + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + */ + protected $submit_time = null; + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $total_characters + * Total number of characters (Unicode codepoints). + * @type int|string $translated_characters + * Number of successfully translated characters (Unicode codepoints). + * @type int|string $failed_characters + * Number of characters that have failed to process (Unicode codepoints). + * @type \Google\Protobuf\Timestamp $submit_time + * Time when the operation was submitted. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + * @return int|string + */ + public function getTotalCharacters() + { + return $this->total_characters; + } + + /** + * Total number of characters (Unicode codepoints). + * + * Generated from protobuf field int64 total_characters = 1; + * @param int|string $var + * @return $this + */ + public function setTotalCharacters($var) + { + GPBUtil::checkInt64($var); + $this->total_characters = $var; + + return $this; + } + + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @return int|string + */ + public function getTranslatedCharacters() + { + return $this->translated_characters; + } + + /** + * Number of successfully translated characters (Unicode codepoints). + * + * Generated from protobuf field int64 translated_characters = 2; + * @param int|string $var + * @return $this + */ + public function setTranslatedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->translated_characters = $var; + + return $this; + } + + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @return int|string + */ + public function getFailedCharacters() + { + return $this->failed_characters; + } + + /** + * Number of characters that have failed to process (Unicode codepoints). + * + * Generated from protobuf field int64 failed_characters = 3; + * @param int|string $var + * @return $this + */ + public function setFailedCharacters($var) + { + GPBUtil::checkInt64($var); + $this->failed_characters = $var; + + return $this; + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Time when the operation was submitted. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the operation is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php new file mode 100644 index 00000000000..79d9d703113 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/BatchTranslateTextRequest.php @@ -0,0 +1,419 @@ +google.cloud.translation.v3.BatchTranslateTextRequest + */ +class BatchTranslateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_language_code = ''; + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $target_language_codes; + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $models; + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $input_configs; + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $glossaries; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @type string $source_language_code + * Required. Source language code. + * @type array|\Google\Protobuf\Internal\RepeatedField $target_language_codes + * Required. Specify up to 10 language codes here. + * @type array|\Google\Protobuf\Internal\MapField $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $input_configs + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @type \Google\Cloud\Translate\V3\OutputConfig $output_config + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @type array|\Google\Protobuf\Internal\MapField $glossaries + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a call. Must refer to a caller's project. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * The `global` location is not supported for batch translation. + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. Source language code. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetLanguageCodes() + { + return $this->target_language_codes; + } + + /** + * Required. Specify up to 10 language codes here. + * + * Generated from protobuf field repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->target_language_codes = $arr; + + return $this; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getModels() + { + return $this->models; + } + + /** + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * The value format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * + * Generated from protobuf field map models = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->models = $arr; + + return $this; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputConfigs() + { + return $this->input_configs; + } + + /** + * Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Translate\V3\InputConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\InputConfig::class); + $this->input_configs = $arr; + + return $this; + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * + * Generated from protobuf field .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * + * Generated from protobuf field map glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateAdaptiveMtDatasetRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateAdaptiveMtDatasetRequest.php new file mode 100644 index 00000000000..4fe3a22800c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateAdaptiveMtDatasetRequest.php @@ -0,0 +1,132 @@ +google.cloud.translation.v3.CreateAdaptiveMtDatasetRequest + */ +class CreateAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The AdaptiveMtDataset to be created. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $adaptive_mt_dataset = null; + + /** + * @param string $parent Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * Please see {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptiveMtDataset Required. The AdaptiveMtDataset to be created. + * + * @return \Google\Cloud\Translate\V3\CreateAdaptiveMtDatasetRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptiveMtDataset): self + { + return (new self()) + ->setParent($parent) + ->setAdaptiveMtDataset($adaptiveMtDataset); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * @type \Google\Cloud\Translate\V3\AdaptiveMtDataset $adaptive_mt_dataset + * Required. The AdaptiveMtDataset to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The AdaptiveMtDataset to be created. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\AdaptiveMtDataset|null + */ + public function getAdaptiveMtDataset() + { + return $this->adaptive_mt_dataset; + } + + public function hasAdaptiveMtDataset() + { + return isset($this->adaptive_mt_dataset); + } + + public function clearAdaptiveMtDataset() + { + unset($this->adaptive_mt_dataset); + } + + /** + * Required. The AdaptiveMtDataset to be created. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_dataset = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\AdaptiveMtDataset $var + * @return $this + */ + public function setAdaptiveMtDataset($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\AdaptiveMtDataset::class); + $this->adaptive_mt_dataset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php new file mode 100644 index 00000000000..cf902834a45 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata.php @@ -0,0 +1,147 @@ +google.cloud.translation.v3.CreateGlossaryMetadata + */ +class CreateGlossaryMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + protected $state = 0; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the glossary that is being created. + * @type int $state + * The current state of the glossary creation operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the glossary that is being created. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the glossary creation operation. + * + * Generated from protobuf field .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\CreateGlossaryMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php new file mode 100644 index 00000000000..3aed3689d19 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryMetadata/State.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.CreateGlossaryMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The glossary was successfully created. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * Failed to create the glossary. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The glossary creation request was successfully canceled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Translate\V3\CreateGlossaryMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryRequest.php new file mode 100644 index 00000000000..d56a13da90c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/CreateGlossaryRequest.php @@ -0,0 +1,127 @@ +google.cloud.translation.v3.CreateGlossaryRequest + */ +class CreateGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $glossary = null; + + /** + * @param string $parent Required. The project name. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Translate\V3\Glossary $glossary Required. The glossary to create. + * + * @return \Google\Cloud\Translate\V3\CreateGlossaryRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Translate\V3\Glossary $glossary): self + { + return (new self()) + ->setParent($parent) + ->setGlossary($glossary); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project name. + * @type \Google\Cloud\Translate\V3\Glossary $glossary + * Required. The glossary to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project name. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\Glossary|null + */ + public function getGlossary() + { + return $this->glossary; + } + + public function hasGlossary() + { + return isset($this->glossary); + } + + public function clearGlossary() + { + unset($this->glossary); + } + + /** + * Required. The glossary to create. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\Glossary $var + * @return $this + */ + public function setGlossary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary::class); + $this->glossary = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtDatasetRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtDatasetRequest.php new file mode 100644 index 00000000000..c0dbe46bc86 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtDatasetRequest.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.DeleteAdaptiveMtDatasetRequest + */ +class DeleteAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\DeleteAdaptiveMtDatasetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtFileRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtFileRequest.php new file mode 100644 index 00000000000..4f3599a6c25 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteAdaptiveMtFileRequest.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.DeleteAdaptiveMtFileRequest + */ +class DeleteAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\DeleteAdaptiveMtFileRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php new file mode 100644 index 00000000000..4c4c6c924c2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata.php @@ -0,0 +1,147 @@ +google.cloud.translation.v3.DeleteGlossaryMetadata + */ +class DeleteGlossaryMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + protected $state = 0; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + */ + protected $submit_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the glossary that is being deleted. + * @type int $state + * The current state of the glossary deletion operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the glossary that is being deleted. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the glossary deletion operation. + * + * Generated from protobuf field .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php new file mode 100644 index 00000000000..65fe6b5df28 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryMetadata/State.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.DeleteGlossaryMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The glossary was successfully deleted. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * Failed to delete the glossary. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Request is in the process of being canceled after caller invoked + * longrunning.Operations.CancelOperation on the request id. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The glossary deletion request was successfully canceled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Translate\V3\DeleteGlossaryMetadata_State::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryRequest.php new file mode 100644 index 00000000000..58522ba2b1d --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryRequest.php @@ -0,0 +1,81 @@ +google.cloud.translation.v3.DeleteGlossaryRequest + */ +class DeleteGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the glossary to delete. Please see + * {@see TranslationServiceClient::glossaryName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\DeleteGlossaryRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the glossary to delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the glossary to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php new file mode 100644 index 00000000000..d3bc457df68 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DeleteGlossaryResponse.php @@ -0,0 +1,165 @@ +google.cloud.translation.v3.DeleteGlossaryResponse + */ +class DeleteGlossaryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + */ + protected $submit_time = null; + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the deleted glossary. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the operation was submitted to the server. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the deleted glossary. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the operation was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the glossary deletion is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php new file mode 100644 index 00000000000..99ceeed57cd --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageRequest.php @@ -0,0 +1,326 @@ +google.cloud.translation.v3.DetectLanguageRequest + */ +class DetectLanguageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + protected $source; + + /** + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string $model Optional. The language detection model to be used. + * + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * + * If not specified, the default model is used. + * @param string $mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param string $content The content of the input stored as a string. + * + * @return \Google\Cloud\Translate\V3\DetectLanguageRequest + * + * @experimental + */ + public static function build(string $parent, string $model, string $mimeType, string $content): self + { + return (new self()) + ->setParent($parent) + ->setModel($model) + ->setMimeType($mimeType) + ->setContent($content); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $model + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * @type string $content + * The content of the input stored as a string. + * @type string $mime_type + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The language detection model to be used. + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * If not specified, the default model is used. + * + * Generated from protobuf field string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The content of the input stored as a string. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->readOneof(1); + } + + public function hasContent() + { + return $this->hasOneof(1); + } + + /** + * The content of the input stored as a string. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php new file mode 100644 index 00000000000..7bcf6ef7f39 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectLanguageResponse.php @@ -0,0 +1,71 @@ +google.cloud.translation.v3.DetectLanguageResponse + */ +class DetectLanguageResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + private $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguages() + { + return $this->languages; + } + + /** + * The most probable language detected by the Translation API. For each + * request, the Translation API will always return only one result. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + * @param array<\Google\Cloud\Translate\V3\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\DetectedLanguage::class); + $this->languages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php new file mode 100644 index 00000000000..b0e30fd6ed8 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DetectedLanguage.php @@ -0,0 +1,105 @@ +google.cloud.translation.v3.DetectedLanguage + */ +class DetectedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * The ISO-639 language code of the source content in the request, detected + * automatically. + * @type float $confidence + * The confidence of the detection result for this language. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The ISO-639 language code of the source content in the request, detected + * automatically. + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The confidence of the detection result for this language. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php new file mode 100644 index 00000000000..2285639ebfc --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentInputConfig.php @@ -0,0 +1,177 @@ +google.cloud.translation.v3.DocumentInputConfig + */ +class DocumentInputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + */ + protected $mime_type = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Document's content represented as a stream of bytes. + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * @type string $mime_type + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Document's content represented as a stream of bytes. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->readOneof(1); + } + + public function hasContent() + { + return $this->hasOneof(1); + } + + /** + * Document's content represented as a stream of bytes. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(2); + } + + public function hasGcsSource() + { + return $this->hasOneof(2); + } + + /** + * Google Cloud Storage location. This must be a single file. + * For example: gs://example_bucket/example_file.pdf + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Specifies the input document's mime_type. + * If not specified it will be determined using the file extension for + * gcs_source provided files. For a file provided through bytes content the + * mime_type must be provided. + * Currently supported mime types are: + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 4; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php new file mode 100644 index 00000000000..96a6346c724 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentOutputConfig.php @@ -0,0 +1,240 @@ +google.cloud.translation.v3.DocumentOutputConfig + */ +class DocumentOutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * `gs://my_bucket/translated_document_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`. + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * @type string $mime_type + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * `gs://my_bucket/translated_document_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`. + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Optional. Google Cloud Storage destination for the translation output, + * e.g., `gs://my_bucket/my_directory/`. + * The destination directory provided does not have to be empty, but the + * bucket must exist. If a file with the same name as the output file + * already exists in the destination an error will be returned. + * For a DocumentInputConfig.contents provided document, the output file + * will have the name "output_[trg]_translations.[ext]", where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * For a DocumentInputConfig.gcs_uri provided document, the output file will + * have a name according to its URI. For example: an input file with URI: + * `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name + * "my_bucket" will have an output URI: + * `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If the document was directly provided through the request, then the + * output document will have the format: + * `gs://my_bucket/translated_document_[trg]_translations.[ext]`, where + * - [trg] corresponds to the translated file's language code, + * - [ext] corresponds to the translated file's extension according to its + * mime type. + * If a glossary was provided, then the output URI for the glossary + * translation will be equal to the default output URI but have + * `glossary_translations` instead of `translations`. For the previous + * example, its glossary URI would be: + * `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`. + * Thus the max number of output files will be 2 (Translated document, + * Glossary translated document). + * Callers should expect no partial outputs. If there is any error during + * document translation, no output will be stored in the Cloud Storage + * bucket. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. Specifies the translated document's mime_type. + * If not specified, the translated file's mime type will be the same as the + * input file's mime type. + * Currently only support the output mime type to be the same as input mime + * type. + * - application/pdf + * - application/vnd.openxmlformats-officedocument.wordprocessingml.document + * - application/vnd.openxmlformats-officedocument.presentationml.presentation + * - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php new file mode 100644 index 00000000000..a03fe5adad2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/DocumentTranslation.php @@ -0,0 +1,159 @@ +google.cloud.translation.v3.DocumentTranslation + */ +class DocumentTranslation extends \Google\Protobuf\Internal\Message +{ + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + */ + private $byte_stream_outputs; + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + */ + protected $detected_language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $byte_stream_outputs + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * @type string $mime_type + * The translated document's mime type. + * @type string $detected_language_code + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getByteStreamOutputs() + { + return $this->byte_stream_outputs; + } + + /** + * The array of translated documents. It is expected to be size 1 for now. We + * may produce multiple translated documents in the future for other type of + * file formats. + * + * Generated from protobuf field repeated bytes byte_stream_outputs = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setByteStreamOutputs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); + $this->byte_stream_outputs = $arr; + + return $this; + } + + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The translated document's mime type. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + * @return string + */ + public function getDetectedLanguageCode() + { + return $this->detected_language_code; + } + + /** + * The detected language for the input document. + * If the user did not provide the source language for the input document, + * this field will have the language code automatically detected. If the + * source language was passed, auto-detection of the language does not occur + * and this field is empty. + * + * Generated from protobuf field string detected_language_code = 3; + * @param string $var + * @return $this + */ + public function setDetectedLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->detected_language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/FileInputSource.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/FileInputSource.php new file mode 100644 index 00000000000..2faf57ac717 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/FileInputSource.php @@ -0,0 +1,135 @@ +google.cloud.translation.v3.FileInputSource + */ +class FileInputSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The file's mime type. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $mime_type = ''; + /** + * Required. The file's byte contents. + * + * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $content = ''; + /** + * Required. The file's display name. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mime_type + * Required. The file's mime type. + * @type string $content + * Required. The file's byte contents. + * @type string $display_name + * Required. The file's display name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. The file's mime type. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Required. The file's mime type. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Required. The file's byte contents. + * + * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Required. The file's byte contents. + * + * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * Required. The file's display name. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The file's display name. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php new file mode 100644 index 00000000000..6294ede95c7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsDestination.php @@ -0,0 +1,83 @@ +google.cloud.translation.v3.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_uri_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $output_uri_prefix + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputUriPrefix() + { + return $this->output_uri_prefix; + } + + /** + * Required. The bucket used in 'output_uri_prefix' must exist and there must + * be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with + * "/" and start with "gs://". One 'output_uri_prefix' can only be used by one + * batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error + * is returned. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputUriPrefix($var) + { + GPBUtil::checkString($var, True); + $this->output_uri_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsInputSource.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsInputSource.php new file mode 100644 index 00000000000..e4f5d74d11d --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsInputSource.php @@ -0,0 +1,67 @@ +google.cloud.translation.v3.GcsInputSource + */ +class GcsInputSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsOutputDestination.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsOutputDestination.php new file mode 100644 index 00000000000..81e9d86f307 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsOutputDestination.php @@ -0,0 +1,75 @@ +google.cloud.translation.v3.GcsOutputDestination + */ +class GcsOutputDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Google Cloud Storage URI to output directory. For example, + * `gs://bucket/directory`. The requesting user must have write permission to + * the bucket. The directory will be created if it doesn't exist. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_uri_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $output_uri_prefix + * Required. Google Cloud Storage URI to output directory. For example, + * `gs://bucket/directory`. The requesting user must have write permission to + * the bucket. The directory will be created if it doesn't exist. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. Google Cloud Storage URI to output directory. For example, + * `gs://bucket/directory`. The requesting user must have write permission to + * the bucket. The directory will be created if it doesn't exist. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOutputUriPrefix() + { + return $this->output_uri_prefix; + } + + /** + * Required. Google Cloud Storage URI to output directory. For example, + * `gs://bucket/directory`. The requesting user must have write permission to + * the bucket. The directory will be created if it doesn't exist. + * + * Generated from protobuf field string output_uri_prefix = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOutputUriPrefix($var) + { + GPBUtil::checkString($var, True); + $this->output_uri_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php new file mode 100644 index 00000000000..9dfda6fc818 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GcsSource.php @@ -0,0 +1,67 @@ +google.cloud.translation.v3.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Required. Source data URI. For example, `gs://my_bucket/my_object`. + * + * Generated from protobuf field string input_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtDatasetRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtDatasetRequest.php new file mode 100644 index 00000000000..4107de1639f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtDatasetRequest.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.GetAdaptiveMtDatasetRequest + */ +class GetAdaptiveMtDatasetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\GetAdaptiveMtDatasetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtFileRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtFileRequest.php new file mode 100644 index 00000000000..4020332cc0c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetAdaptiveMtFileRequest.php @@ -0,0 +1,86 @@ +google.cloud.translation.v3.GetAdaptiveMtFileRequest + */ +class GetAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\GetAdaptiveMtFileRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php new file mode 100644 index 00000000000..c4b68b01391 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetGlossaryRequest.php @@ -0,0 +1,81 @@ +google.cloud.translation.v3.GetGlossaryRequest + */ +class GetGlossaryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the glossary to retrieve. Please see + * {@see TranslationServiceClient::glossaryName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\GetGlossaryRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the glossary to retrieve. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the glossary to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php new file mode 100644 index 00000000000..86dc2cda5a3 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GetSupportedLanguagesRequest.php @@ -0,0 +1,247 @@ +google.cloud.translation.v3.GetSupportedLanguagesRequest + */ +class GetSupportedLanguagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $display_language_code = ''; + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + + /** + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for AutoML models. + * + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string $model Optional. Get supported languages of this model. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * @param string $displayLanguageCode Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * @return \Google\Cloud\Translate\V3\GetSupportedLanguagesRequest + * + * @experimental + */ + public static function build(string $parent, string $model, string $displayLanguageCode): self + { + return (new self()) + ->setParent($parent) + ->setModel($model) + ->setDisplayLanguageCode($displayLanguageCode); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $display_language_code + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @type string $model + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for AutoML models. + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayLanguageCode() + { + return $this->display_language_code; + } + + /** + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * + * Generated from protobuf field string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->display_language_code = $var; + + return $this; + } + + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. Get supported languages of this model. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * + * Generated from protobuf field string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php new file mode 100644 index 00000000000..dac3eb5708c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary.php @@ -0,0 +1,350 @@ +google.cloud.translation.v3.Glossary + */ +class Glossary extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + protected $input_config = null; + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $entry_count = 0; + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $submit_time = null; + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $display_name = ''; + protected $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $language_pair + * Used with unidirectional glossaries. + * @type \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $language_codes_set + * Used with equivalent term set glossaries. + * @type \Google\Cloud\Translate\V3\GlossaryInputConfig $input_config + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * @type int $entry_count + * Output only. The number of entries defined in the glossary. + * @type \Google\Protobuf\Timestamp $submit_time + * Output only. When CreateGlossary was called. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. When the glossary creation was finished. + * @type string $display_name + * Optional. The display name of the glossary. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the glossary. Glossary names have the form + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Used with unidirectional glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodePair|null + */ + public function getLanguagePair() + { + return $this->readOneof(3); + } + + public function hasLanguagePair() + { + return $this->hasOneof(3); + } + + /** + * Used with unidirectional glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodePair $var + * @return $this + */ + public function setLanguagePair($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodePair::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Used with equivalent term set glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + * @return \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet|null + */ + public function getLanguageCodesSet() + { + return $this->readOneof(4); + } + + public function hasLanguageCodesSet() + { + return $this->hasOneof(4); + } + + /** + * Used with equivalent term set glossaries. + * + * Generated from protobuf field .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + * @param \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet $var + * @return $this + */ + public function setLanguageCodesSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\Glossary\LanguageCodesSet::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + * @return \Google\Cloud\Translate\V3\GlossaryInputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Provides examples to build the glossary from. + * Total glossary must not exceed 10M Unicode codepoints. + * + * Generated from protobuf field .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + * @param \Google\Cloud\Translate\V3\GlossaryInputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GlossaryInputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEntryCount() + { + return $this->entry_count; + } + + /** + * Output only. The number of entries defined in the glossary. + * + * Generated from protobuf field int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEntryCount($var) + { + GPBUtil::checkInt32($var); + $this->entry_count = $var; + + return $this; + } + + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * Output only. When CreateGlossary was called. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. When the glossary creation was finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Optional. The display name of the glossary. + * + * Generated from protobuf field string display_name = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * @return string + */ + public function getLanguages() + { + return $this->whichOneof("languages"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php new file mode 100644 index 00000000000..4b228dd3f15 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodePair.php @@ -0,0 +1,112 @@ +google.cloud.translation.v3.Glossary.LanguageCodePair + */ +class LanguageCodePair extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + */ + protected $target_language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $source_language_code + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * @type string $target_language_code + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Required. The ISO-639 language code of the input text, for example, + * "en-US". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string source_language_code = 1; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code for translation output, for example, + * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field string target_language_code = 2; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LanguageCodePair::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodePair::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php new file mode 100644 index 00000000000..164d340406c --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Glossary/LanguageCodesSet.php @@ -0,0 +1,78 @@ +google.cloud.translation.v3.Glossary.LanguageCodesSet + */ +class LanguageCodesSet extends \Google\Protobuf\Internal\Message +{ + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field repeated string language_codes = 1; + */ + private $language_codes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_codes + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field repeated string language_codes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageCodes() + { + return $this->language_codes; + } + + /** + * The ISO-639 language code(s) for terms defined in the glossary. + * All entries are unique. The list contains at least two entries. + * Expected to be an exact match for GlossaryTerm.language_code. + * + * Generated from protobuf field repeated string language_codes = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_codes = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LanguageCodesSet::class, \Google\Cloud\Translate\V3\Glossary_LanguageCodesSet::class); + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php new file mode 100644 index 00000000000..a5800834223 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/GlossaryInputConfig.php @@ -0,0 +1,120 @@ +google.cloud.translation.v3.GlossaryInputConfig + */ +class GlossaryInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * Required. Google Cloud Storage location of glossary data. + * File format is determined based on the filename extension. API returns + * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + * formats. Wildcards are not allowed. This must be a single file in one of + * the following formats: + * For unidirectional glossaries: + * - TSV/CSV (`.tsv`/`.csv`): Two column file, tab- or comma-separated. + * The first column is source text. The second column is target text. + * No headers in this file. The first row contains data and not column + * names. + * - TMX (`.tmx`): TMX file with parallel data defining source/target term + * pairs. + * For equivalent term sets glossaries: + * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + * in multiple languages. See documentation for more information - + * [glossaries](https://cloud.google.com/translate/docs/advanced/glossary). + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 1; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileRequest.php new file mode 100644 index 00000000000..59bf3d43f5a --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileRequest.php @@ -0,0 +1,161 @@ +google.cloud.translation.v3.ImportAdaptiveMtFileRequest + */ +class ImportAdaptiveMtFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + protected $source; + + /** + * @param string $parent Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\ImportAdaptiveMtFileRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * @type \Google\Cloud\Translate\V3\FileInputSource $file_input_source + * Inline file source. + * @type \Google\Cloud\Translate\V3\GcsInputSource $gcs_input_source + * Google Cloud Storage file source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Inline file source. + * + * Generated from protobuf field .google.cloud.translation.v3.FileInputSource file_input_source = 2; + * @return \Google\Cloud\Translate\V3\FileInputSource|null + */ + public function getFileInputSource() + { + return $this->readOneof(2); + } + + public function hasFileInputSource() + { + return $this->hasOneof(2); + } + + /** + * Inline file source. + * + * Generated from protobuf field .google.cloud.translation.v3.FileInputSource file_input_source = 2; + * @param \Google\Cloud\Translate\V3\FileInputSource $var + * @return $this + */ + public function setFileInputSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\FileInputSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Google Cloud Storage file source. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsInputSource gcs_input_source = 3; + * @return \Google\Cloud\Translate\V3\GcsInputSource|null + */ + public function getGcsInputSource() + { + return $this->readOneof(3); + } + + public function hasGcsInputSource() + { + return $this->hasOneof(3); + } + + /** + * Google Cloud Storage file source. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsInputSource gcs_input_source = 3; + * @param \Google\Cloud\Translate\V3\GcsInputSource $var + * @return $this + */ + public function setGcsInputSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsInputSource::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileResponse.php new file mode 100644 index 00000000000..807aa40206d --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ImportAdaptiveMtFileResponse.php @@ -0,0 +1,77 @@ +google.cloud.translation.v3.ImportAdaptiveMtFileResponse + */ +class ImportAdaptiveMtFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Adaptive MT file that was imported. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $adaptive_mt_file = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\AdaptiveMtFile $adaptive_mt_file + * Output only. The Adaptive MT file that was imported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The Adaptive MT file that was imported. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Translate\V3\AdaptiveMtFile|null + */ + public function getAdaptiveMtFile() + { + return $this->adaptive_mt_file; + } + + public function hasAdaptiveMtFile() + { + return isset($this->adaptive_mt_file); + } + + public function clearAdaptiveMtFile() + { + unset($this->adaptive_mt_file); + } + + /** + * Output only. The Adaptive MT file that was imported. + * + * Generated from protobuf field .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_file = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Translate\V3\AdaptiveMtFile $var + * @return $this + */ + public function setAdaptiveMtFile($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\AdaptiveMtFile::class); + $this->adaptive_mt_file = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/InputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/InputConfig.php new file mode 100644 index 00000000000..ced50d3a94b --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/InputConfig.php @@ -0,0 +1,166 @@ +google.cloud.translation.v3.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mime_type + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * @type \Google\Cloud\Translate\V3\GcsSource $gcs_source + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. Can be "text/plain" or "text/html". + * For `.tsv`, "text/html" is used if mime_type is missing. + * For `.html`, this field must be "text/html" or empty. + * For `.txt`, this field must be "text/plain" or empty. + * + * Generated from protobuf field string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @return \Google\Cloud\Translate\V3\GcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(2); + } + + public function hasGcsSource() + { + return $this->hasOneof(2); + } + + /** + * Required. Google Cloud Storage location for the source input. + * This can be a single file (for example, + * `gs://translation-test/input.tsv`) or a wildcard (for example, + * `gs://translation-test/*`). If a file extension is `.tsv`, it can + * contain either one or two columns. The first column (optional) is the id + * of the text request. If the first column is missing, we use the row + * number (0-based) from the input file as the ID in the output file. The + * second column is the actual text to be + * translated. We recommend each row be <= 10K Unicode codepoints, + * otherwise an error might be returned. + * Note that the input tsv must be RFC 4180 compliant. + * You could use https://github.com/Clever/csvlint to check potential + * formatting errors in your tsv file. + * csvlint --delimiter='\t' your_input_file.tsv + * The other supported file extensions are `.txt` or `.html`, which is + * treated as a single large chunk of text. + * + * Generated from protobuf field .google.cloud.translation.v3.GcsSource gcs_source = 2; + * @param \Google\Cloud\Translate\V3\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsSource::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsRequest.php new file mode 100644 index 00000000000..d056833ac95 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsRequest.php @@ -0,0 +1,213 @@ +google.cloud.translation.v3.ListAdaptiveMtDatasetsRequest + */ +class ListAdaptiveMtDatasetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. The server may return fewer results than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtDatasetsResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtDatasets` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. An expression for filtering the results of the request. + * Filter is not supported yet. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * Please see {@see TranslationServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * @type int $page_size + * Optional. Requested page size. The server may return fewer results than + * requested. If unspecified, the server picks an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtDatasetsResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtDatasets` method. The first page is + * returned if `page_token`is empty or missing. + * @type string $filter + * Optional. An expression for filtering the results of the request. + * Filter is not supported yet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. The server may return fewer results than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. The server may return fewer results than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtDatasetsResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtDatasets` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtDatasetsResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtDatasets` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. An expression for filtering the results of the request. + * Filter is not supported yet. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. An expression for filtering the results of the request. + * Filter is not supported yet. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsResponse.php new file mode 100644 index 00000000000..6aa79680755 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtDatasetsResponse.php @@ -0,0 +1,109 @@ +google.cloud.translation.v3.ListAdaptiveMtDatasetsResponse + */ +class ListAdaptiveMtDatasetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. A list of Adaptive MT datasets. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $adaptive_mt_datasets; + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to + * `ListAdaptiveMtDatasets` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\AdaptiveMtDataset>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_datasets + * Output only. A list of Adaptive MT datasets. + * @type string $next_page_token + * Optional. A token to retrieve a page of results. Pass this value in the + * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to + * `ListAdaptiveMtDatasets` method to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A list of Adaptive MT datasets. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdaptiveMtDatasets() + { + return $this->adaptive_mt_datasets; + } + + /** + * Output only. A list of Adaptive MT datasets. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtDataset adaptive_mt_datasets = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Translate\V3\AdaptiveMtDataset>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdaptiveMtDatasets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtDataset::class); + $this->adaptive_mt_datasets = $arr; + + return $this; + } + + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to + * `ListAdaptiveMtDatasets` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * [ListAdaptiveMtDatasetsRequest.page_token] field in the subsequent call to + * `ListAdaptiveMtDatasets` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesRequest.php new file mode 100644 index 00000000000..414b8a8f221 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesRequest.php @@ -0,0 +1,175 @@ +google.cloud.translation.v3.ListAdaptiveMtFilesRequest + */ +class ListAdaptiveMtFilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtFilesResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtFiles` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * Please see {@see TranslationServiceClient::adaptiveMtDatasetName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\ListAdaptiveMtFilesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * @type int $page_size + * Optional. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtFilesResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtFiles` method. The first page is + * returned if `page_token`is empty or missing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtFilesResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtFiles` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtFilesResponse.next_page_token returned from the + * previous call to `ListAdaptiveMtFiles` method. The first page is + * returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesResponse.php new file mode 100644 index 00000000000..8f62be3dc15 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtFilesResponse.php @@ -0,0 +1,109 @@ +google.cloud.translation.v3.ListAdaptiveMtFilesResponse + */ +class ListAdaptiveMtFilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Adaptive MT files. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $adaptive_mt_files; + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to + * `ListAdaptiveMtFiles` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\AdaptiveMtFile>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_files + * Output only. The Adaptive MT files. + * @type string $next_page_token + * Optional. A token to retrieve a page of results. Pass this value in the + * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to + * `ListAdaptiveMtFiles` method to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The Adaptive MT files. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdaptiveMtFiles() + { + return $this->adaptive_mt_files; + } + + /** + * Output only. The Adaptive MT files. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtFile adaptive_mt_files = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Translate\V3\AdaptiveMtFile>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdaptiveMtFiles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtFile::class); + $this->adaptive_mt_files = $arr; + + return $this; + } + + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to + * `ListAdaptiveMtFiles` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. A token to retrieve a page of results. Pass this value in the + * ListAdaptiveMtFilesRequest.page_token field in the subsequent call to + * `ListAdaptiveMtFiles` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesRequest.php new file mode 100644 index 00000000000..dc0a5b6eca6 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesRequest.php @@ -0,0 +1,178 @@ +google.cloud.translation.v3.ListAdaptiveMtSentencesRequest + */ +class ListAdaptiveMtSentencesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtSentencesRequest.next_page_token returned from the + * previous call to `ListTranslationMemories` method. The first page is + * returned if `page_token` is empty or missing. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * Please see {@see TranslationServiceClient::adaptiveMtFileName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\ListAdaptiveMtSentencesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * @type int $page_size + * @type string $page_token + * A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtSentencesRequest.next_page_token returned from the + * previous call to `ListTranslationMemories` method. The first page is + * returned if `page_token` is empty or missing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtSentencesRequest.next_page_token returned from the + * previous call to `ListTranslationMemories` method. The first page is + * returned if `page_token` is empty or missing. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * Typically, this is the value of + * ListAdaptiveMtSentencesRequest.next_page_token returned from the + * previous call to `ListTranslationMemories` method. The first page is + * returned if `page_token` is empty or missing. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesResponse.php new file mode 100644 index 00000000000..86d22bc4b9e --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListAdaptiveMtSentencesResponse.php @@ -0,0 +1,101 @@ +google.cloud.translation.v3.ListAdaptiveMtSentencesResponse + */ +class ListAdaptiveMtSentencesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of AdaptiveMtSentences. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $adaptive_mt_sentences; + /** + * Optional. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\AdaptiveMtSentence>|\Google\Protobuf\Internal\RepeatedField $adaptive_mt_sentences + * Output only. The list of AdaptiveMtSentences. + * @type string $next_page_token + * Optional. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\AdaptiveMt::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of AdaptiveMtSentences. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdaptiveMtSentences() + { + return $this->adaptive_mt_sentences; + } + + /** + * Output only. The list of AdaptiveMtSentences. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.AdaptiveMtSentence adaptive_mt_sentences = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Translate\V3\AdaptiveMtSentence>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdaptiveMtSentences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\AdaptiveMtSentence::class); + $this->adaptive_mt_sentences = $arr; + + return $this; + } + + /** + * Optional. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php new file mode 100644 index 00000000000..732d892af97 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesRequest.php @@ -0,0 +1,259 @@ +google.cloud.translation.v3.ListGlossariesRequest + */ +class ListGlossariesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The name of the project from which to list all of the glossaries. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Translate\V3\ListGlossariesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project from which to list all of the glossaries. + * @type int $page_size + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * @type string $page_token + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * @type string $filter + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project from which to list all of the glossaries. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. The server may return fewer glossaries than + * requested. If unspecified, the server picks an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A token identifying a page of results the server should return. + * Typically, this is the value of [ListGlossariesResponse.next_page_token] + * returned from the previous call to `ListGlossaries` method. + * The first page is returned if `page_token`is empty or missing. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php new file mode 100644 index 00000000000..4671da068fa --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/ListGlossariesResponse.php @@ -0,0 +1,109 @@ +google.cloud.translation.v3.ListGlossariesResponse + */ +class ListGlossariesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + private $glossaries; + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $glossaries + * The list of glossaries for a project. + * @type string $next_page_token + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGlossaries() + { + return $this->glossaries; + } + + /** + * The list of glossaries for a project. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Glossary glossaries = 1; + * @param array<\Google\Cloud\Translate\V3\Glossary>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGlossaries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Glossary::class); + $this->glossaries = $arr; + + return $this; + } + + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token to retrieve a page of results. Pass this value in the + * [ListGlossariesRequest.page_token] field in the subsequent call to + * `ListGlossaries` method to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php new file mode 100644 index 00000000000..700e6192786 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/OutputConfig.php @@ -0,0 +1,249 @@ +google.cloud.translation.v3.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\GcsDestination $gcs_destination + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` + * The format of errors file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_errors.[extension]` + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` + * The format of errors file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_errors.[extension]` + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]` + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Translate\V3\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(1); + } + + public function hasGcsDestination() + { + return $this->hasOneof(1); + } + + /** + * Google Cloud Storage destination for output content. + * For every single input file (for example, gs://a/b/c.[extension]), we + * generate at most 2 * n output files. (n is the # of target_language_codes + * in the BatchTranslateTextRequest). + * Output files (tsv) generated are compliant with RFC 4180 except that + * record delimiters are '\n' instead of '\r\n'. We don't provide any way to + * change record delimiters. + * While the input files are being processed, we write/update an index file + * 'index.csv' under 'output_uri_prefix' (for example, + * gs://translation-test/index.csv) The index file is generated/updated as + * new files are being translated. The format is: + * input_file,target_language_code,translations_file,errors_file, + * glossary_translations_file,glossary_errors_file + * input_file is one file we matched using gcs_source.input_uri. + * target_language_code is provided in the request. + * translations_file contains the translations. (details provided below) + * errors_file contains the errors during processing of the file. (details + * below). Both translations_file and errors_file could be empty + * strings if we have no content to output. + * glossary_translations_file and glossary_errors_file are always empty + * strings if the input_file is tsv. They could also be empty if we have no + * content to output. + * Once a row is present in index.csv, the input/output matching never + * changes. Callers should also expect all the content in input_file are + * processed and ready to be consumed (that is, no partial output file is + * written). + * Since index.csv will be keeping updated during the process, please make + * sure there is no custom retention policy applied on the output bucket + * that may avoid file updating. + * (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) + * The format of translations_file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_translations.[extension]` + * If the input file extension is tsv, the output has the following + * columns: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: translation without applying a glossary. Empty string if there + * is an error. + * Column 4 (only present if a glossary is provided in the request): + * translation after applying the glossary. Empty string if there is an + * error applying the glossary. Could be same string as column 3 if there is + * no glossary applied. + * If input file extension is a txt or html, the translation is directly + * written to the output file. If glossary is requested, a separate + * glossary_translations_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` + * The format of errors file (for target language code 'trg') is: + * `gs://translation_test/a_b_c_'trg'_errors.[extension]` + * If the input file extension is tsv, errors_file contains the following: + * Column 1: ID of the request provided in the input, if it's not + * provided in the input, then the input row number is used (0-based). + * Column 2: source sentence. + * Column 3: Error detail for the translation. Could be empty. + * Column 4 (only present if a glossary is provided in the request): + * Error when applying the glossary. + * If the input file extension is txt or html, glossary_error_file will be + * generated that contains error details. glossary_error_file has format of + * `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]` + * + * Generated from protobuf field .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Translate\V3\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\GcsDestination::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php new file mode 100644 index 00000000000..cfb8756c2c1 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguage.php @@ -0,0 +1,186 @@ +google.cloud.translation.v3.SupportedLanguage + */ +class SupportedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + */ + protected $support_source = false; + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + */ + protected $support_target = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * @type string $display_name + * Human-readable name of the language localized in the display language + * specified in the request. + * @type bool $support_source + * Can be used as a source language. + * @type bool $support_target + * Can be used as a target language. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Supported language code, generally consisting of its ISO 639-1 + * identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes + * including language and region identifiers are returned (for example, + * 'zh-TW' and 'zh-CN'). + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Human-readable name of the language localized in the display language + * specified in the request. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + * @return bool + */ + public function getSupportSource() + { + return $this->support_source; + } + + /** + * Can be used as a source language. + * + * Generated from protobuf field bool support_source = 3; + * @param bool $var + * @return $this + */ + public function setSupportSource($var) + { + GPBUtil::checkBool($var); + $this->support_source = $var; + + return $this; + } + + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + * @return bool + */ + public function getSupportTarget() + { + return $this->support_target; + } + + /** + * Can be used as a target language. + * + * Generated from protobuf field bool support_target = 4; + * @param bool $var + * @return $this + */ + public function setSupportTarget($var) + { + GPBUtil::checkBool($var); + $this->support_target = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php new file mode 100644 index 00000000000..1bfb36123e5 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/SupportedLanguages.php @@ -0,0 +1,71 @@ +google.cloud.translation.v3.SupportedLanguages + */ +class SupportedLanguages extends \Google\Protobuf\Internal\Message +{ + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + private $languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $languages + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguages() + { + return $this->languages; + } + + /** + * A list of supported language responses. This list contains an entry + * for each language the Translation API supports. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + * @param array<\Google\Cloud\Translate\V3\SupportedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\SupportedLanguage::class); + $this->languages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php new file mode 100644 index 00000000000..ed1a08a279b --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentRequest.php @@ -0,0 +1,631 @@ +google.cloud.translation.v3.TranslateDocumentRequest + */ +class TranslateDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_language_code = ''; + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $document_input_config = null; + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $document_output_config = null; + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $glossary_config = null; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $customized_attribution = ''; + /** + * Optional. is_translate_native_pdf_only field for external customers. + * If true, the page limit of online native pdf translation is 300 and only + * native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $is_translate_native_pdf_only = false; + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_shadow_removal_native_pdf = false; + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_rotation_correction = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $source_language_code + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @type string $target_language_code + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @type \Google\Cloud\Translate\V3\DocumentInputConfig $document_input_config + * Required. Input configurations. + * @type \Google\Cloud\Translate\V3\DocumentOutputConfig $document_output_config + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @type string $model + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @type string $customized_attribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $is_translate_native_pdf_only + * Optional. is_translate_native_pdf_only field for external customers. + * If true, the page limit of online native pdf translation is 300 and only + * native pdf pages will be translated. + * @type bool $enable_shadow_removal_native_pdf + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * @type bool $enable_rotation_correction + * Optional. If true, enable auto rotation correction in DVS. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Location to make a regional call. + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * + * Generated from protobuf field string source_language_code = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Translate\V3\DocumentInputConfig|null + */ + public function getDocumentInputConfig() + { + return $this->document_input_config; + } + + public function hasDocumentInputConfig() + { + return isset($this->document_input_config); + } + + public function clearDocumentInputConfig() + { + unset($this->document_input_config); + } + + /** + * Required. Input configurations. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentInputConfig document_input_config = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Translate\V3\DocumentInputConfig $var + * @return $this + */ + public function setDocumentInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentInputConfig::class); + $this->document_input_config = $var; + + return $this; + } + + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\DocumentOutputConfig|null + */ + public function getDocumentOutputConfig() + { + return $this->document_output_config; + } + + public function hasDocumentOutputConfig() + { + return isset($this->document_output_config); + } + + public function clearDocumentOutputConfig() + { + unset($this->document_output_config); + } + + /** + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentOutputConfig document_output_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\DocumentOutputConfig $var + * @return $this + */ + public function setDocumentOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentOutputConfig::class); + $this->document_output_config = $var; + + return $this; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * If not provided, the default Google model (NMT) will be used for + * translation. + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCustomizedAttribution() + { + return $this->customized_attribution; + } + + /** + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * + * Generated from protobuf field string customized_attribution = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCustomizedAttribution($var) + { + GPBUtil::checkString($var, True); + $this->customized_attribution = $var; + + return $this; + } + + /** + * Optional. is_translate_native_pdf_only field for external customers. + * If true, the page limit of online native pdf translation is 300 and only + * native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIsTranslateNativePdfOnly() + { + return $this->is_translate_native_pdf_only; + } + + /** + * Optional. is_translate_native_pdf_only field for external customers. + * If true, the page limit of online native pdf translation is 300 and only + * native pdf pages will be translated. + * + * Generated from protobuf field bool is_translate_native_pdf_only = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIsTranslateNativePdfOnly($var) + { + GPBUtil::checkBool($var); + $this->is_translate_native_pdf_only = $var; + + return $this; + } + + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableShadowRemovalNativePdf() + { + return $this->enable_shadow_removal_native_pdf; + } + + /** + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * + * Generated from protobuf field bool enable_shadow_removal_native_pdf = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableShadowRemovalNativePdf($var) + { + GPBUtil::checkBool($var); + $this->enable_shadow_removal_native_pdf = $var; + + return $this; + } + + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableRotationCorrection() + { + return $this->enable_rotation_correction; + } + + /** + * Optional. If true, enable auto rotation correction in DVS. + * + * Generated from protobuf field bool enable_rotation_correction = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableRotationCorrection($var) + { + GPBUtil::checkBool($var); + $this->enable_rotation_correction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php new file mode 100644 index 00000000000..cb03652f953 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateDocumentResponse.php @@ -0,0 +1,231 @@ +google.cloud.translation.v3.TranslateDocumentResponse + */ +class TranslateDocumentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + */ + protected $document_translation = null; + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + */ + protected $glossary_document_translation = null; + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + */ + protected $model = ''; + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + */ + protected $glossary_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Translate\V3\DocumentTranslation $document_translation + * Translated document. + * @type \Google\Cloud\Translate\V3\DocumentTranslation $glossary_document_translation + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * @type string $model + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * The `glossary_config` used for this translation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + * @return \Google\Cloud\Translate\V3\DocumentTranslation|null + */ + public function getDocumentTranslation() + { + return $this->document_translation; + } + + public function hasDocumentTranslation() + { + return isset($this->document_translation); + } + + public function clearDocumentTranslation() + { + unset($this->document_translation); + } + + /** + * Translated document. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation document_translation = 1; + * @param \Google\Cloud\Translate\V3\DocumentTranslation $var + * @return $this + */ + public function setDocumentTranslation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); + $this->document_translation = $var; + + return $this; + } + + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + * @return \Google\Cloud\Translate\V3\DocumentTranslation|null + */ + public function getGlossaryDocumentTranslation() + { + return $this->glossary_document_translation; + } + + public function hasGlossaryDocumentTranslation() + { + return isset($this->glossary_document_translation); + } + + public function clearGlossaryDocumentTranslation() + { + unset($this->glossary_document_translation); + } + + /** + * The document's translation output if a glossary is provided in the request. + * This can be the same as [TranslateDocumentResponse.document_translation] + * if no glossary terms apply. + * + * Generated from protobuf field .google.cloud.translation.v3.DocumentTranslation glossary_document_translation = 2; + * @param \Google\Cloud\Translate\V3\DocumentTranslation $var + * @return $this + */ + public function setGlossaryDocumentTranslation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\DocumentTranslation::class); + $this->glossary_document_translation = $var; + + return $this; + } + + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Only present when 'model' is present in the request. + * 'model' is normalized to have a project number. + * For example: + * If the 'model' field in TranslateDocumentRequest is: + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 4; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php new file mode 100644 index 00000000000..824b69570de --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextGlossaryConfig.php @@ -0,0 +1,118 @@ +google.cloud.translation.v3.TranslateTextGlossaryConfig + */ +class TranslateTextGlossaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $glossary = ''; + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ignore_case = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $glossary + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * @type bool $ignore_case + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGlossary() + { + return $this->glossary; + } + + /** + * Required. The `glossary` to be applied for this translation. + * The format depends on the glossary: + * - User-provided custom glossary: + * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}` + * + * Generated from protobuf field string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGlossary($var) + { + GPBUtil::checkString($var, True); + $this->glossary = $var; + + return $this; + } + + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIgnoreCase() + { + return $this->ignore_case; + } + + /** + * Optional. Indicates match is case insensitive. The default value is `false` + * if missing. + * + * Generated from protobuf field bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIgnoreCase($var) + { + GPBUtil::checkBool($var); + $this->ignore_case = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php new file mode 100644 index 00000000000..2ed587b9d2f --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextRequest.php @@ -0,0 +1,545 @@ +google.cloud.translation.v3.TranslateTextRequest + */ +class TranslateTextRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $contents; + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mime_type = ''; + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $source_language_code = ''; + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_language_code = ''; + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $glossary_config = null; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param string[] $contents Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * @return \Google\Cloud\Translate\V3\TranslateTextRequest + * + * @experimental + */ + public static function build(string $parent, string $targetLanguageCode, array $contents): self + { + return (new self()) + ->setParent($parent) + ->setTargetLanguageCode($targetLanguageCode) + ->setContents($contents); + } + + /** + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. Please see + * {@see TranslationServiceClient::locationName()} for help formatting this field. + * @param string $model Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * + * If not provided, the default Google model (NMT) will be used + * @param string $mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param string $sourceLanguageCode Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param string[] $contents Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * @return \Google\Cloud\Translate\V3\TranslateTextRequest + * + * @experimental + */ + public static function buildFromParentModelMimeTypeSourceLanguageCodeTargetLanguageCodeContents(string $parent, string $model, string $mimeType, string $sourceLanguageCode, string $targetLanguageCode, array $contents): self + { + return (new self()) + ->setParent($parent) + ->setModel($model) + ->setMimeType($mimeType) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCode($targetLanguageCode) + ->setContents($contents); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $contents + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @type string $mime_type + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type string $source_language_code + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @type string $target_language_code + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @type string $parent + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @type string $model + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContents() + { + return $this->contents; + } + + /** + * Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * + * Generated from protobuf field repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->contents = $arr; + + return $this; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * + * Generated from protobuf field string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSourceLanguageCode() + { + return $this->source_language_code; + } + + /** + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * + * Generated from protobuf field string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSourceLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->source_language_code = $var; + + return $this; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetLanguageCode() + { + return $this->target_language_code; + } + + /** + * Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * + * Generated from protobuf field string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->target_language_code = $var; + + return $this; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project or location to make a call. Must refer to a caller's + * project. + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The `model` type requested for this translation. + * The format depends on model type: + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * If not provided, the default Google model (NMT) will be used + * + * Generated from protobuf field string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * + * Generated from protobuf field map labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php new file mode 100644 index 00000000000..421453b6959 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/TranslateTextResponse.php @@ -0,0 +1,123 @@ +google.cloud.translation.v3.TranslateTextResponse + */ +class TranslateTextResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + */ + private $translations; + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + private $glossary_translations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $translations + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * @type array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $glossary_translations + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTranslations() + { + return $this->translations; + } + + /** + * Text translation responses with no glossary applied. + * This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation translations = 1; + * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTranslations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); + $this->translations = $arr; + + return $this; + } + + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGlossaryTranslations() + { + return $this->glossary_translations; + } + + /** + * Text translation responses if a glossary is provided in the request. + * This can be the same as + * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + * if no terms apply. This field has the same length as + * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + * + * Generated from protobuf field repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + * @param array<\Google\Cloud\Translate\V3\Translation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGlossaryTranslations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Translate\V3\Translation::class); + $this->glossary_translations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php new file mode 100644 index 00000000000..f57fa9baac7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/proto/src/Google/Cloud/Translate/V3/Translation.php @@ -0,0 +1,223 @@ +google.cloud.translation.v3.Translation + */ +class Translation extends \Google\Protobuf\Internal\Message +{ + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + */ + protected $translated_text = ''; + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + */ + protected $model = ''; + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + */ + protected $detected_language_code = ''; + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + protected $glossary_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $translated_text + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * @type string $model + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * @type string $detected_language_code + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * @type \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $glossary_config + * The `glossary_config` used for this translation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Translate\V3\TranslationService::initOnce(); + parent::__construct($data); + } + + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + * @return string + */ + public function getTranslatedText() + { + return $this->translated_text; + } + + /** + * Text translated into the target language. + * If an error occurs during translation, this field might be excluded from + * the response. + * + * Generated from protobuf field string translated_text = 1; + * @param string $var + * @return $this + */ + public function setTranslatedText($var) + { + GPBUtil::checkString($var, True); + $this->translated_text = $var; + + return $this; + } + + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Only present when `model` is present in the request. + * `model` here is normalized to have project number. + * For example: + * If the `model` requested in TranslationTextRequest is + * `projects/{project-id}/locations/{location-id}/models/general/nmt` then + * `model` here would be normalized to + * `projects/{project-number}/locations/{location-id}/models/general/nmt`. + * + * Generated from protobuf field string model = 2; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + * @return string + */ + public function getDetectedLanguageCode() + { + return $this->detected_language_code; + } + + /** + * The ISO-639 language code of source text in the initial request, detected + * automatically, if no source language was passed within the initial + * request. If the source language was passed, auto-detection of the language + * does not occur and this field is empty. + * + * Generated from protobuf field string detected_language_code = 4; + * @param string $var + * @return $this + */ + public function setDetectedLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->detected_language_code = $var; + + return $this; + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + * @return \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig|null + */ + public function getGlossaryConfig() + { + return $this->glossary_config; + } + + public function hasGlossaryConfig() + { + return isset($this->glossary_config); + } + + public function clearGlossaryConfig() + { + unset($this->glossary_config); + } + + /** + * The `glossary_config` used for this translation. + * + * Generated from protobuf field .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + * @param \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig $var + * @return $this + */ + public function setGlossaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Translate\V3\TranslateTextGlossaryConfig::class); + $this->glossary_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/adaptive_mt_translate.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/adaptive_mt_translate.php new file mode 100644 index 00000000000..54f4b51c800 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/adaptive_mt_translate.php @@ -0,0 +1,90 @@ +setParent($formattedParent) + ->setDataset($formattedDataset) + ->setContent($content); + + // Call the API and handle any network failures. + try { + /** @var AdaptiveMtTranslateResponse $response */ + $response = $translationServiceClient->adaptiveMtTranslate($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + $contentElement = '[CONTENT]'; + + adaptive_mt_translate_sample($formattedParent, $formattedDataset, $contentElement); +} +// [END translate_v3_generated_TranslationService_AdaptiveMtTranslate_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php new file mode 100644 index 00000000000..7d14ea9bc11 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_document.php @@ -0,0 +1,116 @@ +setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $translationServiceClient->batchTranslateDocument($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchTranslateDocumentResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; + $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; + + batch_translate_document_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); +} +// [END translate_v3_generated_TranslationService_BatchTranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php new file mode 100644 index 00000000000..17f600ae7a2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/batch_translate_text.php @@ -0,0 +1,113 @@ +setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $translationServiceClient->batchTranslateText($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchTranslateResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = '[SOURCE_LANGUAGE_CODE]'; + $targetLanguageCodesElement = '[TARGET_LANGUAGE_CODES]'; + + batch_translate_text_sample($formattedParent, $sourceLanguageCode, $targetLanguageCodesElement); +} +// [END translate_v3_generated_TranslationService_BatchTranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php new file mode 100644 index 00000000000..98a77eeaf05 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php @@ -0,0 +1,85 @@ +setName($formattedAdaptiveMtDatasetName); + $request = (new CreateAdaptiveMtDatasetRequest()) + ->setParent($formattedParent) + ->setAdaptiveMtDataset($adaptiveMtDataset); + + // Call the API and handle any network failures. + try { + /** @var AdaptiveMtDataset $response */ + $response = $translationServiceClient->createAdaptiveMtDataset($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $formattedAdaptiveMtDatasetName = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + + create_adaptive_mt_dataset_sample($formattedParent, $formattedAdaptiveMtDatasetName); +} +// [END translate_v3_generated_TranslationService_CreateAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php new file mode 100644 index 00000000000..c6779a21048 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/create_glossary.php @@ -0,0 +1,90 @@ +setName($glossaryName); + $request = (new CreateGlossaryRequest()) + ->setParent($formattedParent) + ->setGlossary($glossary); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $translationServiceClient->createGlossary($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Glossary $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $glossaryName = '[NAME]'; + + create_glossary_sample($formattedParent, $glossaryName); +} +// [END translate_v3_generated_TranslationService_CreateGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php new file mode 100644 index 00000000000..5a4e58077d9 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $translationServiceClient->deleteAdaptiveMtDataset($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + + delete_adaptive_mt_dataset_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_DeleteAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php new file mode 100644 index 00000000000..83d86f0d855 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $translationServiceClient->deleteAdaptiveMtFile($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::adaptiveMtFileName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]', + '[FILE]' + ); + + delete_adaptive_mt_file_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_DeleteAdaptiveMtFile_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php new file mode 100644 index 00000000000..00eecc23383 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/delete_glossary.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $translationServiceClient->deleteGlossary($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeleteGlossaryResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + + delete_glossary_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_DeleteGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php new file mode 100644 index 00000000000..20caef711ee --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/detect_language.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var DetectLanguageResponse $response */ + $response = $translationServiceClient->detectLanguage($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + detect_language_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_DetectLanguage_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php new file mode 100644 index 00000000000..053180b3888 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AdaptiveMtDataset $response */ + $response = $translationServiceClient->getAdaptiveMtDataset($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + + get_adaptive_mt_dataset_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_GetAdaptiveMtDataset_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php new file mode 100644 index 00000000000..1e9347c3121 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_adaptive_mt_file.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var AdaptiveMtFile $response */ + $response = $translationServiceClient->getAdaptiveMtFile($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::adaptiveMtFileName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]', + '[FILE]' + ); + + get_adaptive_mt_file_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_GetAdaptiveMtFile_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php new file mode 100644 index 00000000000..5f2c564c7f2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_glossary.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Glossary $response */ + $response = $translationServiceClient->getGlossary($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranslationServiceClient::glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + + get_glossary_sample($formattedName); +} +// [END translate_v3_generated_TranslationService_GetGlossary_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php new file mode 100644 index 00000000000..d7e7c8b08c4 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/get_supported_languages.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var SupportedLanguages $response */ + $response = $translationServiceClient->getSupportedLanguages($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + get_supported_languages_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_GetSupportedLanguages_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php new file mode 100644 index 00000000000..2e0dfadb8f7 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/import_adaptive_mt_file.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var ImportAdaptiveMtFileResponse $response */ + $response = $translationServiceClient->importAdaptiveMtFile($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + + import_adaptive_mt_file_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ImportAdaptiveMtFile_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php new file mode 100644 index 00000000000..51627d5ae77 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $translationServiceClient->listAdaptiveMtDatasets($request); + + /** @var AdaptiveMtDataset $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_adaptive_mt_datasets_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ListAdaptiveMtDatasets_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php new file mode 100644 index 00000000000..4653eb47c8d --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_files.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $translationServiceClient->listAdaptiveMtFiles($request); + + /** @var AdaptiveMtFile $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::adaptiveMtDatasetName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]' + ); + + list_adaptive_mt_files_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ListAdaptiveMtFiles_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php new file mode 100644 index 00000000000..d0ee81cae69 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $translationServiceClient->listAdaptiveMtSentences($request); + + /** @var AdaptiveMtSentence $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::adaptiveMtFileName( + '[PROJECT]', + '[LOCATION]', + '[DATASET]', + '[FILE]' + ); + + list_adaptive_mt_sentences_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ListAdaptiveMtSentences_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php new file mode 100644 index 00000000000..62ea546ca19 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/list_glossaries.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $translationServiceClient->listGlossaries($request); + + /** @var Glossary $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_glossaries_sample($formattedParent); +} +// [END translate_v3_generated_TranslationService_ListGlossaries_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php new file mode 100644 index 00000000000..977188613c2 --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_document.php @@ -0,0 +1,88 @@ +setParent($parent) + ->setTargetLanguageCode($targetLanguageCode) + ->setDocumentInputConfig($documentInputConfig); + + // Call the API and handle any network failures. + try { + /** @var TranslateDocumentResponse $response */ + $response = $translationServiceClient->translateDocument($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; + + translate_document_sample($parent, $targetLanguageCode); +} +// [END translate_v3_generated_TranslationService_TranslateDocument_sync] diff --git a/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php new file mode 100644 index 00000000000..95af91345fb --- /dev/null +++ b/owl-bot-staging/Translate/v3/samples/V3/TranslationServiceClient/translate_text.php @@ -0,0 +1,97 @@ +setContents($contents) + ->setTargetLanguageCode($targetLanguageCode) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var TranslateTextResponse $response */ + $response = $translationServiceClient->translateText($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $contentsElement = '[CONTENTS]'; + $targetLanguageCode = '[TARGET_LANGUAGE_CODE]'; + $formattedParent = TranslationServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + translate_text_sample($contentsElement, $targetLanguageCode, $formattedParent); +} +// [END translate_v3_generated_TranslationService_TranslateText_sync] diff --git a/owl-bot-staging/Translate/v3/src/V3/Client/TranslationServiceClient.php b/owl-bot-staging/Translate/v3/src/V3/Client/TranslationServiceClient.php new file mode 100644 index 00000000000..09d078952c5 --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/Client/TranslationServiceClient.php @@ -0,0 +1,903 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/translation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/translation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/translation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/translation_service_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * adaptive_mt_dataset resource. + * + * @param string $project + * @param string $location + * @param string $dataset + * + * @return string The formatted adaptive_mt_dataset resource. + */ + public static function adaptiveMtDatasetName(string $project, string $location, string $dataset): string + { + return self::getPathTemplate('adaptiveMtDataset')->render([ + 'project' => $project, + 'location' => $location, + 'dataset' => $dataset, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * adaptive_mt_file resource. + * + * @param string $project + * @param string $location + * @param string $dataset + * @param string $file + * + * @return string The formatted adaptive_mt_file resource. + */ + public static function adaptiveMtFileName(string $project, string $location, string $dataset, string $file): string + { + return self::getPathTemplate('adaptiveMtFile')->render([ + 'project' => $project, + 'location' => $location, + 'dataset' => $dataset, + 'file' => $file, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a glossary + * resource. + * + * @param string $project + * @param string $location + * @param string $glossary + * + * @return string The formatted glossary resource. + */ + public static function glossaryName(string $project, string $location, string $glossary): string + { + return self::getPathTemplate('glossary')->render([ + 'project' => $project, + 'location' => $location, + 'glossary' => $glossary, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - adaptiveMtDataset: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset} + * - adaptiveMtFile: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file} + * - glossary: projects/{project}/locations/{location}/glossaries/{glossary} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'translate.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Translate text using Adaptive MT. + * + * The async variant is {@see TranslationServiceClient::adaptiveMtTranslateAsync()} + * . + * + * @example samples/V3/TranslationServiceClient/adaptive_mt_translate.php + * + * @param AdaptiveMtTranslateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 AdaptiveMtTranslateResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function adaptiveMtTranslate(AdaptiveMtTranslateRequest $request, array $callOptions = []): AdaptiveMtTranslateResponse + { + return $this->startApiCall('AdaptiveMtTranslate', $request, $callOptions)->wait(); + } + + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * The async variant is + * {@see TranslationServiceClient::batchTranslateDocumentAsync()} . + * + * @example samples/V3/TranslationServiceClient/batch_translate_document.php + * + * @param BatchTranslateDocumentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchTranslateDocument(BatchTranslateDocumentRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('BatchTranslateDocument', $request, $callOptions)->wait(); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * + * The async variant is {@see TranslationServiceClient::batchTranslateTextAsync()} + * . + * + * @example samples/V3/TranslationServiceClient/batch_translate_text.php + * + * @param BatchTranslateTextRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchTranslateText(BatchTranslateTextRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('BatchTranslateText', $request, $callOptions)->wait(); + } + + /** + * Creates an Adaptive MT dataset. + * + * The async variant is + * {@see TranslationServiceClient::createAdaptiveMtDatasetAsync()} . + * + * @example samples/V3/TranslationServiceClient/create_adaptive_mt_dataset.php + * + * @param CreateAdaptiveMtDatasetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 AdaptiveMtDataset + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest $request, array $callOptions = []): AdaptiveMtDataset + { + return $this->startApiCall('CreateAdaptiveMtDataset', $request, $callOptions)->wait(); + } + + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * + * The async variant is {@see TranslationServiceClient::createGlossaryAsync()} . + * + * @example samples/V3/TranslationServiceClient/create_glossary.php + * + * @param CreateGlossaryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createGlossary(CreateGlossaryRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateGlossary', $request, $callOptions)->wait(); + } + + /** + * Deletes an Adaptive MT dataset, including all its entries and associated + * metadata. + * + * The async variant is + * {@see TranslationServiceClient::deleteAdaptiveMtDatasetAsync()} . + * + * @example samples/V3/TranslationServiceClient/delete_adaptive_mt_dataset.php + * + * @param DeleteAdaptiveMtDatasetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteAdaptiveMtDataset', $request, $callOptions)->wait(); + } + + /** + * Deletes an AdaptiveMtFile along with its sentences. + * + * The async variant is + * {@see TranslationServiceClient::deleteAdaptiveMtFileAsync()} . + * + * @example samples/V3/TranslationServiceClient/delete_adaptive_mt_file.php + * + * @param DeleteAdaptiveMtFileRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteAdaptiveMtFile', $request, $callOptions)->wait(); + } + + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * + * The async variant is {@see TranslationServiceClient::deleteGlossaryAsync()} . + * + * @example samples/V3/TranslationServiceClient/delete_glossary.php + * + * @param DeleteGlossaryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteGlossary(DeleteGlossaryRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteGlossary', $request, $callOptions)->wait(); + } + + /** + * Detects the language of text within a request. + * + * The async variant is {@see TranslationServiceClient::detectLanguageAsync()} . + * + * @example samples/V3/TranslationServiceClient/detect_language.php + * + * @param DetectLanguageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 DetectLanguageResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function detectLanguage(DetectLanguageRequest $request, array $callOptions = []): DetectLanguageResponse + { + return $this->startApiCall('DetectLanguage', $request, $callOptions)->wait(); + } + + /** + * Gets the Adaptive MT dataset. + * + * The async variant is + * {@see TranslationServiceClient::getAdaptiveMtDatasetAsync()} . + * + * @example samples/V3/TranslationServiceClient/get_adaptive_mt_dataset.php + * + * @param GetAdaptiveMtDatasetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 AdaptiveMtDataset + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest $request, array $callOptions = []): AdaptiveMtDataset + { + return $this->startApiCall('GetAdaptiveMtDataset', $request, $callOptions)->wait(); + } + + /** + * Gets and AdaptiveMtFile + * + * The async variant is {@see TranslationServiceClient::getAdaptiveMtFileAsync()} . + * + * @example samples/V3/TranslationServiceClient/get_adaptive_mt_file.php + * + * @param GetAdaptiveMtFileRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 AdaptiveMtFile + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAdaptiveMtFile(GetAdaptiveMtFileRequest $request, array $callOptions = []): AdaptiveMtFile + { + return $this->startApiCall('GetAdaptiveMtFile', $request, $callOptions)->wait(); + } + + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * + * The async variant is {@see TranslationServiceClient::getGlossaryAsync()} . + * + * @example samples/V3/TranslationServiceClient/get_glossary.php + * + * @param GetGlossaryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Glossary + * + * @throws ApiException Thrown if the API call fails. + */ + public function getGlossary(GetGlossaryRequest $request, array $callOptions = []): Glossary + { + return $this->startApiCall('GetGlossary', $request, $callOptions)->wait(); + } + + /** + * Returns a list of supported languages for translation. + * + * The async variant is + * {@see TranslationServiceClient::getSupportedLanguagesAsync()} . + * + * @example samples/V3/TranslationServiceClient/get_supported_languages.php + * + * @param GetSupportedLanguagesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 SupportedLanguages + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSupportedLanguages(GetSupportedLanguagesRequest $request, array $callOptions = []): SupportedLanguages + { + return $this->startApiCall('GetSupportedLanguages', $request, $callOptions)->wait(); + } + + /** + * Imports an AdaptiveMtFile and adds all of its sentences into the + * AdaptiveMtDataset. + * + * The async variant is + * {@see TranslationServiceClient::importAdaptiveMtFileAsync()} . + * + * @example samples/V3/TranslationServiceClient/import_adaptive_mt_file.php + * + * @param ImportAdaptiveMtFileRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ImportAdaptiveMtFileResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function importAdaptiveMtFile(ImportAdaptiveMtFileRequest $request, array $callOptions = []): ImportAdaptiveMtFileResponse + { + return $this->startApiCall('ImportAdaptiveMtFile', $request, $callOptions)->wait(); + } + + /** + * Lists all Adaptive MT datasets for which the caller has read permission. + * + * The async variant is + * {@see TranslationServiceClient::listAdaptiveMtDatasetsAsync()} . + * + * @example samples/V3/TranslationServiceClient/list_adaptive_mt_datasets.php + * + * @param ListAdaptiveMtDatasetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAdaptiveMtDatasets', $request, $callOptions); + } + + /** + * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. + * + * The async variant is {@see TranslationServiceClient::listAdaptiveMtFilesAsync()} + * . + * + * @example samples/V3/TranslationServiceClient/list_adaptive_mt_files.php + * + * @param ListAdaptiveMtFilesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAdaptiveMtFiles(ListAdaptiveMtFilesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAdaptiveMtFiles', $request, $callOptions); + } + + /** + * Lists all AdaptiveMtSentences under a given file/dataset. + * + * The async variant is + * {@see TranslationServiceClient::listAdaptiveMtSentencesAsync()} . + * + * @example samples/V3/TranslationServiceClient/list_adaptive_mt_sentences.php + * + * @param ListAdaptiveMtSentencesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAdaptiveMtSentences', $request, $callOptions); + } + + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * + * The async variant is {@see TranslationServiceClient::listGlossariesAsync()} . + * + * @example samples/V3/TranslationServiceClient/list_glossaries.php + * + * @param ListGlossariesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listGlossaries(ListGlossariesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListGlossaries', $request, $callOptions); + } + + /** + * Translates documents in synchronous mode. + * + * The async variant is {@see TranslationServiceClient::translateDocumentAsync()} . + * + * @example samples/V3/TranslationServiceClient/translate_document.php + * + * @param TranslateDocumentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 TranslateDocumentResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function translateDocument(TranslateDocumentRequest $request, array $callOptions = []): TranslateDocumentResponse + { + return $this->startApiCall('TranslateDocument', $request, $callOptions)->wait(); + } + + /** + * Translates input text and returns translated text. + * + * The async variant is {@see TranslationServiceClient::translateTextAsync()} . + * + * @example samples/V3/TranslationServiceClient/translate_text.php + * + * @param TranslateTextRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 TranslateTextResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function translateText(TranslateTextRequest $request, array $callOptions = []): TranslateTextResponse + { + return $this->startApiCall('TranslateText', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php b/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php new file mode 100644 index 00000000000..d8c59048d39 --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/Gapic/TranslationServiceGapicClient.php @@ -0,0 +1,1948 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $formattedDataset = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * $content = []; + * $response = $translationServiceClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Translate\V3\Client\TranslationServiceClient}. + */ +class TranslationServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.translation.v3.TranslationService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'translate.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'translate.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', + 'https://www.googleapis.com/auth/cloud-translation', + ]; + + private static $adaptiveMtDatasetNameTemplate; + + private static $adaptiveMtFileNameTemplate; + + private static $glossaryNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/translation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/translation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/translation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/translation_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getAdaptiveMtDatasetNameTemplate() + { + if (self::$adaptiveMtDatasetNameTemplate == null) { + self::$adaptiveMtDatasetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}'); + } + + return self::$adaptiveMtDatasetNameTemplate; + } + + private static function getAdaptiveMtFileNameTemplate() + { + if (self::$adaptiveMtFileNameTemplate == null) { + self::$adaptiveMtFileNameTemplate = new PathTemplate('projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}'); + } + + return self::$adaptiveMtFileNameTemplate; + } + + private static function getGlossaryNameTemplate() + { + if (self::$glossaryNameTemplate == null) { + self::$glossaryNameTemplate = new PathTemplate('projects/{project}/locations/{location}/glossaries/{glossary}'); + } + + return self::$glossaryNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'adaptiveMtDataset' => self::getAdaptiveMtDatasetNameTemplate(), + 'adaptiveMtFile' => self::getAdaptiveMtFileNameTemplate(), + 'glossary' => self::getGlossaryNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * adaptive_mt_dataset resource. + * + * @param string $project + * @param string $location + * @param string $dataset + * + * @return string The formatted adaptive_mt_dataset resource. + */ + public static function adaptiveMtDatasetName($project, $location, $dataset) + { + return self::getAdaptiveMtDatasetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'dataset' => $dataset, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * adaptive_mt_file resource. + * + * @param string $project + * @param string $location + * @param string $dataset + * @param string $file + * + * @return string The formatted adaptive_mt_file resource. + */ + public static function adaptiveMtFileName($project, $location, $dataset, $file) + { + return self::getAdaptiveMtFileNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'dataset' => $dataset, + 'file' => $file, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a glossary + * resource. + * + * @param string $project + * @param string $location + * @param string $glossary + * + * @return string The formatted glossary resource. + */ + public static function glossaryName($project, $location, $glossary) + { + return self::getGlossaryNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'glossary' => $glossary, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - adaptiveMtDataset: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset} + * - adaptiveMtFile: projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file} + * - glossary: projects/{project}/locations/{location}/glossaries/{glossary} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'translate.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); + } + + /** + * Translate text using Adaptive MT. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $formattedDataset = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * $content = []; + * $response = $translationServiceClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * @param string $dataset Required. The resource name for the dataset to use for adaptive MT. + * `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}` + * @param string[] $content Required. The content of the input in string format. + * For now only one sentence per request is supported. + * @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\Cloud\Translate\V3\AdaptiveMtTranslateResponse + * + * @throws ApiException if the remote call fails + */ + public function adaptiveMtTranslate($parent, $dataset, $content, array $optionalArgs = []) + { + $request = new AdaptiveMtTranslateRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setDataset($dataset); + $request->setContent($content); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('AdaptiveMtTranslate', AdaptiveMtTranslateResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Translates a large volume of document in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can use + * google.longrunning.Operation.name to poll the status of the call. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $sourceLanguageCode = 'source_language_code'; + * $targetLanguageCodes = []; + * $inputConfigs = []; + * $outputConfig = new BatchDocumentOutputConfig(); + * $operationResponse = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $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 = $translationServiceClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateDocument'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param string $sourceLanguageCode Required. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * [Language Support](https://cloud.google.com/translate/docs/languages). + * @param string[] $targetLanguageCodes Required. The ISO-639 language code to use for translation of the input + * document. Specify up to 10 language codes here. + * @param BatchDocumentInputConfig[] $inputConfigs Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size to translate should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param BatchDocumentOutputConfig $outputConfig Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param array $optionalArgs { + * Optional. + * + * @type array $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is the model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array $glossaries + * Optional. Glossaries to be applied. It's keyed by target language code. + * @type array $formatConversions + * Optional. The file format conversion map that is applied to all input + * files. The map key is the original mime_type. The map value is the target + * mime_type of translated documents. + * + * Supported file format conversion includes: + * - `application/pdf` to + * `application/vnd.openxmlformats-officedocument.wordprocessingml.document` + * + * If nothing specified, output files will be in the same format as the + * original file. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $enableShadowRemovalNativePdf + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * @type bool $enableRotationCorrection + * Optional. If true, enable auto rotation correction in DVS. + * @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 batchTranslateDocument($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) + { + $request = new BatchTranslateDocumentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSourceLanguageCode($sourceLanguageCode); + $request->setTargetLanguageCodes($targetLanguageCodes); + $request->setInputConfigs($inputConfigs); + $request->setOutputConfig($outputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['models'])) { + $request->setModels($optionalArgs['models']); + } + + if (isset($optionalArgs['glossaries'])) { + $request->setGlossaries($optionalArgs['glossaries']); + } + + if (isset($optionalArgs['formatConversions'])) { + $request->setFormatConversions($optionalArgs['formatConversions']); + } + + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + + if (isset($optionalArgs['enableShadowRemovalNativePdf'])) { + $request->setEnableShadowRemovalNativePdf($optionalArgs['enableShadowRemovalNativePdf']); + } + + if (isset($optionalArgs['enableRotationCorrection'])) { + $request->setEnableRotationCorrection($optionalArgs['enableRotationCorrection']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchTranslateDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Translates a large volume of text in asynchronous batch mode. + * This function provides real-time output as the inputs are being processed. + * If caller cancels a request, the partial results (for an input file, it's + * all or nothing) may still be available on the specified output location. + * + * This call returns immediately and you can + * use google.longrunning.Operation.name to poll the status of the call. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $sourceLanguageCode = 'source_language_code'; + * $targetLanguageCodes = []; + * $inputConfigs = []; + * $outputConfig = new OutputConfig(); + * $operationResponse = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $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 = $translationServiceClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'batchTranslateText'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a call. Must refer to a caller's project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * The `global` location is not supported for batch translation. + * + * Only AutoML Translation models or glossaries within the same region (have + * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + * error is returned. + * @param string $sourceLanguageCode Required. Source language code. + * @param string[] $targetLanguageCodes Required. Specify up to 10 language codes here. + * @param InputConfig[] $inputConfigs Required. Input configurations. + * The total number of files matched should be <= 100. + * The total content size should be <= 100M Unicode codepoints. + * The files must use UTF-8 encoding. + * @param OutputConfig $outputConfig Required. Output configuration. + * If 2 input configs match to the same file (that is, same input path), + * we don't generate output for duplicate inputs. + * @param array $optionalArgs { + * Optional. + * + * @type array $models + * Optional. The models to use for translation. Map's key is target language + * code. Map's value is model name. Value can be a built-in general model, + * or an AutoML Translation model. + * + * The value format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If the map is empty or a specific model is + * not requested for a language pair, then default google model (nmt) is used. + * @type array $glossaries + * Optional. Glossaries to be applied for translation. + * It's keyed by target language code. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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 batchTranslateText($parent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig, array $optionalArgs = []) + { + $request = new BatchTranslateTextRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSourceLanguageCode($sourceLanguageCode); + $request->setTargetLanguageCodes($targetLanguageCodes); + $request->setInputConfigs($inputConfigs); + $request->setOutputConfig($outputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['models'])) { + $request->setModels($optionalArgs['models']); + } + + if (isset($optionalArgs['glossaries'])) { + $request->setGlossaries($optionalArgs['glossaries']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchTranslateText', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an Adaptive MT dataset. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $adaptiveMtDataset = new AdaptiveMtDataset(); + * $response = $translationServiceClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the parent project. In form of + * `projects/{project-number-or-id}/locations/{location-id}` + * @param AdaptiveMtDataset $adaptiveMtDataset Required. The AdaptiveMtDataset to be created. + * @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\Cloud\Translate\V3\AdaptiveMtDataset + * + * @throws ApiException if the remote call fails + */ + public function createAdaptiveMtDataset($parent, $adaptiveMtDataset, array $optionalArgs = []) + { + $request = new CreateAdaptiveMtDatasetRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAdaptiveMtDataset($adaptiveMtDataset); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateAdaptiveMtDataset', AdaptiveMtDataset::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a glossary and returns the long-running operation. Returns + * NOT_FOUND, if the project doesn't exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $glossary = new Glossary(); + * $operationResponse = $translationServiceClient->createGlossary($formattedParent, $glossary); + * $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 = $translationServiceClient->createGlossary($formattedParent, $glossary); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'createGlossary'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project name. + * @param Glossary $glossary Required. The glossary to create. + * @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 createGlossary($parent, $glossary, array $optionalArgs = []) + { + $request = new CreateGlossaryRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setGlossary($glossary); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an Adaptive MT dataset, including all its entries and associated + * metadata. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * $translationServiceClient->deleteAdaptiveMtDataset($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteAdaptiveMtDataset($name, array $optionalArgs = []) + { + $request = new DeleteAdaptiveMtDatasetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteAdaptiveMtDataset', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an AdaptiveMtFile along with its sentences. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + * $translationServiceClient->deleteAdaptiveMtFile($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the file to delete, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteAdaptiveMtFile($name, array $optionalArgs = []) + { + $request = new DeleteAdaptiveMtFileRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteAdaptiveMtFile', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a glossary, or cancels glossary construction + * if the glossary isn't created yet. + * Returns NOT_FOUND, if the glossary doesn't exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + * $operationResponse = $translationServiceClient->deleteGlossary($formattedName); + * $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 = $translationServiceClient->deleteGlossary($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $translationServiceClient->resumeOperation($operationName, 'deleteGlossary'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the glossary to delete. + * @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 deleteGlossary($name, array $optionalArgs = []) + { + $request = new DeleteGlossaryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteGlossary', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Detects the language of text within a request. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->detectLanguage($formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Only models within the same region (has same location-id) can be used. + * Otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $model + * Optional. The language detection model to be used. + * + * Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + * + * Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + * + * If not specified, the default model is used. + * @type string $content + * The content of the input stored as a string. + * @type string $mimeType + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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\Translate\V3\DetectLanguageResponse + * + * @throws ApiException if the remote call fails + */ + public function detectLanguage($parent, array $optionalArgs = []) + { + $request = new DetectLanguageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['content'])) { + $request->setContent($optionalArgs['content']); + } + + if (isset($optionalArgs['mimeType'])) { + $request->setMimeType($optionalArgs['mimeType']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DetectLanguage', DetectLanguageResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the Adaptive MT dataset. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * $response = $translationServiceClient->getAdaptiveMtDataset($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the dataset. In the form of + * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` + * @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\Cloud\Translate\V3\AdaptiveMtDataset + * + * @throws ApiException if the remote call fails + */ + public function getAdaptiveMtDataset($name, array $optionalArgs = []) + { + $request = new GetAdaptiveMtDatasetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAdaptiveMtDataset', AdaptiveMtDataset::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets and AdaptiveMtFile + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + * $response = $translationServiceClient->getAdaptiveMtFile($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * @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\Cloud\Translate\V3\AdaptiveMtFile + * + * @throws ApiException if the remote call fails + */ + public function getAdaptiveMtFile($name, array $optionalArgs = []) + { + $request = new GetAdaptiveMtFileRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAdaptiveMtFile', AdaptiveMtFile::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + * exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedName = $translationServiceClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + * $response = $translationServiceClient->getGlossary($formattedName); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the glossary to retrieve. + * @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\Cloud\Translate\V3\Glossary + * + * @throws ApiException if the remote call fails + */ + public function getGlossary($name, array $optionalArgs = []) + { + $request = new GetGlossaryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGlossary', Glossary::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of supported languages for translation. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->getSupportedLanguages($formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for AutoML models. + * + * Only models within the same region (have same location-id) can be used, + * otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $displayLanguageCode + * Optional. The language to use to return localized, human readable names + * of supported languages. If missing, then display names are not returned + * in a response. + * @type string $model + * Optional. Get supported languages of this model. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * Returns languages supported by the specified model. + * If missing, we get supported languages of Google general NMT model. + * @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\Translate\V3\SupportedLanguages + * + * @throws ApiException if the remote call fails + */ + public function getSupportedLanguages($parent, array $optionalArgs = []) + { + $request = new GetSupportedLanguagesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['displayLanguageCode'])) { + $request->setDisplayLanguageCode($optionalArgs['displayLanguageCode']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSupportedLanguages', SupportedLanguages::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports an AdaptiveMtFile and adds all of its sentences into the + * AdaptiveMtDataset. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * $response = $translationServiceClient->importAdaptiveMtFile($formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the file, in form of + * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` + * @param array $optionalArgs { + * Optional. + * + * @type FileInputSource $fileInputSource + * Inline file source. + * @type GcsInputSource $gcsInputSource + * Google Cloud Storage file source. + * @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\Translate\V3\ImportAdaptiveMtFileResponse + * + * @throws ApiException if the remote call fails + */ + public function importAdaptiveMtFile($parent, array $optionalArgs = []) + { + $request = new ImportAdaptiveMtFileRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['fileInputSource'])) { + $request->setFileInputSource($optionalArgs['fileInputSource']); + } + + if (isset($optionalArgs['gcsInputSource'])) { + $request->setGcsInputSource($optionalArgs['gcsInputSource']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ImportAdaptiveMtFile', ImportAdaptiveMtFileResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all Adaptive MT datasets for which the caller has read permission. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtDatasets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtDatasets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT datasets. `projects/{project-number-or-id}/locations/{location-id}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. An expression for filtering the results of the request. + * Filter is not supported yet. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAdaptiveMtDatasets($parent, array $optionalArgs = []) + { + $request = new ListAdaptiveMtDatasetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAdaptiveMtDatasets', $optionalArgs, ListAdaptiveMtDatasetsResponse::class, $request); + } + + /** + * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + * // Iterate over pages of elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtFiles($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtFiles($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT files. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAdaptiveMtFiles($parent, array $optionalArgs = []) + { + $request = new ListAdaptiveMtFilesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAdaptiveMtFiles', $optionalArgs, ListAdaptiveMtFilesResponse::class, $request); + } + + /** + * Lists all AdaptiveMtSentences under a given file/dataset. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + * // Iterate over pages of elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtSentences($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $translationServiceClient->listAdaptiveMtSentences($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the project from which to list the Adaptive + * MT files. The following format lists all sentences under a file. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` + * The following format lists all sentences within a dataset. + * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAdaptiveMtSentences($parent, array $optionalArgs = []) + { + $request = new ListAdaptiveMtSentencesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAdaptiveMtSentences', $optionalArgs, ListAdaptiveMtSentencesResponse::class, $request); + } + + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + * exist. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $translationServiceClient->listGlossaries($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project from which to list all of the glossaries. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filter specifying constraints of a list operation. + * Specify the constraint by the format of "key=value", where key must be + * "src" or "tgt", and the value must be a valid language code. + * For multiple restrictions, concatenate them by "AND" (uppercase only), + * such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used + * here, which means using 'en-US' and 'en' can lead to different results, + * which depends on the language code you used when you create the glossary. + * For the unidirectional glossaries, the "src" and "tgt" add restrictions + * on the source and target language code separately. + * For the equivalent term set glossaries, the "src" and/or "tgt" add + * restrictions on the term set. + * For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional + * glossaries which exactly match the source language code as "en-US" and the + * target language code "zh-CN", but all equivalent term set glossaries which + * contain "en-US" and "zh-CN" in their language set will be picked. + * If missing, no filtering is performed. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGlossaries($parent, array $optionalArgs = []) + { + $request = new ListGlossariesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGlossaries', $optionalArgs, ListGlossariesResponse::class, $request); + } + + /** + * Translates documents in synchronous mode. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $parent = 'parent'; + * $targetLanguageCode = 'target_language_code'; + * $documentInputConfig = new DocumentInputConfig(); + * $response = $translationServiceClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Location to make a regional call. + * + * Format: `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or custom + * glossaries. + * + * Models and glossaries must be within the same region (have the same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * document, set to one of the language codes listed in Language Support. + * @param DocumentInputConfig $documentInputConfig Required. Input configurations. + * @param array $optionalArgs { + * Optional. + * + * @type string $sourceLanguageCode + * Optional. The ISO-639 language code of the input document if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in + * Language Support. If the source language isn't specified, the API attempts + * to identify the source language automatically and returns the source + * language within the response. Source language must be specified if the + * request contains a glossary or a custom model. + * @type DocumentOutputConfig $documentOutputConfig + * Optional. Output configurations. + * Defines if the output file should be stored within Cloud Storage as well + * as the desired output format. If not provided the translated file will + * only be returned through a byte-stream and its output mime type will be + * the same as the input file's mime type. + * @type string $model + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * If not provided, the default Google model (NMT) will be used for + * translation. + * @type TranslateTextGlossaryConfig $glossaryConfig + * Optional. Glossary to be applied. The glossary must be within the same + * region (have the same location-id) as the model, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters (Unicode + * codepoints), can only contain lowercase letters, numeric characters, + * underscores and dashes. International characters are allowed. Label values + * are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @type string $customizedAttribution + * Optional. This flag is to support user customized attribution. + * If not provided, the default is `Machine Translated by Google`. + * Customized attribution should follow rules in + * https://cloud.google.com/translate/attribution#attribution_and_logos + * @type bool $isTranslateNativePdfOnly + * Optional. is_translate_native_pdf_only field for external customers. + * If true, the page limit of online native pdf translation is 300 and only + * native pdf pages will be translated. + * @type bool $enableShadowRemovalNativePdf + * Optional. If true, use the text removal server to remove the shadow text on + * background image for native pdf translation. + * Shadow removal feature can only be enabled when + * is_translate_native_pdf_only: false && pdf_native_only: false + * @type bool $enableRotationCorrection + * Optional. If true, enable auto rotation correction in DVS. + * @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\Translate\V3\TranslateDocumentResponse + * + * @throws ApiException if the remote call fails + */ + public function translateDocument($parent, $targetLanguageCode, $documentInputConfig, array $optionalArgs = []) + { + $request = new TranslateDocumentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTargetLanguageCode($targetLanguageCode); + $request->setDocumentInputConfig($documentInputConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['sourceLanguageCode'])) { + $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); + } + + if (isset($optionalArgs['documentOutputConfig'])) { + $request->setDocumentOutputConfig($optionalArgs['documentOutputConfig']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['glossaryConfig'])) { + $request->setGlossaryConfig($optionalArgs['glossaryConfig']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + if (isset($optionalArgs['customizedAttribution'])) { + $request->setCustomizedAttribution($optionalArgs['customizedAttribution']); + } + + if (isset($optionalArgs['isTranslateNativePdfOnly'])) { + $request->setIsTranslateNativePdfOnly($optionalArgs['isTranslateNativePdfOnly']); + } + + if (isset($optionalArgs['enableShadowRemovalNativePdf'])) { + $request->setEnableShadowRemovalNativePdf($optionalArgs['enableShadowRemovalNativePdf']); + } + + if (isset($optionalArgs['enableRotationCorrection'])) { + $request->setEnableRotationCorrection($optionalArgs['enableRotationCorrection']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TranslateDocument', TranslateDocumentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Translates input text and returns translated text. + * + * Sample code: + * ``` + * $translationServiceClient = new TranslationServiceClient(); + * try { + * $contents = []; + * $targetLanguageCode = 'target_language_code'; + * $formattedParent = $translationServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $translationServiceClient->translateText($contents, $targetLanguageCode, $formattedParent); + * } finally { + * $translationServiceClient->close(); + * } + * ``` + * + * @param string[] $contents Required. The content of the input in string format. + * We recommend the total content be less than 30,000 codepoints. The max + * length of this field is 1024. Use BatchTranslateText for larger text. + * @param string $targetLanguageCode Required. The ISO-639 language code to use for translation of the input + * text, set to one of the language codes listed in Language Support. + * @param string $parent Required. Project or location to make a call. Must refer to a caller's + * project. + * + * Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + * + * For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + * + * Non-global location is required for requests using AutoML models or + * custom glossaries. + * + * Models and glossaries must be within the same region (have same + * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + * @param array $optionalArgs { + * Optional. + * + * @type string $mimeType + * Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @type string $sourceLanguageCode + * Optional. The ISO-639 language code of the input text if + * known, for example, "en-US" or "sr-Latn". Supported language codes are + * listed in Language Support. If the source language isn't specified, the API + * attempts to identify the source language automatically and returns the + * source language within the response. + * @type string $model + * Optional. The `model` type requested for this translation. + * + * The format depends on model type: + * + * - AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + * + * - General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * + * + * For global (non-regionalized) requests, use `location-id` `global`. + * For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + * + * If not provided, the default Google model (NMT) will be used + * @type TranslateTextGlossaryConfig $glossaryConfig + * Optional. Glossary to be applied. The glossary must be + * within the same region (have the same location-id) as the model, otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * See https://cloud.google.com/translate/docs/advanced/labels for more + * information. + * @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\Translate\V3\TranslateTextResponse + * + * @throws ApiException if the remote call fails + */ + public function translateText($contents, $targetLanguageCode, $parent, array $optionalArgs = []) + { + $request = new TranslateTextRequest(); + $requestParamHeaders = []; + $request->setContents($contents); + $request->setTargetLanguageCode($targetLanguageCode); + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['mimeType'])) { + $request->setMimeType($optionalArgs['mimeType']); + } + + if (isset($optionalArgs['sourceLanguageCode'])) { + $request->setSourceLanguageCode($optionalArgs['sourceLanguageCode']); + } + + if (isset($optionalArgs['model'])) { + $request->setModel($optionalArgs['model']); + } + + if (isset($optionalArgs['glossaryConfig'])) { + $request->setGlossaryConfig($optionalArgs['glossaryConfig']); + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TranslateText', TranslateTextResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php b/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php new file mode 100644 index 00000000000..b1cacbc0fe4 --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/TranslationServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.translation.v3.TranslationService' => [ + 'BatchTranslateDocument' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateDocumentMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BatchTranslateText' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\BatchTranslateMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateGlossary' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\Glossary', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\CreateGlossaryMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteGlossary' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryResponse', + 'metadataReturnType' => '\Google\Cloud\Translate\V3\DeleteGlossaryMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'AdaptiveMtTranslate' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtTranslateResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateAdaptiveMtDataset' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtDataset', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAdaptiveMtDataset' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAdaptiveMtFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DetectLanguage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\DetectLanguageResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetAdaptiveMtDataset' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtDataset', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAdaptiveMtFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\AdaptiveMtFile', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetGlossary' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\Glossary', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSupportedLanguages' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\SupportedLanguages', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ImportAdaptiveMtFile' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\ImportAdaptiveMtFileResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtDatasets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAdaptiveMtDatasets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtDatasetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtFiles' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAdaptiveMtFiles', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtFilesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtSentences' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAdaptiveMtSentences', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\ListAdaptiveMtSentencesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListGlossaries' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGlossaries', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\ListGlossariesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateDocument' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\TranslateDocumentResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateText' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Translate\V3\TranslateTextResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'adaptiveMtDataset' => 'projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}', + 'adaptiveMtFile' => 'projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}', + 'glossary' => 'projects/{project}/locations/{location}/glossaries/{glossary}', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php b/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php new file mode 100644 index 00000000000..720ee2e54ab --- /dev/null +++ b/owl-bot-staging/Translate/v3/src/V3/resources/translation_service_rest_client_config.php @@ -0,0 +1,347 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.translation.v3.TranslationService' => [ + 'AdaptiveMtTranslate' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:adaptiveMtTranslate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchTranslateDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateDocument', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchTranslateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:batchTranslateText', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateAdaptiveMtDataset' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets', + 'body' => 'adaptive_mt_dataset', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateGlossary' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', + 'body' => 'glossary', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAdaptiveMtDataset' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteAdaptiveMtFile' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGlossary' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DetectLanguage' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:detectLanguage', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}:detectLanguage', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetAdaptiveMtDataset' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAdaptiveMtFile' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGlossary' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/glossaries/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSupportedLanguages' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/supportedLanguages', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*}/supportedLanguages', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ImportAdaptiveMtFile' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}:importAdaptiveMtFile', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtDatasets' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/adaptiveMtDatasets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtFiles' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtFiles', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListAdaptiveMtSentences' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*/adaptiveMtFiles/*}/adaptiveMtSentences', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/adaptiveMtDatasets/*}/adaptiveMtSentences', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListGlossaries' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}/glossaries', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateDocument', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'TranslateText' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*}:translateText', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*}:translateText', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'WaitOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:wait', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Translate/v3/tests/Unit/V3/Client/TranslationServiceClientTest.php b/owl-bot-staging/Translate/v3/tests/Unit/V3/Client/TranslationServiceClientTest.php new file mode 100644 index 00000000000..4fc32db047c --- /dev/null +++ b/owl-bot-staging/Translate/v3/tests/Unit/V3/Client/TranslationServiceClientTest.php @@ -0,0 +1,1826 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TranslationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TranslationServiceClient($options); + } + + /** @test */ + public function adaptiveMtTranslateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $languageCode = 'languageCode-412800396'; + $expectedResponse = new AdaptiveMtTranslateResponse(); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $content = []; + $request = (new AdaptiveMtTranslateRequest()) + ->setParent($formattedParent) + ->setDataset($formattedDataset) + ->setContent($content); + $response = $gapicClient->adaptiveMtTranslate($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDataset(); + $this->assertProtobufEquals($formattedDataset, $actualValue); + $actualValue = $actualRequestObject->getContent(); + $this->assertProtobufEquals($content, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function adaptiveMtTranslateExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $content = []; + $request = (new AdaptiveMtTranslateRequest()) + ->setParent($formattedParent) + ->setDataset($formattedDataset) + ->setContent($content); + try { + $gapicClient->adaptiveMtTranslate($request); + // 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()); + } + + /** @test */ + public function batchTranslateDocumentTest() + { + $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/batchTranslateDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalPages = 396186871; + $translatedPages = 1652747493; + $failedPages = 2002254526; + $totalBillablePages = 1292117569; + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $totalBillableCharacters = 1242495501; + $expectedResponse = new BatchTranslateDocumentResponse(); + $expectedResponse->setTotalPages($totalPages); + $expectedResponse->setTranslatedPages($translatedPages); + $expectedResponse->setFailedPages($failedPages); + $expectedResponse->setTotalBillablePages($totalBillablePages); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $expectedResponse->setTotalBillableCharacters($totalBillableCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $request = (new BatchTranslateDocumentRequest()) + ->setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + $response = $gapicClient->batchTranslateDocument($request); + $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.translation.v3.TranslationService/BatchTranslateDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + $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 batchTranslateDocumentExceptionTest() + { + $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/batchTranslateDocumentTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $request = (new BatchTranslateDocumentRequest()) + ->setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + $response = $gapicClient->batchTranslateDocument($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + 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 batchTranslateTextTest() + { + $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/batchTranslateTextTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $expectedResponse = new BatchTranslateResponse(); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateTextTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $request = (new BatchTranslateTextRequest()) + ->setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + $response = $gapicClient->batchTranslateText($request); + $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.translation.v3.TranslationService/BatchTranslateText', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + $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 batchTranslateTextExceptionTest() + { + $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/batchTranslateTextTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $request = (new BatchTranslateTextRequest()) + ->setParent($formattedParent) + ->setSourceLanguageCode($sourceLanguageCode) + ->setTargetLanguageCodes($targetLanguageCodes) + ->setInputConfigs($inputConfigs) + ->setOutputConfig($outputConfig); + $response = $gapicClient->batchTranslateText($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + 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 createAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $exampleCount = 1517063674; + $expectedResponse = new AdaptiveMtDataset(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setSourceLanguageCode($sourceLanguageCode); + $expectedResponse->setTargetLanguageCode($targetLanguageCode); + $expectedResponse->setExampleCount($exampleCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $adaptiveMtDataset = new AdaptiveMtDataset(); + $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $adaptiveMtDataset->setName($adaptiveMtDatasetName); + $request = (new CreateAdaptiveMtDatasetRequest()) + ->setParent($formattedParent) + ->setAdaptiveMtDataset($adaptiveMtDataset); + $response = $gapicClient->createAdaptiveMtDataset($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/CreateAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAdaptiveMtDataset(); + $this->assertProtobufEquals($adaptiveMtDataset, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $adaptiveMtDataset = new AdaptiveMtDataset(); + $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $adaptiveMtDataset->setName($adaptiveMtDatasetName); + $request = (new CreateAdaptiveMtDatasetRequest()) + ->setParent($formattedParent) + ->setAdaptiveMtDataset($adaptiveMtDataset); + try { + $gapicClient->createAdaptiveMtDataset($request); + // 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()); + } + + /** @test */ + public function createGlossaryTest() + { + $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/createGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $request = (new CreateGlossaryRequest()) + ->setParent($formattedParent) + ->setGlossary($glossary); + $response = $gapicClient->createGlossary($request); + $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.translation.v3.TranslationService/CreateGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGlossary(); + $this->assertProtobufEquals($glossary, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + $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 createGlossaryExceptionTest() + { + $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/createGlossaryTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $request = (new CreateGlossaryRequest()) + ->setParent($formattedParent) + ->setGlossary($glossary); + $response = $gapicClient->createGlossary($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + 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 deleteAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new DeleteAdaptiveMtDatasetRequest()) + ->setName($formattedName); + $gapicClient->deleteAdaptiveMtDataset($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new DeleteAdaptiveMtDatasetRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteAdaptiveMtDataset($request); + // 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()); + } + + /** @test */ + public function deleteAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new DeleteAdaptiveMtFileRequest()) + ->setName($formattedName); + $gapicClient->deleteAdaptiveMtFile($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAdaptiveMtFileExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new DeleteAdaptiveMtFileRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteAdaptiveMtFile($request); + // 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()); + } + + /** @test */ + public function deleteGlossaryTest() + { + $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/deleteGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DeleteGlossaryResponse(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $request = (new DeleteGlossaryRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteGlossary($request); + $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.translation.v3.TranslationService/DeleteGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + $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 deleteGlossaryExceptionTest() + { + $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/deleteGlossaryTest'); + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $request = (new DeleteGlossaryRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteGlossary($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + 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 detectLanguageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DetectLanguageResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new DetectLanguageRequest()) + ->setParent($formattedParent); + $response = $gapicClient->detectLanguage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DetectLanguage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detectLanguageExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new DetectLanguageRequest()) + ->setParent($formattedParent); + try { + $gapicClient->detectLanguage($request); + // 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()); + } + + /** @test */ + public function getAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $exampleCount = 1517063674; + $expectedResponse = new AdaptiveMtDataset(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setSourceLanguageCode($sourceLanguageCode); + $expectedResponse->setTargetLanguageCode($targetLanguageCode); + $expectedResponse->setExampleCount($exampleCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new GetAdaptiveMtDatasetRequest()) + ->setName($formattedName); + $response = $gapicClient->getAdaptiveMtDataset($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new GetAdaptiveMtDatasetRequest()) + ->setName($formattedName); + try { + $gapicClient->getAdaptiveMtDataset($request); + // 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()); + } + + /** @test */ + public function getAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $entryCount = 811131134; + $expectedResponse = new AdaptiveMtFile(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEntryCount($entryCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new GetAdaptiveMtFileRequest()) + ->setName($formattedName); + $response = $gapicClient->getAdaptiveMtFile($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAdaptiveMtFileExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new GetAdaptiveMtFileRequest()) + ->setName($formattedName); + try { + $gapicClient->getAdaptiveMtFile($request); + // 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()); + } + + /** @test */ + public function getGlossaryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name2); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $request = (new GetGlossaryRequest()) + ->setName($formattedName); + $response = $gapicClient->getGlossary($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGlossaryExceptionTest() + { + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $request = (new GetGlossaryRequest()) + ->setName($formattedName); + try { + $gapicClient->getGlossary($request); + // 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()); + } + + /** @test */ + public function getSupportedLanguagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SupportedLanguages(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GetSupportedLanguagesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->getSupportedLanguages($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSupportedLanguagesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new GetSupportedLanguagesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->getSupportedLanguages($request); + // 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()); + } + + /** @test */ + public function importAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ImportAdaptiveMtFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new ImportAdaptiveMtFileRequest()) + ->setParent($formattedParent); + $response = $gapicClient->importAdaptiveMtFile($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ImportAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function importAdaptiveMtFileExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new ImportAdaptiveMtFileRequest()) + ->setParent($formattedParent); + try { + $gapicClient->importAdaptiveMtFile($request); + // 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()); + } + + /** @test */ + public function listAdaptiveMtDatasetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtDatasetsElement = new AdaptiveMtDataset(); + $adaptiveMtDatasets = [ + $adaptiveMtDatasetsElement, + ]; + $expectedResponse = new ListAdaptiveMtDatasetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtDatasets($adaptiveMtDatasets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAdaptiveMtDatasetsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAdaptiveMtDatasets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtDatasets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtDatasets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtDatasetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAdaptiveMtDatasetsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAdaptiveMtDatasets($request); + // 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()); + } + + /** @test */ + public function listAdaptiveMtFilesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtFilesElement = new AdaptiveMtFile(); + $adaptiveMtFiles = [ + $adaptiveMtFilesElement, + ]; + $expectedResponse = new ListAdaptiveMtFilesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtFiles($adaptiveMtFiles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new ListAdaptiveMtFilesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAdaptiveMtFiles($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtFiles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtFiles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtFilesExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $request = (new ListAdaptiveMtFilesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAdaptiveMtFiles($request); + // 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()); + } + + /** @test */ + public function listAdaptiveMtSentencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtSentencesElement = new AdaptiveMtSentence(); + $adaptiveMtSentences = [ + $adaptiveMtSentencesElement, + ]; + $expectedResponse = new ListAdaptiveMtSentencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtSentences($adaptiveMtSentences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new ListAdaptiveMtSentencesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAdaptiveMtSentences($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtSentences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtSentences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtSentencesExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $request = (new ListAdaptiveMtSentencesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAdaptiveMtSentences($request); + // 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()); + } + + /** @test */ + public function listGlossariesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $glossariesElement = new Glossary(); + $glossaries = [ + $glossariesElement, + ]; + $expectedResponse = new ListGlossariesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGlossaries($glossaries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListGlossariesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listGlossaries($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGlossaries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListGlossaries', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGlossariesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListGlossariesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listGlossaries($request); + // 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()); + } + + /** @test */ + public function translateDocumentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $model2 = 'model21226956956'; + $expectedResponse = new TranslateDocumentResponse(); + $expectedResponse->setModel($model2); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + $request = (new TranslateDocumentRequest()) + ->setParent($parent) + ->setTargetLanguageCode($targetLanguageCode) + ->setDocumentInputConfig($documentInputConfig); + $response = $gapicClient->translateDocument($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateDocument', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getDocumentInputConfig(); + $this->assertProtobufEquals($documentInputConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateDocumentExceptionTest() + { + $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'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + $request = (new TranslateDocumentRequest()) + ->setParent($parent) + ->setTargetLanguageCode($targetLanguageCode) + ->setDocumentInputConfig($documentInputConfig); + try { + $gapicClient->translateDocument($request); + // 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()); + } + + /** @test */ + public function translateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TranslateTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new TranslateTextRequest()) + ->setContents($contents) + ->setTargetLanguageCode($targetLanguageCode) + ->setParent($formattedParent); + $response = $gapicClient->translateText($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateText', $actualFuncCall); + $actualValue = $actualRequestObject->getContents(); + $this->assertProtobufEquals($contents, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateTextExceptionTest() + { + $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 + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new TranslateTextRequest()) + ->setContents($contents) + ->setTargetLanguageCode($targetLanguageCode) + ->setParent($formattedParent); + try { + $gapicClient->translateText($request); + // 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()); + } + + /** @test */ + public function adaptiveMtTranslateAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $languageCode = 'languageCode-412800396'; + $expectedResponse = new AdaptiveMtTranslateResponse(); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $content = []; + $request = (new AdaptiveMtTranslateRequest()) + ->setParent($formattedParent) + ->setDataset($formattedDataset) + ->setContent($content); + $response = $gapicClient->adaptiveMtTranslateAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDataset(); + $this->assertProtobufEquals($formattedDataset, $actualValue); + $actualValue = $actualRequestObject->getContent(); + $this->assertProtobufEquals($content, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php b/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php new file mode 100644 index 00000000000..a29f22ff3f3 --- /dev/null +++ b/owl-bot-staging/Translate/v3/tests/Unit/V3/TranslationServiceClientTest.php @@ -0,0 +1,1657 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TranslationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TranslationServiceClient($options); + } + + /** @test */ + public function adaptiveMtTranslateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $languageCode = 'languageCode-412800396'; + $expectedResponse = new AdaptiveMtTranslateResponse(); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $content = []; + $response = $gapicClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/AdaptiveMtTranslate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDataset(); + $this->assertProtobufEquals($formattedDataset, $actualValue); + $actualValue = $actualRequestObject->getContent(); + $this->assertProtobufEquals($content, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function adaptiveMtTranslateExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $formattedDataset = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $content = []; + try { + $gapicClient->adaptiveMtTranslate($formattedParent, $formattedDataset, $content); + // 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()); + } + + /** @test */ + public function batchTranslateDocumentTest() + { + $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/batchTranslateDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalPages = 396186871; + $translatedPages = 1652747493; + $failedPages = 2002254526; + $totalBillablePages = 1292117569; + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $totalBillableCharacters = 1242495501; + $expectedResponse = new BatchTranslateDocumentResponse(); + $expectedResponse->setTotalPages($totalPages); + $expectedResponse->setTranslatedPages($translatedPages); + $expectedResponse->setFailedPages($failedPages); + $expectedResponse->setTotalBillablePages($totalBillablePages); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $expectedResponse->setTotalBillableCharacters($totalBillableCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $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.translation.v3.TranslationService/BatchTranslateDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + $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 batchTranslateDocumentExceptionTest() + { + $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/batchTranslateDocumentTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new BatchDocumentOutputConfig(); + $response = $gapicClient->batchTranslateDocument($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateDocumentTest'); + 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 batchTranslateTextTest() + { + $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/batchTranslateTextTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $totalCharacters = 1368640955; + $translatedCharacters = 1337326221; + $failedCharacters = 1723028396; + $expectedResponse = new BatchTranslateResponse(); + $expectedResponse->setTotalCharacters($totalCharacters); + $expectedResponse->setTranslatedCharacters($translatedCharacters); + $expectedResponse->setFailedCharacters($failedCharacters); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchTranslateTextTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $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.translation.v3.TranslationService/BatchTranslateText', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceLanguageCode(); + $this->assertProtobufEquals($sourceLanguageCode, $actualValue); + $actualValue = $actualApiRequestObject->getTargetLanguageCodes(); + $this->assertProtobufEquals($targetLanguageCodes, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfigs(); + $this->assertProtobufEquals($inputConfigs, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + $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 batchTranslateTextExceptionTest() + { + $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/batchTranslateTextTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCodes = []; + $inputConfigs = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->batchTranslateText($formattedParent, $sourceLanguageCode, $targetLanguageCodes, $inputConfigs, $outputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchTranslateTextTest'); + 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 createAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $exampleCount = 1517063674; + $expectedResponse = new AdaptiveMtDataset(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setSourceLanguageCode($sourceLanguageCode); + $expectedResponse->setTargetLanguageCode($targetLanguageCode); + $expectedResponse->setExampleCount($exampleCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $adaptiveMtDataset = new AdaptiveMtDataset(); + $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $adaptiveMtDataset->setName($adaptiveMtDatasetName); + $response = $gapicClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/CreateAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAdaptiveMtDataset(); + $this->assertProtobufEquals($adaptiveMtDataset, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $adaptiveMtDataset = new AdaptiveMtDataset(); + $adaptiveMtDatasetName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $adaptiveMtDataset->setName($adaptiveMtDatasetName); + try { + $gapicClient->createAdaptiveMtDataset($formattedParent, $adaptiveMtDataset); + // 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()); + } + + /** @test */ + public function createGlossaryTest() + { + $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/createGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $response = $gapicClient->createGlossary($formattedParent, $glossary); + $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.translation.v3.TranslationService/CreateGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGlossary(); + $this->assertProtobufEquals($glossary, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + $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 createGlossaryExceptionTest() + { + $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/createGlossaryTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $glossary = new Glossary(); + $glossaryName = 'glossaryName-297469495'; + $glossary->setName($glossaryName); + $response = $gapicClient->createGlossary($formattedParent, $glossary); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGlossaryTest'); + 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 deleteAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $gapicClient->deleteAdaptiveMtDataset($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + try { + $gapicClient->deleteAdaptiveMtDataset($formattedName); + // 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()); + } + + /** @test */ + public function deleteAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $gapicClient->deleteAdaptiveMtFile($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DeleteAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAdaptiveMtFileExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + try { + $gapicClient->deleteAdaptiveMtFile($formattedName); + // 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()); + } + + /** @test */ + public function deleteGlossaryTest() + { + $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/deleteGlossaryTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DeleteGlossaryResponse(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGlossaryTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->deleteGlossary($formattedName); + $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.translation.v3.TranslationService/DeleteGlossary', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + $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 deleteGlossaryExceptionTest() + { + $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/deleteGlossaryTest'); + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->deleteGlossary($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGlossaryTest'); + 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 detectLanguageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new DetectLanguageResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->detectLanguage($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/DetectLanguage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function detectLanguageExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->detectLanguage($formattedParent); + // 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()); + } + + /** @test */ + public function getAdaptiveMtDatasetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $sourceLanguageCode = 'sourceLanguageCode1687263568'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $exampleCount = 1517063674; + $expectedResponse = new AdaptiveMtDataset(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setSourceLanguageCode($sourceLanguageCode); + $expectedResponse->setTargetLanguageCode($targetLanguageCode); + $expectedResponse->setExampleCount($exampleCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $response = $gapicClient->getAdaptiveMtDataset($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtDataset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAdaptiveMtDatasetExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + try { + $gapicClient->getAdaptiveMtDataset($formattedName); + // 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()); + } + + /** @test */ + public function getAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $entryCount = 811131134; + $expectedResponse = new AdaptiveMtFile(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setEntryCount($entryCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $response = $gapicClient->getAdaptiveMtFile($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAdaptiveMtFileExceptionTest() + { + $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 + $formattedName = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + try { + $gapicClient->getAdaptiveMtFile($formattedName); + // 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()); + } + + /** @test */ + public function getGlossaryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $entryCount = 811131134; + $displayName = 'displayName1615086568'; + $expectedResponse = new Glossary(); + $expectedResponse->setName($name2); + $expectedResponse->setEntryCount($entryCount); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + $response = $gapicClient->getGlossary($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetGlossary', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGlossaryExceptionTest() + { + $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 + $formattedName = $gapicClient->glossaryName('[PROJECT]', '[LOCATION]', '[GLOSSARY]'); + try { + $gapicClient->getGlossary($formattedName); + // 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()); + } + + /** @test */ + public function getSupportedLanguagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SupportedLanguages(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getSupportedLanguages($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/GetSupportedLanguages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSupportedLanguagesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getSupportedLanguages($formattedParent); + // 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()); + } + + /** @test */ + public function importAdaptiveMtFileTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ImportAdaptiveMtFileResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $response = $gapicClient->importAdaptiveMtFile($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ImportAdaptiveMtFile', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function importAdaptiveMtFileExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + try { + $gapicClient->importAdaptiveMtFile($formattedParent); + // 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()); + } + + /** @test */ + public function listAdaptiveMtDatasetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtDatasetsElement = new AdaptiveMtDataset(); + $adaptiveMtDatasets = [ + $adaptiveMtDatasetsElement, + ]; + $expectedResponse = new ListAdaptiveMtDatasetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtDatasets($adaptiveMtDatasets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAdaptiveMtDatasets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtDatasets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtDatasets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtDatasetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAdaptiveMtDatasets($formattedParent); + // 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()); + } + + /** @test */ + public function listAdaptiveMtFilesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtFilesElement = new AdaptiveMtFile(); + $adaptiveMtFiles = [ + $adaptiveMtFilesElement, + ]; + $expectedResponse = new ListAdaptiveMtFilesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtFiles($adaptiveMtFiles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + $response = $gapicClient->listAdaptiveMtFiles($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtFiles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtFiles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtFilesExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtDatasetName('[PROJECT]', '[LOCATION]', '[DATASET]'); + try { + $gapicClient->listAdaptiveMtFiles($formattedParent); + // 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()); + } + + /** @test */ + public function listAdaptiveMtSentencesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $adaptiveMtSentencesElement = new AdaptiveMtSentence(); + $adaptiveMtSentences = [ + $adaptiveMtSentencesElement, + ]; + $expectedResponse = new ListAdaptiveMtSentencesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAdaptiveMtSentences($adaptiveMtSentences); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + $response = $gapicClient->listAdaptiveMtSentences($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAdaptiveMtSentences()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListAdaptiveMtSentences', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAdaptiveMtSentencesExceptionTest() + { + $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 + $formattedParent = $gapicClient->adaptiveMtFileName('[PROJECT]', '[LOCATION]', '[DATASET]', '[FILE]'); + try { + $gapicClient->listAdaptiveMtSentences($formattedParent); + // 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()); + } + + /** @test */ + public function listGlossariesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $glossariesElement = new Glossary(); + $glossaries = [ + $glossariesElement, + ]; + $expectedResponse = new ListGlossariesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGlossaries($glossaries); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listGlossaries($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGlossaries()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/ListGlossaries', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGlossariesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listGlossaries($formattedParent); + // 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()); + } + + /** @test */ + public function translateDocumentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $model2 = 'model21226956956'; + $expectedResponse = new TranslateDocumentResponse(); + $expectedResponse->setModel($model2); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + $response = $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateDocument', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getDocumentInputConfig(); + $this->assertProtobufEquals($documentInputConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateDocumentExceptionTest() + { + $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'; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $documentInputConfig = new DocumentInputConfig(); + try { + $gapicClient->translateDocument($parent, $targetLanguageCode, $documentInputConfig); + // 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()); + } + + /** @test */ + public function translateTextTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TranslateTextResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.translation.v3.TranslationService/TranslateText', $actualFuncCall); + $actualValue = $actualRequestObject->getContents(); + $this->assertProtobufEquals($contents, $actualValue); + $actualValue = $actualRequestObject->getTargetLanguageCode(); + $this->assertProtobufEquals($targetLanguageCode, $actualValue); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function translateTextExceptionTest() + { + $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 + $contents = []; + $targetLanguageCode = 'targetLanguageCode1323228230'; + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->translateText($contents, $targetLanguageCode, $formattedParent); + // 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()); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1/VideoIntelligence.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1/VideoIntelligence.php new file mode 100644 index 00000000000..8f9939b7985 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1/VideoIntelligence.php @@ -0,0 +1,271 @@ +internalAddGeneratedFile( + ' +J +:google/cloud/videointelligence/v1/video_intelligence.proto!google.cloud.videointelligence.v1google/api/client.protogoogle/api/field_behavior.proto#google/longrunning/operations.protogoogle/protobuf/duration.protogoogle/protobuf/timestamp.protogoogle/rpc/status.proto" +AnnotateVideoRequest + input_uri (  + input_content ( A +features (2*.google.cloud.videointelligence.v1.FeatureBAF + video_context ( 2/.google.cloud.videointelligence.v1.VideoContext + +output_uri ( BA + location_id ( BA" + VideoContextA +segments ( 2/.google.cloud.videointelligence.v1.VideoSegmentW +label_detection_config ( 27.google.cloud.videointelligence.v1.LabelDetectionConfigb +shot_change_detection_config ( 2<.google.cloud.videointelligence.v1.ShotChangeDetectionConfigl +!explicit_content_detection_config ( 2A.google.cloud.videointelligence.v1.ExplicitContentDetectionConfigU +face_detection_config ( 26.google.cloud.videointelligence.v1.FaceDetectionConfiga +speech_transcription_config ( 2<.google.cloud.videointelligence.v1.SpeechTranscriptionConfigU +text_detection_config ( 26.google.cloud.videointelligence.v1.TextDetectionConfigY +person_detection_config ( 28.google.cloud.videointelligence.v1.PersonDetectionConfigW +object_tracking_config ( 27.google.cloud.videointelligence.v1.ObjectTrackingConfig" +LabelDetectionConfigS +label_detection_mode (25.google.cloud.videointelligence.v1.LabelDetectionMode +stationary_camera ( +model ( " +frame_confidence_threshold (" +video_confidence_threshold ("* +ShotChangeDetectionConfig +model ( "% +ObjectTrackingConfig +model ( "` +FaceDetectionConfig +model (  +include_bounding_boxes ( +include_attributes ("s +PersonDetectionConfig +include_bounding_boxes ( +include_pose_landmarks ( +include_attributes ("/ +ExplicitContentDetectionConfig +model ( "< +TextDetectionConfig +language_hints (  +model ( "x + VideoSegment4 +start_time_offset ( 2.google.protobuf.Duration2 +end_time_offset ( 2.google.protobuf.Duration"d + LabelSegment@ +segment ( 2/.google.cloud.videointelligence.v1.VideoSegment + +confidence ("P + +LabelFrame. + time_offset ( 2.google.protobuf.Duration + +confidence ("G +Entity + entity_id (  + description (  + language_code ( " +LabelAnnotation9 +entity ( 2).google.cloud.videointelligence.v1.EntityD +category_entities ( 2).google.cloud.videointelligence.v1.EntityA +segments ( 2/.google.cloud.videointelligence.v1.LabelSegment= +frames ( 2-.google.cloud.videointelligence.v1.LabelFrame +version ( " +ExplicitContentFrame. + time_offset ( 2.google.protobuf.DurationM +pornography_likelihood (2-.google.cloud.videointelligence.v1.Likelihood"u +ExplicitContentAnnotationG +frames ( 27.google.cloud.videointelligence.v1.ExplicitContentFrame +version ( "Q +NormalizedBoundingBox +left ( +top ( +right ( +bottom ("w +FaceDetectionAnnotation8 +tracks ( 2(.google.cloud.videointelligence.v1.Track + thumbnail (  +version ( "f +PersonDetectionAnnotation8 +tracks ( 2(.google.cloud.videointelligence.v1.Track +version ( "O + FaceSegment@ +segment ( 2/.google.cloud.videointelligence.v1.VideoSegment" + FaceFrame[ +normalized_bounding_boxes ( 28.google.cloud.videointelligence.v1.NormalizedBoundingBox. + time_offset ( 2.google.protobuf.Duration:" +FaceAnnotation + thumbnail ( @ +segments ( 2..google.cloud.videointelligence.v1.FaceSegment< +frames ( 2,.google.cloud.videointelligence.v1.FaceFrame:" +TimestampedObjectY +normalized_bounding_box ( 28.google.cloud.videointelligence.v1.NormalizedBoundingBox. + time_offset ( 2.google.protobuf.DurationM + +attributes ( 24.google.cloud.videointelligence.v1.DetectedAttributeBAK + landmarks ( 23.google.cloud.videointelligence.v1.DetectedLandmarkBA" +Track@ +segment ( 2/.google.cloud.videointelligence.v1.VideoSegmentQ +timestamped_objects ( 24.google.cloud.videointelligence.v1.TimestampedObjectM + +attributes ( 24.google.cloud.videointelligence.v1.DetectedAttributeBA + +confidence (BA"D +DetectedAttribute +name (  + +confidence ( +value ( "x +DetectedLandmark +name ( B +point ( 23.google.cloud.videointelligence.v1.NormalizedVertex + +confidence (" + +VideoAnnotationResults + input_uri ( @ +segment + ( 2/.google.cloud.videointelligence.v1.VideoSegmentU +segment_label_annotations ( 22.google.cloud.videointelligence.v1.LabelAnnotation^ +"segment_presence_label_annotations ( 22.google.cloud.videointelligence.v1.LabelAnnotationR +shot_label_annotations ( 22.google.cloud.videointelligence.v1.LabelAnnotation[ +shot_presence_label_annotations ( 22.google.cloud.videointelligence.v1.LabelAnnotationS +frame_label_annotations ( 22.google.cloud.videointelligence.v1.LabelAnnotationO +face_annotations ( 21.google.cloud.videointelligence.v1.FaceAnnotationB^ +face_detection_annotations ( 2:.google.cloud.videointelligence.v1.FaceDetectionAnnotationI +shot_annotations ( 2/.google.cloud.videointelligence.v1.VideoSegmentY +explicit_annotation ( 2<.google.cloud.videointelligence.v1.ExplicitContentAnnotationU +speech_transcriptions ( 26.google.cloud.videointelligence.v1.SpeechTranscriptionK +text_annotations ( 21.google.cloud.videointelligence.v1.TextAnnotationW +object_annotations ( 2;.google.cloud.videointelligence.v1.ObjectTrackingAnnotationb +logo_recognition_annotations ( 2<.google.cloud.videointelligence.v1.LogoRecognitionAnnotationb +person_detection_annotations ( 2<.google.cloud.videointelligence.v1.PersonDetectionAnnotation! +error ( 2.google.rpc.Status"n +AnnotateVideoResponseU +annotation_results ( 29.google.cloud.videointelligence.v1.VideoAnnotationResults" +VideoAnnotationProgress + input_uri (  +progress_percent (. + +start_time ( 2.google.protobuf.Timestamp/ + update_time ( 2.google.protobuf.Timestamp; +feature (2*.google.cloud.videointelligence.v1.Feature@ +segment ( 2/.google.cloud.videointelligence.v1.VideoSegment"p +AnnotateVideoProgressW +annotation_progress ( 2:.google.cloud.videointelligence.v1.VideoAnnotationProgress" +SpeechTranscriptionConfig + language_code ( BA +max_alternatives (BA +filter_profanity (BAN +speech_contexts ( 20.google.cloud.videointelligence.v1.SpeechContextBA) +enable_automatic_punctuation (BA + audio_tracks (BA\' +enable_speaker_diarization (BA& +diarization_speaker_count (BA# +enable_word_confidence (BA"% + SpeechContext +phrases ( BA" +SpeechTranscriptionU + alternatives ( 2?.google.cloud.videointelligence.v1.SpeechRecognitionAlternative + language_code ( BA" +SpeechRecognitionAlternative + +transcript (  + +confidence (BA? +words ( 2+.google.cloud.videointelligence.v1.WordInfoBA" +WordInfo- + +start_time ( 2.google.protobuf.Duration+ +end_time ( 2.google.protobuf.Duration +word (  + +confidence (BA + speaker_tag (BA"( +NormalizedVertex +x ( +y ("_ +NormalizedBoundingPolyE +vertices ( 23.google.cloud.videointelligence.v1.NormalizedVertex" + TextSegment@ +segment ( 2/.google.cloud.videointelligence.v1.VideoSegment + +confidence (< +frames ( 2,.google.cloud.videointelligence.v1.TextFrame" + TextFrameW +rotated_bounding_box ( 29.google.cloud.videointelligence.v1.NormalizedBoundingPoly. + time_offset ( 2.google.protobuf.Duration"q +TextAnnotation +text ( @ +segments ( 2..google.cloud.videointelligence.v1.TextSegment +version ( " +ObjectTrackingFrameY +normalized_bounding_box ( 28.google.cloud.videointelligence.v1.NormalizedBoundingBox. + time_offset ( 2.google.protobuf.Duration" +ObjectTrackingAnnotationB +segment ( 2/.google.cloud.videointelligence.v1.VideoSegmentH +track_id (H9 +entity ( 2).google.cloud.videointelligence.v1.Entity + +confidence (F +frames ( 26.google.cloud.videointelligence.v1.ObjectTrackingFrame +version ( B + +track_info" +LogoRecognitionAnnotation9 +entity ( 2).google.cloud.videointelligence.v1.Entity8 +tracks ( 2(.google.cloud.videointelligence.v1.TrackA +segments ( 2/.google.cloud.videointelligence.v1.VideoSegment* +Feature +FEATURE_UNSPECIFIED +LABEL_DETECTION +SHOT_CHANGE_DETECTION +EXPLICIT_CONTENT_DETECTION +FACE_DETECTION +SPEECH_TRANSCRIPTION +TEXT_DETECTION +OBJECT_TRACKING  +LOGO_RECOGNITION  +PERSON_DETECTION*r +LabelDetectionMode$ + LABEL_DETECTION_MODE_UNSPECIFIED + SHOT_MODE + +FRAME_MODE +SHOT_AND_FRAME_MODE*t + +Likelihood +LIKELIHOOD_UNSPECIFIED + VERY_UNLIKELY +UNLIKELY +POSSIBLE + +LIKELY + VERY_LIKELY2 +VideoIntelligenceService + AnnotateVideo7.google.cloud.videointelligence.v1.AnnotateVideoRequest.google.longrunning.Operation"dA. +AnnotateVideoResponseAnnotateVideoProgressAinput_uri,features"/v1/videos:annotate:*TA videointelligence.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +%com.google.cloud.videointelligence.v1BVideoIntelligenceServiceProtoPZScloud.google.com/go/videointelligence/apiv1/videointelligencepb;videointelligencepb!Google.Cloud.VideoIntelligence.V1!Google\\Cloud\\VideoIntelligence\\V1$Google::Cloud::VideoIntelligence::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoProgress.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoProgress.php new file mode 100644 index 00000000000..9018fd0c861 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoProgress.php @@ -0,0 +1,69 @@ +google.cloud.videointelligence.v1.AnnotateVideoProgress + */ +class AnnotateVideoProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationProgress annotation_progress = 1; + */ + private $annotation_progress; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\VideoAnnotationProgress>|\Google\Protobuf\Internal\RepeatedField $annotation_progress + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationProgress annotation_progress = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotationProgress() + { + return $this->annotation_progress; + } + + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationProgress annotation_progress = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\VideoAnnotationProgress>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotationProgress($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\VideoAnnotationProgress::class); + $this->annotation_progress = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoRequest.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoRequest.php new file mode 100644 index 00000000000..a83044c1c48 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoRequest.php @@ -0,0 +1,357 @@ +google.cloud.videointelligence.v1.AnnotateVideoRequest + */ +class AnnotateVideoRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * The video data bytes. + * If unset, the input video(s) should be specified via the `input_uri`. + * If set, `input_uri` must be unset. + * + * Generated from protobuf field bytes input_content = 6; + */ + protected $input_content = ''; + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $features; + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoContext video_context = 3; + */ + protected $video_context = null; + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported. These must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $output_uri = ''; + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no + * region is specified, the region will be determined based on video file + * location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $location_id = ''; + + /** + * @param string $inputUri Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * @param int[] $features Required. Requested video annotation features. + * For allowed values, use constants defined on {@see \Google\Cloud\VideoIntelligence\V1\Feature} + * + * @return \Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest + * + * @experimental + */ + public static function build(string $inputUri, array $features): self + { + return (new self()) + ->setInputUri($inputUri) + ->setFeatures($features); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * @type string $input_content + * The video data bytes. + * If unset, the input video(s) should be specified via the `input_uri`. + * If set, `input_uri` must be unset. + * @type array|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested video annotation features. + * @type \Google\Cloud\VideoIntelligence\V1\VideoContext $video_context + * Additional video context and/or feature-specific parameters. + * @type string $output_uri + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported. These must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * @type string $location_id + * Optional. Cloud region where annotation should take place. Supported cloud + * regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no + * region is specified, the region will be determined based on video file + * location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * The video data bytes. + * If unset, the input video(s) should be specified via the `input_uri`. + * If set, `input_uri` must be unset. + * + * Generated from protobuf field bytes input_content = 6; + * @return string + */ + public function getInputContent() + { + return $this->input_content; + } + + /** + * The video data bytes. + * If unset, the input video(s) should be specified via the `input_uri`. + * If set, `input_uri` must be unset. + * + * Generated from protobuf field bytes input_content = 6; + * @param string $var + * @return $this + */ + public function setInputContent($var) + { + GPBUtil::checkString($var, False); + $this->input_content = $var; + + return $this; + } + + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VideoIntelligence\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoContext video_context = 3; + * @return \Google\Cloud\VideoIntelligence\V1\VideoContext|null + */ + public function getVideoContext() + { + return $this->video_context; + } + + public function hasVideoContext() + { + return isset($this->video_context); + } + + public function clearVideoContext() + { + unset($this->video_context); + } + + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoContext video_context = 3; + * @param \Google\Cloud\VideoIntelligence\V1\VideoContext $var + * @return $this + */ + public function setVideoContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoContext::class); + $this->video_context = $var; + + return $this; + } + + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported. These must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOutputUri() + { + return $this->output_uri; + } + + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported. These must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOutputUri($var) + { + GPBUtil::checkString($var, True); + $this->output_uri = $var; + + return $this; + } + + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no + * region is specified, the region will be determined based on video file + * location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLocationId() + { + return $this->location_id; + } + + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no + * region is specified, the region will be determined based on video file + * location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLocationId($var) + { + GPBUtil::checkString($var, True); + $this->location_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoResponse.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoResponse.php new file mode 100644 index 00000000000..25d2c7cf89d --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/AnnotateVideoResponse.php @@ -0,0 +1,69 @@ +google.cloud.videointelligence.v1.AnnotateVideoResponse + */ +class AnnotateVideoResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationResults annotation_results = 1; + */ + private $annotation_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\VideoAnnotationResults>|\Google\Protobuf\Internal\RepeatedField $annotation_results + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationResults annotation_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotationResults() + { + return $this->annotation_results; + } + + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoAnnotationResults annotation_results = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\VideoAnnotationResults>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotationResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\VideoAnnotationResults::class); + $this->annotation_results = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedAttribute.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedAttribute.php new file mode 100644 index 00000000000..a3869d67c04 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedAttribute.php @@ -0,0 +1,143 @@ +google.cloud.videointelligence.v1.DetectedAttribute + */ +class DetectedAttribute extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the attribute, for example, glasses, dark_glasses, mouth_open. + * A full list of supported type names will be provided in the document. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Detected attribute confidence. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + /** + * Text value of the detection result. For example, the value for "HairColor" + * can be "black", "blonde", etc. + * + * Generated from protobuf field string value = 3; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the attribute, for example, glasses, dark_glasses, mouth_open. + * A full list of supported type names will be provided in the document. + * @type float $confidence + * Detected attribute confidence. Range [0, 1]. + * @type string $value + * Text value of the detection result. For example, the value for "HairColor" + * can be "black", "blonde", etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The name of the attribute, for example, glasses, dark_glasses, mouth_open. + * A full list of supported type names will be provided in the document. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the attribute, for example, glasses, dark_glasses, mouth_open. + * A full list of supported type names will be provided in the document. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Detected attribute confidence. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Detected attribute confidence. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Text value of the detection result. For example, the value for "HairColor" + * can be "black", "blonde", etc. + * + * Generated from protobuf field string value = 3; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Text value of the detection result. For example, the value for "HairColor" + * can be "black", "blonde", etc. + * + * Generated from protobuf field string value = 3; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedLandmark.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedLandmark.php new file mode 100644 index 00000000000..50f56b1a634 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/DetectedLandmark.php @@ -0,0 +1,150 @@ +google.cloud.videointelligence.v1.DetectedLandmark + */ +class DetectedLandmark extends \Google\Protobuf\Internal\Message +{ + /** + * The name of this landmark, for example, left_hand, right_shoulder. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The 2D point of the detected landmark using the normalized image + * coordindate system. The normalized coordinates have the range from 0 to 1. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedVertex point = 2; + */ + protected $point = null; + /** + * The confidence score of the detected landmark. Range [0, 1]. + * + * Generated from protobuf field float confidence = 3; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of this landmark, for example, left_hand, right_shoulder. + * @type \Google\Cloud\VideoIntelligence\V1\NormalizedVertex $point + * The 2D point of the detected landmark using the normalized image + * coordindate system. The normalized coordinates have the range from 0 to 1. + * @type float $confidence + * The confidence score of the detected landmark. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The name of this landmark, for example, left_hand, right_shoulder. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of this landmark, for example, left_hand, right_shoulder. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The 2D point of the detected landmark using the normalized image + * coordindate system. The normalized coordinates have the range from 0 to 1. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedVertex point = 2; + * @return \Google\Cloud\VideoIntelligence\V1\NormalizedVertex|null + */ + public function getPoint() + { + return $this->point; + } + + public function hasPoint() + { + return isset($this->point); + } + + public function clearPoint() + { + unset($this->point); + } + + /** + * The 2D point of the detected landmark using the normalized image + * coordindate system. The normalized coordinates have the range from 0 to 1. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedVertex point = 2; + * @param \Google\Cloud\VideoIntelligence\V1\NormalizedVertex $var + * @return $this + */ + public function setPoint($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedVertex::class); + $this->point = $var; + + return $this; + } + + /** + * The confidence score of the detected landmark. Range [0, 1]. + * + * Generated from protobuf field float confidence = 3; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The confidence score of the detected landmark. Range [0, 1]. + * + * Generated from protobuf field float confidence = 3; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Entity.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Entity.php new file mode 100644 index 00000000000..d62bc773e7d --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Entity.php @@ -0,0 +1,143 @@ +google.cloud.videointelligence.v1.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + */ + protected $entity_id = ''; + /** + * Textual description, e.g., `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $entity_id + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * @type string $description + * Textual description, e.g., `Fixed-gear bicycle`. + * @type string $language_code + * Language code for `description` in BCP-47 format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + * @return string + */ + public function getEntityId() + { + return $this->entity_id; + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + * @param string $var + * @return $this + */ + public function setEntityId($var) + { + GPBUtil::checkString($var, True); + $this->entity_id = $var; + + return $this; + } + + /** + * Textual description, e.g., `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Textual description, e.g., `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentAnnotation.php new file mode 100644 index 00000000000..dabb7a06148 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentAnnotation.php @@ -0,0 +1,103 @@ +google.cloud.videointelligence.v1.ExplicitContentAnnotation + */ +class ExplicitContentAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ExplicitContentFrame frames = 1; + */ + private $frames; + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\ExplicitContentFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where explicit content was detected. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ExplicitContentFrame frames = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ExplicitContentFrame frames = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\ExplicitContentFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\ExplicitContentFrame::class); + $this->frames = $arr; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentDetectionConfig.php new file mode 100644 index 00000000000..582cd1808f9 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentDetectionConfig.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1.ExplicitContentDetectionConfig + */ +class ExplicitContentDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentFrame.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentFrame.php new file mode 100644 index 00000000000..9d249b46301 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ExplicitContentFrame.php @@ -0,0 +1,115 @@ +google.cloud.videointelligence.v1.ExplicitContentFrame + */ +class ExplicitContentFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + */ + protected $time_offset = null; + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Likelihood pornography_likelihood = 2; + */ + protected $pornography_likelihood = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * @type int $pornography_likelihood + * Likelihood of the pornography content.. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Likelihood pornography_likelihood = 2; + * @return int + */ + public function getPornographyLikelihood() + { + return $this->pornography_likelihood; + } + + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Likelihood pornography_likelihood = 2; + * @param int $var + * @return $this + */ + public function setPornographyLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VideoIntelligence\V1\Likelihood::class); + $this->pornography_likelihood = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceAnnotation.php new file mode 100644 index 00000000000..6c8796da5c5 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceAnnotation.php @@ -0,0 +1,136 @@ +google.cloud.videointelligence.v1.FaceAnnotation + */ +class FaceAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + */ + protected $thumbnail = ''; + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceSegment segments = 2; + */ + private $segments; + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceFrame frames = 3; + */ + private $frames; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $thumbnail + * Thumbnail of a representative face view (in JPEG format). + * @type array<\Google\Cloud\VideoIntelligence\V1\FaceSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where a face was detected. + * @type array<\Google\Cloud\VideoIntelligence\V1\FaceFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where a face was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + * @return string + */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + * @param string $var + * @return $this + */ + public function setThumbnail($var) + { + GPBUtil::checkString($var, False); + $this->thumbnail = $var; + + return $this; + } + + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceSegment segments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceSegment segments = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\FaceSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\FaceSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceFrame frames = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceFrame frames = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\FaceFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\FaceFrame::class); + $this->frames = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionAnnotation.php new file mode 100644 index 00000000000..ebbbbc2c515 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionAnnotation.php @@ -0,0 +1,135 @@ +google.cloud.videointelligence.v1.FaceDetectionAnnotation + */ +class FaceDetectionAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * The face tracks with attributes. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 3; + */ + private $tracks; + /** + * The thumbnail of a person's face. + * + * Generated from protobuf field bytes thumbnail = 4; + */ + protected $thumbnail = ''; + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $tracks + * The face tracks with attributes. + * @type string $thumbnail + * The thumbnail of a person's face. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The face tracks with attributes. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTracks() + { + return $this->tracks; + } + + /** + * The face tracks with attributes. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTracks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\Track::class); + $this->tracks = $arr; + + return $this; + } + + /** + * The thumbnail of a person's face. + * + * Generated from protobuf field bytes thumbnail = 4; + * @return string + */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * The thumbnail of a person's face. + * + * Generated from protobuf field bytes thumbnail = 4; + * @param string $var + * @return $this + */ + public function setThumbnail($var) + { + GPBUtil::checkString($var, False); + $this->thumbnail = $var; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionConfig.php new file mode 100644 index 00000000000..4ff17755b38 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceDetectionConfig.php @@ -0,0 +1,147 @@ +google.cloud.videointelligence.v1.FaceDetectionConfig + */ +class FaceDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + /** + * Whether bounding boxes are included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + */ + protected $include_bounding_boxes = false; + /** + * Whether to enable face attributes detection, such as glasses, dark_glasses, + * mouth_open etc. Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 5; + */ + protected $include_attributes = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * @type bool $include_bounding_boxes + * Whether bounding boxes are included in the face annotation output. + * @type bool $include_attributes + * Whether to enable face attributes detection, such as glasses, dark_glasses, + * mouth_open etc. Ignored if 'include_bounding_boxes' is set to false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Whether bounding boxes are included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + * @return bool + */ + public function getIncludeBoundingBoxes() + { + return $this->include_bounding_boxes; + } + + /** + * Whether bounding boxes are included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + * @param bool $var + * @return $this + */ + public function setIncludeBoundingBoxes($var) + { + GPBUtil::checkBool($var); + $this->include_bounding_boxes = $var; + + return $this; + } + + /** + * Whether to enable face attributes detection, such as glasses, dark_glasses, + * mouth_open etc. Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 5; + * @return bool + */ + public function getIncludeAttributes() + { + return $this->include_attributes; + } + + /** + * Whether to enable face attributes detection, such as glasses, dark_glasses, + * mouth_open etc. Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 5; + * @param bool $var + * @return $this + */ + public function setIncludeAttributes($var) + { + GPBUtil::checkBool($var); + $this->include_attributes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceFrame.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceFrame.php new file mode 100644 index 00000000000..32de97e8e34 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceFrame.php @@ -0,0 +1,124 @@ +google.cloud.videointelligence.v1.FaceFrame + */ +class FaceFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_boxes = 1; + */ + private $normalized_bounding_boxes; + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + */ + protected $time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox>|\Google\Protobuf\Internal\RepeatedField $normalized_bounding_boxes + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_boxes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNormalizedBoundingBoxes() + { + return $this->normalized_bounding_boxes; + } + + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_boxes = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNormalizedBoundingBoxes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox::class); + $this->normalized_bounding_boxes = $arr; + + return $this; + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceSegment.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceSegment.php new file mode 100644 index 00000000000..66e742d5504 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/FaceSegment.php @@ -0,0 +1,77 @@ +google.cloud.videointelligence.v1.FaceSegment + */ +class FaceSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + */ + protected $segment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Video segment where a face was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Feature.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Feature.php new file mode 100644 index 00000000000..6a3a2b4518c --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Feature.php @@ -0,0 +1,110 @@ +google.cloud.videointelligence.v1.Feature + */ +class Feature +{ + /** + * Unspecified. + * + * Generated from protobuf enum FEATURE_UNSPECIFIED = 0; + */ + const FEATURE_UNSPECIFIED = 0; + /** + * Label detection. Detect objects, such as dog or flower. + * + * Generated from protobuf enum LABEL_DETECTION = 1; + */ + const LABEL_DETECTION = 1; + /** + * Shot change detection. + * + * Generated from protobuf enum SHOT_CHANGE_DETECTION = 2; + */ + const SHOT_CHANGE_DETECTION = 2; + /** + * Explicit content detection. + * + * Generated from protobuf enum EXPLICIT_CONTENT_DETECTION = 3; + */ + const EXPLICIT_CONTENT_DETECTION = 3; + /** + * Human face detection. + * + * Generated from protobuf enum FACE_DETECTION = 4; + */ + const FACE_DETECTION = 4; + /** + * Speech transcription. + * + * Generated from protobuf enum SPEECH_TRANSCRIPTION = 6; + */ + const SPEECH_TRANSCRIPTION = 6; + /** + * OCR text detection and tracking. + * + * Generated from protobuf enum TEXT_DETECTION = 7; + */ + const TEXT_DETECTION = 7; + /** + * Object detection and tracking. + * + * Generated from protobuf enum OBJECT_TRACKING = 9; + */ + const OBJECT_TRACKING = 9; + /** + * Logo detection, tracking, and recognition. + * + * Generated from protobuf enum LOGO_RECOGNITION = 12; + */ + const LOGO_RECOGNITION = 12; + /** + * Person detection. + * + * Generated from protobuf enum PERSON_DETECTION = 14; + */ + const PERSON_DETECTION = 14; + + private static $valueToName = [ + self::FEATURE_UNSPECIFIED => 'FEATURE_UNSPECIFIED', + self::LABEL_DETECTION => 'LABEL_DETECTION', + self::SHOT_CHANGE_DETECTION => 'SHOT_CHANGE_DETECTION', + self::EXPLICIT_CONTENT_DETECTION => 'EXPLICIT_CONTENT_DETECTION', + self::FACE_DETECTION => 'FACE_DETECTION', + self::SPEECH_TRANSCRIPTION => 'SPEECH_TRANSCRIPTION', + self::TEXT_DETECTION => 'TEXT_DETECTION', + self::OBJECT_TRACKING => 'OBJECT_TRACKING', + self::LOGO_RECOGNITION => 'LOGO_RECOGNITION', + self::PERSON_DETECTION => 'PERSON_DETECTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelAnnotation.php new file mode 100644 index 00000000000..5c9afbaef89 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelAnnotation.php @@ -0,0 +1,225 @@ +google.cloud.videointelligence.v1.LabelAnnotation + */ +class LabelAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + */ + protected $entity = null; + /** + * Common categories for the detected entity. + * For example, when the label is `Terrier`, the category is likely `dog`. And + * in some cases there might be more than one categories e.g., `Terrier` could + * also be a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Entity category_entities = 2; + */ + private $category_entities; + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelSegment segments = 3; + */ + private $segments; + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelFrame frames = 4; + */ + private $frames; + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\Entity $entity + * Detected entity. + * @type array<\Google\Cloud\VideoIntelligence\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $category_entities + * Common categories for the detected entity. + * For example, when the label is `Terrier`, the category is likely `dog`. And + * in some cases there might be more than one categories e.g., `Terrier` could + * also be a `pet`. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where a label was detected. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where a label was detected. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @return \Google\Cloud\VideoIntelligence\V1\Entity|null + */ + public function getEntity() + { + return $this->entity; + } + + public function hasEntity() + { + return isset($this->entity); + } + + public function clearEntity() + { + unset($this->entity); + } + + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @param \Google\Cloud\VideoIntelligence\V1\Entity $var + * @return $this + */ + public function setEntity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\Entity::class); + $this->entity = $var; + + return $this; + } + + /** + * Common categories for the detected entity. + * For example, when the label is `Terrier`, the category is likely `dog`. And + * in some cases there might be more than one categories e.g., `Terrier` could + * also be a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Entity category_entities = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategoryEntities() + { + return $this->category_entities; + } + + /** + * Common categories for the detected entity. + * For example, when the label is `Terrier`, the category is likely `dog`. And + * in some cases there might be more than one categories e.g., `Terrier` could + * also be a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Entity category_entities = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategoryEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\Entity::class); + $this->category_entities = $arr; + + return $this; + } + + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelSegment segments = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelSegment segments = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelFrame frames = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelFrame frames = 4; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelFrame::class); + $this->frames = $arr; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 5; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionConfig.php new file mode 100644 index 00000000000..b51b3128785 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionConfig.php @@ -0,0 +1,267 @@ +google.cloud.videointelligence.v1.LabelDetectionConfig + */ +class LabelDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionMode label_detection_mode = 1; + */ + protected $label_detection_mode = 0; + /** + * Whether the video has been shot from a stationary (i.e., non-moving) + * camera. When set to true, might improve detection accuracy for moving + * objects. Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + */ + protected $stationary_camera = false; + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + */ + protected $model = ''; + /** + * The confidence threshold we perform filtering on the labels from + * frame-level detection. If not set, it is set to 0.4 by default. The valid + * range for this threshold is [0.1, 0.9]. Any value set outside of this + * range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float frame_confidence_threshold = 4; + */ + protected $frame_confidence_threshold = 0.0; + /** + * The confidence threshold we perform filtering on the labels from + * video-level and shot-level detections. If not set, it's set to 0.3 by + * default. The valid range for this threshold is [0.1, 0.9]. Any value set + * outside of this range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float video_confidence_threshold = 5; + */ + protected $video_confidence_threshold = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $label_detection_mode + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * @type bool $stationary_camera + * Whether the video has been shot from a stationary (i.e., non-moving) + * camera. When set to true, might improve detection accuracy for moving + * objects. Should be used with `SHOT_AND_FRAME_MODE` enabled. + * @type string $model + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * @type float $frame_confidence_threshold + * The confidence threshold we perform filtering on the labels from + * frame-level detection. If not set, it is set to 0.4 by default. The valid + * range for this threshold is [0.1, 0.9]. Any value set outside of this + * range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * @type float $video_confidence_threshold + * The confidence threshold we perform filtering on the labels from + * video-level and shot-level detections. If not set, it's set to 0.3 by + * default. The valid range for this threshold is [0.1, 0.9]. Any value set + * outside of this range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionMode label_detection_mode = 1; + * @return int + */ + public function getLabelDetectionMode() + { + return $this->label_detection_mode; + } + + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionMode label_detection_mode = 1; + * @param int $var + * @return $this + */ + public function setLabelDetectionMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VideoIntelligence\V1\LabelDetectionMode::class); + $this->label_detection_mode = $var; + + return $this; + } + + /** + * Whether the video has been shot from a stationary (i.e., non-moving) + * camera. When set to true, might improve detection accuracy for moving + * objects. Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + * @return bool + */ + public function getStationaryCamera() + { + return $this->stationary_camera; + } + + /** + * Whether the video has been shot from a stationary (i.e., non-moving) + * camera. When set to true, might improve detection accuracy for moving + * objects. Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + * @param bool $var + * @return $this + */ + public function setStationaryCamera($var) + { + GPBUtil::checkBool($var); + $this->stationary_camera = $var; + + return $this; + } + + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The confidence threshold we perform filtering on the labels from + * frame-level detection. If not set, it is set to 0.4 by default. The valid + * range for this threshold is [0.1, 0.9]. Any value set outside of this + * range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float frame_confidence_threshold = 4; + * @return float + */ + public function getFrameConfidenceThreshold() + { + return $this->frame_confidence_threshold; + } + + /** + * The confidence threshold we perform filtering on the labels from + * frame-level detection. If not set, it is set to 0.4 by default. The valid + * range for this threshold is [0.1, 0.9]. Any value set outside of this + * range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float frame_confidence_threshold = 4; + * @param float $var + * @return $this + */ + public function setFrameConfidenceThreshold($var) + { + GPBUtil::checkFloat($var); + $this->frame_confidence_threshold = $var; + + return $this; + } + + /** + * The confidence threshold we perform filtering on the labels from + * video-level and shot-level detections. If not set, it's set to 0.3 by + * default. The valid range for this threshold is [0.1, 0.9]. Any value set + * outside of this range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float video_confidence_threshold = 5; + * @return float + */ + public function getVideoConfidenceThreshold() + { + return $this->video_confidence_threshold; + } + + /** + * The confidence threshold we perform filtering on the labels from + * video-level and shot-level detections. If not set, it's set to 0.3 by + * default. The valid range for this threshold is [0.1, 0.9]. Any value set + * outside of this range will be clipped. + * Note: For best results, follow the default threshold. We will update + * the default threshold everytime when we release a new model. + * + * Generated from protobuf field float video_confidence_threshold = 5; + * @param float $var + * @return $this + */ + public function setVideoConfidenceThreshold($var) + { + GPBUtil::checkFloat($var); + $this->video_confidence_threshold = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionMode.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionMode.php new file mode 100644 index 00000000000..0f2117f3fd5 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelDetectionMode.php @@ -0,0 +1,68 @@ +google.cloud.videointelligence.v1.LabelDetectionMode + */ +class LabelDetectionMode +{ + /** + * Unspecified. + * + * Generated from protobuf enum LABEL_DETECTION_MODE_UNSPECIFIED = 0; + */ + const LABEL_DETECTION_MODE_UNSPECIFIED = 0; + /** + * Detect shot-level labels. + * + * Generated from protobuf enum SHOT_MODE = 1; + */ + const SHOT_MODE = 1; + /** + * Detect frame-level labels. + * + * Generated from protobuf enum FRAME_MODE = 2; + */ + const FRAME_MODE = 2; + /** + * Detect both shot-level and frame-level labels. + * + * Generated from protobuf enum SHOT_AND_FRAME_MODE = 3; + */ + const SHOT_AND_FRAME_MODE = 3; + + private static $valueToName = [ + self::LABEL_DETECTION_MODE_UNSPECIFIED => 'LABEL_DETECTION_MODE_UNSPECIFIED', + self::SHOT_MODE => 'SHOT_MODE', + self::FRAME_MODE => 'FRAME_MODE', + self::SHOT_AND_FRAME_MODE => 'SHOT_AND_FRAME_MODE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelFrame.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelFrame.php new file mode 100644 index 00000000000..4d84657a20c --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelFrame.php @@ -0,0 +1,115 @@ +google.cloud.videointelligence.v1.LabelFrame + */ +class LabelFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + */ + protected $time_offset = null; + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * @type float $confidence + * Confidence that the label is accurate. Range: [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelSegment.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelSegment.php new file mode 100644 index 00000000000..c605883d795 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LabelSegment.php @@ -0,0 +1,111 @@ +google.cloud.videointelligence.v1.LabelSegment + */ +class LabelSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + */ + protected $segment = null; + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Video segment where a label was detected. + * @type float $confidence + * Confidence that the label is accurate. Range: [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Likelihood.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Likelihood.php new file mode 100644 index 00000000000..605525be5d5 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Likelihood.php @@ -0,0 +1,82 @@ +google.cloud.videointelligence.v1.Likelihood + */ +class Likelihood +{ + /** + * Unspecified likelihood. + * + * Generated from protobuf enum LIKELIHOOD_UNSPECIFIED = 0; + */ + const LIKELIHOOD_UNSPECIFIED = 0; + /** + * Very unlikely. + * + * Generated from protobuf enum VERY_UNLIKELY = 1; + */ + const VERY_UNLIKELY = 1; + /** + * Unlikely. + * + * Generated from protobuf enum UNLIKELY = 2; + */ + const UNLIKELY = 2; + /** + * Possible. + * + * Generated from protobuf enum POSSIBLE = 3; + */ + const POSSIBLE = 3; + /** + * Likely. + * + * Generated from protobuf enum LIKELY = 4; + */ + const LIKELY = 4; + /** + * Very likely. + * + * Generated from protobuf enum VERY_LIKELY = 5; + */ + const VERY_LIKELY = 5; + + private static $valueToName = [ + self::LIKELIHOOD_UNSPECIFIED => 'LIKELIHOOD_UNSPECIFIED', + self::VERY_UNLIKELY => 'VERY_UNLIKELY', + self::UNLIKELY => 'UNLIKELY', + self::POSSIBLE => 'POSSIBLE', + self::LIKELY => 'LIKELY', + self::VERY_LIKELY => 'VERY_LIKELY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LogoRecognitionAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LogoRecognitionAnnotation.php new file mode 100644 index 00000000000..2745490b4b1 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/LogoRecognitionAnnotation.php @@ -0,0 +1,157 @@ +google.cloud.videointelligence.v1.LogoRecognitionAnnotation + */ +class LogoRecognitionAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Entity category information to specify the logo class that all the logo + * tracks within this LogoRecognitionAnnotation are recognized as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + */ + protected $entity = null; + /** + * All logo tracks where the recognized logo appears. Each track corresponds + * to one logo instance appearing in consecutive frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 2; + */ + private $tracks; + /** + * All video segments where the recognized logo appears. There might be + * multiple instances of the same logo class appearing in one VideoSegment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 3; + */ + private $segments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\Entity $entity + * Entity category information to specify the logo class that all the logo + * tracks within this LogoRecognitionAnnotation are recognized as. + * @type array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $tracks + * All logo tracks where the recognized logo appears. Each track corresponds + * to one logo instance appearing in consecutive frames. + * @type array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where the recognized logo appears. There might be + * multiple instances of the same logo class appearing in one VideoSegment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Entity category information to specify the logo class that all the logo + * tracks within this LogoRecognitionAnnotation are recognized as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @return \Google\Cloud\VideoIntelligence\V1\Entity|null + */ + public function getEntity() + { + return $this->entity; + } + + public function hasEntity() + { + return isset($this->entity); + } + + public function clearEntity() + { + unset($this->entity); + } + + /** + * Entity category information to specify the logo class that all the logo + * tracks within this LogoRecognitionAnnotation are recognized as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @param \Google\Cloud\VideoIntelligence\V1\Entity $var + * @return $this + */ + public function setEntity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\Entity::class); + $this->entity = $var; + + return $this; + } + + /** + * All logo tracks where the recognized logo appears. Each track corresponds + * to one logo instance appearing in consecutive frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTracks() + { + return $this->tracks; + } + + /** + * All logo tracks where the recognized logo appears. Each track corresponds + * to one logo instance appearing in consecutive frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTracks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\Track::class); + $this->tracks = $arr; + + return $this; + } + + /** + * All video segments where the recognized logo appears. There might be + * multiple instances of the same logo class appearing in one VideoSegment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where the recognized logo appears. There might be + * multiple instances of the same logo class appearing in one VideoSegment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segments = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingBox.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingBox.php new file mode 100644 index 00000000000..8f33cb0d7cb --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingBox.php @@ -0,0 +1,171 @@ +google.cloud.videointelligence.v1.NormalizedBoundingBox + */ +class NormalizedBoundingBox extends \Google\Protobuf\Internal\Message +{ + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + */ + protected $left = 0.0; + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + */ + protected $top = 0.0; + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + */ + protected $right = 0.0; + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + */ + protected $bottom = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $left + * Left X coordinate. + * @type float $top + * Top Y coordinate. + * @type float $right + * Right X coordinate. + * @type float $bottom + * Bottom Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + * @return float + */ + public function getLeft() + { + return $this->left; + } + + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + * @param float $var + * @return $this + */ + public function setLeft($var) + { + GPBUtil::checkFloat($var); + $this->left = $var; + + return $this; + } + + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + * @return float + */ + public function getTop() + { + return $this->top; + } + + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + * @param float $var + * @return $this + */ + public function setTop($var) + { + GPBUtil::checkFloat($var); + $this->top = $var; + + return $this; + } + + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + * @return float + */ + public function getRight() + { + return $this->right; + } + + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + * @param float $var + * @return $this + */ + public function setRight($var) + { + GPBUtil::checkFloat($var); + $this->right = $var; + + return $this; + } + + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + * @return float + */ + public function getBottom() + { + return $this->bottom; + } + + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + * @param float $var + * @return $this + */ + public function setBottom($var) + { + GPBUtil::checkFloat($var); + $this->bottom = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingPoly.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingPoly.php new file mode 100644 index 00000000000..f69adf5d916 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedBoundingPoly.php @@ -0,0 +1,81 @@ +google.cloud.videointelligence.v1.NormalizedBoundingPoly + */ +class NormalizedBoundingPoly extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized vertices of the bounding polygon. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedVertex vertices = 1; + */ + private $vertices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $vertices + * Normalized vertices of the bounding polygon. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Normalized vertices of the bounding polygon. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedVertex vertices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVertices() + { + return $this->vertices; + } + + /** + * Normalized vertices of the bounding polygon. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.NormalizedVertex vertices = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\NormalizedVertex::class); + $this->vertices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedVertex.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedVertex.php new file mode 100644 index 00000000000..a3085020383 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/NormalizedVertex.php @@ -0,0 +1,103 @@ +google.cloud.videointelligence.v1.NormalizedVertex + */ +class NormalizedVertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + protected $x = 0.0; + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + */ + protected $y = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingAnnotation.php new file mode 100644 index 00000000000..8ba52ba7fbb --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingAnnotation.php @@ -0,0 +1,284 @@ +google.cloud.videointelligence.v1.ObjectTrackingAnnotation + */ +class ObjectTrackingAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Entity to specify the object category that this track is labeled as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + */ + protected $entity = null; + /** + * Object category's labeling confidence of this track. + * + * Generated from protobuf field float confidence = 4; + */ + protected $confidence = 0.0; + /** + * Information corresponding to all frames where this object track appears. + * Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame + * messages in frames. + * Streaming mode: it can only be one ObjectTrackingFrame message in frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingFrame frames = 2; + */ + private $frames; + /** + * Feature version. + * + * Generated from protobuf field string version = 6; + */ + protected $version = ''; + protected $track_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Non-streaming batch mode ONLY. + * Each object track corresponds to one video segment where it appears. + * @type int|string $track_id + * Streaming mode ONLY. + * In streaming mode, we do not know the end time of a tracked object + * before it is completed. Hence, there is no VideoSegment info returned. + * Instead, we provide a unique identifiable integer track_id so that + * the customers can correlate the results of the ongoing + * ObjectTrackAnnotation of the same track_id over time. + * @type \Google\Cloud\VideoIntelligence\V1\Entity $entity + * Entity to specify the object category that this track is labeled as. + * @type float $confidence + * Object category's labeling confidence of this track. + * @type array<\Google\Cloud\VideoIntelligence\V1\ObjectTrackingFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * Information corresponding to all frames where this object track appears. + * Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame + * messages in frames. + * Streaming mode: it can only be one ObjectTrackingFrame message in frames. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Non-streaming batch mode ONLY. + * Each object track corresponds to one video segment where it appears. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 3; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->readOneof(3); + } + + public function hasSegment() + { + return $this->hasOneof(3); + } + + /** + * Non-streaming batch mode ONLY. + * Each object track corresponds to one video segment where it appears. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 3; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Streaming mode ONLY. + * In streaming mode, we do not know the end time of a tracked object + * before it is completed. Hence, there is no VideoSegment info returned. + * Instead, we provide a unique identifiable integer track_id so that + * the customers can correlate the results of the ongoing + * ObjectTrackAnnotation of the same track_id over time. + * + * Generated from protobuf field int64 track_id = 5; + * @return int|string + */ + public function getTrackId() + { + return $this->readOneof(5); + } + + public function hasTrackId() + { + return $this->hasOneof(5); + } + + /** + * Streaming mode ONLY. + * In streaming mode, we do not know the end time of a tracked object + * before it is completed. Hence, there is no VideoSegment info returned. + * Instead, we provide a unique identifiable integer track_id so that + * the customers can correlate the results of the ongoing + * ObjectTrackAnnotation of the same track_id over time. + * + * Generated from protobuf field int64 track_id = 5; + * @param int|string $var + * @return $this + */ + public function setTrackId($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Entity to specify the object category that this track is labeled as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @return \Google\Cloud\VideoIntelligence\V1\Entity|null + */ + public function getEntity() + { + return $this->entity; + } + + public function hasEntity() + { + return isset($this->entity); + } + + public function clearEntity() + { + unset($this->entity); + } + + /** + * Entity to specify the object category that this track is labeled as. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Entity entity = 1; + * @param \Google\Cloud\VideoIntelligence\V1\Entity $var + * @return $this + */ + public function setEntity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\Entity::class); + $this->entity = $var; + + return $this; + } + + /** + * Object category's labeling confidence of this track. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Object category's labeling confidence of this track. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Information corresponding to all frames where this object track appears. + * Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame + * messages in frames. + * Streaming mode: it can only be one ObjectTrackingFrame message in frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingFrame frames = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * Information corresponding to all frames where this object track appears. + * Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame + * messages in frames. + * Streaming mode: it can only be one ObjectTrackingFrame message in frames. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingFrame frames = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\ObjectTrackingFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\ObjectTrackingFrame::class); + $this->frames = $arr; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 6; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 6; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * @return string + */ + public function getTrackInfo() + { + return $this->whichOneof("track_info"); + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingConfig.php new file mode 100644 index 00000000000..25de54434f6 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingConfig.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1.ObjectTrackingConfig + */ +class ObjectTrackingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for object tracking. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for object tracking. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for object tracking. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for object tracking. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingFrame.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingFrame.php new file mode 100644 index 00000000000..88cc134fb3c --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ObjectTrackingFrame.php @@ -0,0 +1,122 @@ +google.cloud.videointelligence.v1.ObjectTrackingFrame + */ +class ObjectTrackingFrame extends \Google\Protobuf\Internal\Message +{ + /** + * The normalized bounding box location of this object track for the frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + */ + protected $normalized_bounding_box = null; + /** + * The timestamp of the frame in microseconds. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + */ + protected $time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox $normalized_bounding_box + * The normalized bounding box location of this object track for the frame. + * @type \Google\Protobuf\Duration $time_offset + * The timestamp of the frame in microseconds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The normalized bounding box location of this object track for the frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + * @return \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox|null + */ + public function getNormalizedBoundingBox() + { + return $this->normalized_bounding_box; + } + + public function hasNormalizedBoundingBox() + { + return isset($this->normalized_bounding_box); + } + + public function clearNormalizedBoundingBox() + { + unset($this->normalized_bounding_box); + } + + /** + * The normalized bounding box location of this object track for the frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + * @param \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox $var + * @return $this + */ + public function setNormalizedBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox::class); + $this->normalized_bounding_box = $var; + + return $this; + } + + /** + * The timestamp of the frame in microseconds. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * The timestamp of the frame in microseconds. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionAnnotation.php new file mode 100644 index 00000000000..6d98140dbbe --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionAnnotation.php @@ -0,0 +1,101 @@ +google.cloud.videointelligence.v1.PersonDetectionAnnotation + */ +class PersonDetectionAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * The detected tracks of a person. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 1; + */ + private $tracks; + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $tracks + * The detected tracks of a person. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The detected tracks of a person. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTracks() + { + return $this->tracks; + } + + /** + * The detected tracks of a person. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.Track tracks = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\Track>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTracks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\Track::class); + $this->tracks = $arr; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionConfig.php new file mode 100644 index 00000000000..d3bb4963b47 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/PersonDetectionConfig.php @@ -0,0 +1,155 @@ +google.cloud.videointelligence.v1.PersonDetectionConfig + */ +class PersonDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Whether bounding boxes are included in the person detection annotation + * output. + * + * Generated from protobuf field bool include_bounding_boxes = 1; + */ + protected $include_bounding_boxes = false; + /** + * Whether to enable pose landmarks detection. Ignored if + * 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_pose_landmarks = 2; + */ + protected $include_pose_landmarks = false; + /** + * Whether to enable person attributes detection, such as cloth color (black, + * blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair, + * etc. + * Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 3; + */ + protected $include_attributes = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $include_bounding_boxes + * Whether bounding boxes are included in the person detection annotation + * output. + * @type bool $include_pose_landmarks + * Whether to enable pose landmarks detection. Ignored if + * 'include_bounding_boxes' is set to false. + * @type bool $include_attributes + * Whether to enable person attributes detection, such as cloth color (black, + * blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair, + * etc. + * Ignored if 'include_bounding_boxes' is set to false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Whether bounding boxes are included in the person detection annotation + * output. + * + * Generated from protobuf field bool include_bounding_boxes = 1; + * @return bool + */ + public function getIncludeBoundingBoxes() + { + return $this->include_bounding_boxes; + } + + /** + * Whether bounding boxes are included in the person detection annotation + * output. + * + * Generated from protobuf field bool include_bounding_boxes = 1; + * @param bool $var + * @return $this + */ + public function setIncludeBoundingBoxes($var) + { + GPBUtil::checkBool($var); + $this->include_bounding_boxes = $var; + + return $this; + } + + /** + * Whether to enable pose landmarks detection. Ignored if + * 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_pose_landmarks = 2; + * @return bool + */ + public function getIncludePoseLandmarks() + { + return $this->include_pose_landmarks; + } + + /** + * Whether to enable pose landmarks detection. Ignored if + * 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_pose_landmarks = 2; + * @param bool $var + * @return $this + */ + public function setIncludePoseLandmarks($var) + { + GPBUtil::checkBool($var); + $this->include_pose_landmarks = $var; + + return $this; + } + + /** + * Whether to enable person attributes detection, such as cloth color (black, + * blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair, + * etc. + * Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 3; + * @return bool + */ + public function getIncludeAttributes() + { + return $this->include_attributes; + } + + /** + * Whether to enable person attributes detection, such as cloth color (black, + * blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair, + * etc. + * Ignored if 'include_bounding_boxes' is set to false. + * + * Generated from protobuf field bool include_attributes = 3; + * @param bool $var + * @return $this + */ + public function setIncludeAttributes($var) + { + GPBUtil::checkBool($var); + $this->include_attributes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ShotChangeDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ShotChangeDetectionConfig.php new file mode 100644 index 00000000000..48f8998705f --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/ShotChangeDetectionConfig.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1.ShotChangeDetectionConfig + */ +class ShotChangeDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechContext.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechContext.php new file mode 100644 index 00000000000..e8e49aff263 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechContext.php @@ -0,0 +1,88 @@ +google.cloud.videointelligence.v1.SpeechContext + */ +class SpeechContext extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. A list of strings containing words and phrases "hints" so that + * the speech recognition is more likely to recognize them. This can be used + * to improve the accuracy for specific words and phrases, for example, if + * specific commands are typically spoken by the user. This can also be used + * to add additional words to the vocabulary of the recognizer. See + * [usage limits](https://cloud.google.com/speech/limits#content). + * + * Generated from protobuf field repeated string phrases = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $phrases; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $phrases + * Optional. A list of strings containing words and phrases "hints" so that + * the speech recognition is more likely to recognize them. This can be used + * to improve the accuracy for specific words and phrases, for example, if + * specific commands are typically spoken by the user. This can also be used + * to add additional words to the vocabulary of the recognizer. See + * [usage limits](https://cloud.google.com/speech/limits#content). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Optional. A list of strings containing words and phrases "hints" so that + * the speech recognition is more likely to recognize them. This can be used + * to improve the accuracy for specific words and phrases, for example, if + * specific commands are typically spoken by the user. This can also be used + * to add additional words to the vocabulary of the recognizer. See + * [usage limits](https://cloud.google.com/speech/limits#content). + * + * Generated from protobuf field repeated string phrases = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPhrases() + { + return $this->phrases; + } + + /** + * Optional. A list of strings containing words and phrases "hints" so that + * the speech recognition is more likely to recognize them. This can be used + * to improve the accuracy for specific words and phrases, for example, if + * specific commands are typically spoken by the user. This can also be used + * to add additional words to the vocabulary of the recognizer. See + * [usage limits](https://cloud.google.com/speech/limits#content). + * + * Generated from protobuf field repeated string phrases = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPhrases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->phrases = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechRecognitionAlternative.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechRecognitionAlternative.php new file mode 100644 index 00000000000..38d349c1b07 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechRecognitionAlternative.php @@ -0,0 +1,163 @@ +google.cloud.videointelligence.v1.SpeechRecognitionAlternative + */ +class SpeechRecognitionAlternative extends \Google\Protobuf\Internal\Message +{ + /** + * Transcript text representing the words that the user spoke. + * + * Generated from protobuf field string transcript = 1; + */ + protected $transcript = ''; + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $confidence = 0.0; + /** + * Output only. A list of word-specific information for each recognized word. + * Note: When `enable_speaker_diarization` is set to true, you will see all + * the words from the beginning of the audio. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.WordInfo words = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $words; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $transcript + * Transcript text representing the words that the user spoke. + * @type float $confidence + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * @type array<\Google\Cloud\VideoIntelligence\V1\WordInfo>|\Google\Protobuf\Internal\RepeatedField $words + * Output only. A list of word-specific information for each recognized word. + * Note: When `enable_speaker_diarization` is set to true, you will see all + * the words from the beginning of the audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Transcript text representing the words that the user spoke. + * + * Generated from protobuf field string transcript = 1; + * @return string + */ + public function getTranscript() + { + return $this->transcript; + } + + /** + * Transcript text representing the words that the user spoke. + * + * Generated from protobuf field string transcript = 1; + * @param string $var + * @return $this + */ + public function setTranscript($var) + { + GPBUtil::checkString($var, True); + $this->transcript = $var; + + return $this; + } + + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Output only. A list of word-specific information for each recognized word. + * Note: When `enable_speaker_diarization` is set to true, you will see all + * the words from the beginning of the audio. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.WordInfo words = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWords() + { + return $this->words; + } + + /** + * Output only. A list of word-specific information for each recognized word. + * Note: When `enable_speaker_diarization` is set to true, you will see all + * the words from the beginning of the audio. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.WordInfo words = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VideoIntelligence\V1\WordInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\WordInfo::class); + $this->words = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscription.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscription.php new file mode 100644 index 00000000000..b42482f5ddf --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscription.php @@ -0,0 +1,121 @@ +google.cloud.videointelligence.v1.SpeechTranscription + */ +class SpeechTranscription extends \Google\Protobuf\Internal\Message +{ + /** + * May contain one or more recognition hypotheses (up to the maximum specified + * in `max_alternatives`). These alternatives are ordered in terms of + * accuracy, with the top (first) alternative being the most probable, as + * ranked by the recognizer. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechRecognitionAlternative alternatives = 1; + */ + private $alternatives; + /** + * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag of the language in this result. This language code was + * detected to have the most likelihood of being spoken in the audio. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\SpeechRecognitionAlternative>|\Google\Protobuf\Internal\RepeatedField $alternatives + * May contain one or more recognition hypotheses (up to the maximum specified + * in `max_alternatives`). These alternatives are ordered in terms of + * accuracy, with the top (first) alternative being the most probable, as + * ranked by the recognizer. + * @type string $language_code + * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag of the language in this result. This language code was + * detected to have the most likelihood of being spoken in the audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * May contain one or more recognition hypotheses (up to the maximum specified + * in `max_alternatives`). These alternatives are ordered in terms of + * accuracy, with the top (first) alternative being the most probable, as + * ranked by the recognizer. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechRecognitionAlternative alternatives = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAlternatives() + { + return $this->alternatives; + } + + /** + * May contain one or more recognition hypotheses (up to the maximum specified + * in `max_alternatives`). These alternatives are ordered in terms of + * accuracy, with the top (first) alternative being the most probable, as + * ranked by the recognizer. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechRecognitionAlternative alternatives = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\SpeechRecognitionAlternative>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAlternatives($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\SpeechRecognitionAlternative::class); + $this->alternatives = $arr; + + return $this; + } + + /** + * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag of the language in this result. This language code was + * detected to have the most likelihood of being spoken in the audio. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag of the language in this result. This language code was + * detected to have the most likelihood of being spoken in the audio. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscriptionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscriptionConfig.php new file mode 100644 index 00000000000..1c0f54e6f1b --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/SpeechTranscriptionConfig.php @@ -0,0 +1,447 @@ +google.cloud.videointelligence.v1.SpeechTranscriptionConfig + */ +class SpeechTranscriptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. *Required* The language of the supplied audio as a + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * Example: "en-US". + * See [Language Support](https://cloud.google.com/speech/docs/languages) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + /** + * Optional. Maximum number of recognition hypotheses to be returned. + * Specifically, the maximum number of `SpeechRecognitionAlternative` messages + * within each `SpeechTranscription`. The server may return fewer than + * `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will + * return a maximum of one. If omitted, will return a maximum of one. + * + * Generated from protobuf field int32 max_alternatives = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_alternatives = 0; + /** + * Optional. If set to `true`, the server will attempt to filter out + * profanities, replacing all but the initial character in each filtered word + * with asterisks, e.g. "f***". If set to `false` or omitted, profanities + * won't be filtered out. + * + * Generated from protobuf field bool filter_profanity = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter_profanity = false; + /** + * Optional. A means to provide context to assist the speech recognition. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechContext speech_contexts = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $speech_contexts; + /** + * Optional. If 'true', adds punctuation to recognition result hypotheses. + * This feature is only available in select languages. Setting this for + * requests in other languages has no effect at all. The default 'false' value + * does not add punctuation to result hypotheses. NOTE: "This is currently + * offered as an experimental service, complimentary to all users. In the + * future this may be exclusively available as a premium feature." + * + * Generated from protobuf field bool enable_automatic_punctuation = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_automatic_punctuation = false; + /** + * Optional. For file formats, such as MXF or MKV, supporting multiple audio + * tracks, specify up to two tracks. Default: track 0. + * + * Generated from protobuf field repeated int32 audio_tracks = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $audio_tracks; + /** + * Optional. If 'true', enables speaker detection for each recognized word in + * the top alternative of the recognition result using a speaker_tag provided + * in the WordInfo. + * Note: When this is true, we send all the words from the beginning of the + * audio for the top alternative in every consecutive response. + * This is done in order to improve our speaker tags as our models learn to + * identify the speakers in the conversation over time. + * + * Generated from protobuf field bool enable_speaker_diarization = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_speaker_diarization = false; + /** + * Optional. If set, specifies the estimated number of speakers in the + * conversation. If not set, defaults to '2'. Ignored unless + * enable_speaker_diarization is set to true. + * + * Generated from protobuf field int32 diarization_speaker_count = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $diarization_speaker_count = 0; + /** + * Optional. If `true`, the top result includes a list of words and the + * confidence for those words. If `false`, no word-level confidence + * information is returned. The default is `false`. + * + * Generated from protobuf field bool enable_word_confidence = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_word_confidence = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * Required. *Required* The language of the supplied audio as a + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * Example: "en-US". + * See [Language Support](https://cloud.google.com/speech/docs/languages) + * for a list of the currently supported language codes. + * @type int $max_alternatives + * Optional. Maximum number of recognition hypotheses to be returned. + * Specifically, the maximum number of `SpeechRecognitionAlternative` messages + * within each `SpeechTranscription`. The server may return fewer than + * `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will + * return a maximum of one. If omitted, will return a maximum of one. + * @type bool $filter_profanity + * Optional. If set to `true`, the server will attempt to filter out + * profanities, replacing all but the initial character in each filtered word + * with asterisks, e.g. "f***". If set to `false` or omitted, profanities + * won't be filtered out. + * @type array<\Google\Cloud\VideoIntelligence\V1\SpeechContext>|\Google\Protobuf\Internal\RepeatedField $speech_contexts + * Optional. A means to provide context to assist the speech recognition. + * @type bool $enable_automatic_punctuation + * Optional. If 'true', adds punctuation to recognition result hypotheses. + * This feature is only available in select languages. Setting this for + * requests in other languages has no effect at all. The default 'false' value + * does not add punctuation to result hypotheses. NOTE: "This is currently + * offered as an experimental service, complimentary to all users. In the + * future this may be exclusively available as a premium feature." + * @type array|\Google\Protobuf\Internal\RepeatedField $audio_tracks + * Optional. For file formats, such as MXF or MKV, supporting multiple audio + * tracks, specify up to two tracks. Default: track 0. + * @type bool $enable_speaker_diarization + * Optional. If 'true', enables speaker detection for each recognized word in + * the top alternative of the recognition result using a speaker_tag provided + * in the WordInfo. + * Note: When this is true, we send all the words from the beginning of the + * audio for the top alternative in every consecutive response. + * This is done in order to improve our speaker tags as our models learn to + * identify the speakers in the conversation over time. + * @type int $diarization_speaker_count + * Optional. If set, specifies the estimated number of speakers in the + * conversation. If not set, defaults to '2'. Ignored unless + * enable_speaker_diarization is set to true. + * @type bool $enable_word_confidence + * Optional. If `true`, the top result includes a list of words and the + * confidence for those words. If `false`, no word-level confidence + * information is returned. The default is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Required. *Required* The language of the supplied audio as a + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * Example: "en-US". + * See [Language Support](https://cloud.google.com/speech/docs/languages) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. *Required* The language of the supplied audio as a + * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + * Example: "en-US". + * See [Language Support](https://cloud.google.com/speech/docs/languages) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Optional. Maximum number of recognition hypotheses to be returned. + * Specifically, the maximum number of `SpeechRecognitionAlternative` messages + * within each `SpeechTranscription`. The server may return fewer than + * `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will + * return a maximum of one. If omitted, will return a maximum of one. + * + * Generated from protobuf field int32 max_alternatives = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMaxAlternatives() + { + return $this->max_alternatives; + } + + /** + * Optional. Maximum number of recognition hypotheses to be returned. + * Specifically, the maximum number of `SpeechRecognitionAlternative` messages + * within each `SpeechTranscription`. The server may return fewer than + * `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will + * return a maximum of one. If omitted, will return a maximum of one. + * + * Generated from protobuf field int32 max_alternatives = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMaxAlternatives($var) + { + GPBUtil::checkInt32($var); + $this->max_alternatives = $var; + + return $this; + } + + /** + * Optional. If set to `true`, the server will attempt to filter out + * profanities, replacing all but the initial character in each filtered word + * with asterisks, e.g. "f***". If set to `false` or omitted, profanities + * won't be filtered out. + * + * Generated from protobuf field bool filter_profanity = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getFilterProfanity() + { + return $this->filter_profanity; + } + + /** + * Optional. If set to `true`, the server will attempt to filter out + * profanities, replacing all but the initial character in each filtered word + * with asterisks, e.g. "f***". If set to `false` or omitted, profanities + * won't be filtered out. + * + * Generated from protobuf field bool filter_profanity = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setFilterProfanity($var) + { + GPBUtil::checkBool($var); + $this->filter_profanity = $var; + + return $this; + } + + /** + * Optional. A means to provide context to assist the speech recognition. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechContext speech_contexts = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpeechContexts() + { + return $this->speech_contexts; + } + + /** + * Optional. A means to provide context to assist the speech recognition. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechContext speech_contexts = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\VideoIntelligence\V1\SpeechContext>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpeechContexts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\SpeechContext::class); + $this->speech_contexts = $arr; + + return $this; + } + + /** + * Optional. If 'true', adds punctuation to recognition result hypotheses. + * This feature is only available in select languages. Setting this for + * requests in other languages has no effect at all. The default 'false' value + * does not add punctuation to result hypotheses. NOTE: "This is currently + * offered as an experimental service, complimentary to all users. In the + * future this may be exclusively available as a premium feature." + * + * Generated from protobuf field bool enable_automatic_punctuation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableAutomaticPunctuation() + { + return $this->enable_automatic_punctuation; + } + + /** + * Optional. If 'true', adds punctuation to recognition result hypotheses. + * This feature is only available in select languages. Setting this for + * requests in other languages has no effect at all. The default 'false' value + * does not add punctuation to result hypotheses. NOTE: "This is currently + * offered as an experimental service, complimentary to all users. In the + * future this may be exclusively available as a premium feature." + * + * Generated from protobuf field bool enable_automatic_punctuation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableAutomaticPunctuation($var) + { + GPBUtil::checkBool($var); + $this->enable_automatic_punctuation = $var; + + return $this; + } + + /** + * Optional. For file formats, such as MXF or MKV, supporting multiple audio + * tracks, specify up to two tracks. Default: track 0. + * + * Generated from protobuf field repeated int32 audio_tracks = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAudioTracks() + { + return $this->audio_tracks; + } + + /** + * Optional. For file formats, such as MXF or MKV, supporting multiple audio + * tracks, specify up to two tracks. Default: track 0. + * + * Generated from protobuf field repeated int32 audio_tracks = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAudioTracks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->audio_tracks = $arr; + + return $this; + } + + /** + * Optional. If 'true', enables speaker detection for each recognized word in + * the top alternative of the recognition result using a speaker_tag provided + * in the WordInfo. + * Note: When this is true, we send all the words from the beginning of the + * audio for the top alternative in every consecutive response. + * This is done in order to improve our speaker tags as our models learn to + * identify the speakers in the conversation over time. + * + * Generated from protobuf field bool enable_speaker_diarization = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableSpeakerDiarization() + { + return $this->enable_speaker_diarization; + } + + /** + * Optional. If 'true', enables speaker detection for each recognized word in + * the top alternative of the recognition result using a speaker_tag provided + * in the WordInfo. + * Note: When this is true, we send all the words from the beginning of the + * audio for the top alternative in every consecutive response. + * This is done in order to improve our speaker tags as our models learn to + * identify the speakers in the conversation over time. + * + * Generated from protobuf field bool enable_speaker_diarization = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableSpeakerDiarization($var) + { + GPBUtil::checkBool($var); + $this->enable_speaker_diarization = $var; + + return $this; + } + + /** + * Optional. If set, specifies the estimated number of speakers in the + * conversation. If not set, defaults to '2'. Ignored unless + * enable_speaker_diarization is set to true. + * + * Generated from protobuf field int32 diarization_speaker_count = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDiarizationSpeakerCount() + { + return $this->diarization_speaker_count; + } + + /** + * Optional. If set, specifies the estimated number of speakers in the + * conversation. If not set, defaults to '2'. Ignored unless + * enable_speaker_diarization is set to true. + * + * Generated from protobuf field int32 diarization_speaker_count = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDiarizationSpeakerCount($var) + { + GPBUtil::checkInt32($var); + $this->diarization_speaker_count = $var; + + return $this; + } + + /** + * Optional. If `true`, the top result includes a list of words and the + * confidence for those words. If `false`, no word-level confidence + * information is returned. The default is `false`. + * + * Generated from protobuf field bool enable_word_confidence = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnableWordConfidence() + { + return $this->enable_word_confidence; + } + + /** + * Optional. If `true`, the top result includes a list of words and the + * confidence for those words. If `false`, no word-level confidence + * information is returned. The default is `false`. + * + * Generated from protobuf field bool enable_word_confidence = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnableWordConfidence($var) + { + GPBUtil::checkBool($var); + $this->enable_word_confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextAnnotation.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextAnnotation.php new file mode 100644 index 00000000000..da9a3b3e6f8 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextAnnotation.php @@ -0,0 +1,137 @@ +google.cloud.videointelligence.v1.TextAnnotation + */ +class TextAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * The detected text. + * + * Generated from protobuf field string text = 1; + */ + protected $text = ''; + /** + * All video segments where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextSegment segments = 2; + */ + private $segments; + /** + * Feature version. + * + * Generated from protobuf field string version = 3; + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The detected text. + * @type array<\Google\Cloud\VideoIntelligence\V1\TextSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where OCR detected text appears. + * @type string $version + * Feature version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * The detected text. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The detected text. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * All video segments where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextSegment segments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextSegment segments = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\TextSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\TextSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 3; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Feature version. + * + * Generated from protobuf field string version = 3; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextDetectionConfig.php new file mode 100644 index 00000000000..4b5eadb6e3b --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextDetectionConfig.php @@ -0,0 +1,121 @@ +google.cloud.videointelligence.v1.TextDetectionConfig + */ +class TextDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Language hint can be specified if the language to be detected is known a + * priori. It can increase the accuracy of the detection. Language hint must + * be language code in BCP-47 format. + * Automatic language detection is performed if no hint is provided. + * + * Generated from protobuf field repeated string language_hints = 1; + */ + private $language_hints; + /** + * Model to use for text detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 2; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_hints + * Language hint can be specified if the language to be detected is known a + * priori. It can increase the accuracy of the detection. Language hint must + * be language code in BCP-47 format. + * Automatic language detection is performed if no hint is provided. + * @type string $model + * Model to use for text detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Language hint can be specified if the language to be detected is known a + * priori. It can increase the accuracy of the detection. Language hint must + * be language code in BCP-47 format. + * Automatic language detection is performed if no hint is provided. + * + * Generated from protobuf field repeated string language_hints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageHints() + { + return $this->language_hints; + } + + /** + * Language hint can be specified if the language to be detected is known a + * priori. It can increase the accuracy of the detection. Language hint must + * be language code in BCP-47 format. + * Automatic language detection is performed if no hint is provided. + * + * Generated from protobuf field repeated string language_hints = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_hints = $arr; + + return $this; + } + + /** + * Model to use for text detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 2; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for text detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 2; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextFrame.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextFrame.php new file mode 100644 index 00000000000..eb2062c90da --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextFrame.php @@ -0,0 +1,123 @@ +google.cloud.videointelligence.v1.TextFrame + */ +class TextFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Bounding polygon of the detected text for this frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingPoly rotated_bounding_box = 1; + */ + protected $rotated_bounding_box = null; + /** + * Timestamp of this frame. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + */ + protected $time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly $rotated_bounding_box + * Bounding polygon of the detected text for this frame. + * @type \Google\Protobuf\Duration $time_offset + * Timestamp of this frame. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Bounding polygon of the detected text for this frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingPoly rotated_bounding_box = 1; + * @return \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly|null + */ + public function getRotatedBoundingBox() + { + return $this->rotated_bounding_box; + } + + public function hasRotatedBoundingBox() + { + return isset($this->rotated_bounding_box); + } + + public function clearRotatedBoundingBox() + { + unset($this->rotated_bounding_box); + } + + /** + * Bounding polygon of the detected text for this frame. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingPoly rotated_bounding_box = 1; + * @param \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly $var + * @return $this + */ + public function setRotatedBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingPoly::class); + $this->rotated_bounding_box = $var; + + return $this; + } + + /** + * Timestamp of this frame. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Timestamp of this frame. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextSegment.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextSegment.php new file mode 100644 index 00000000000..8c0f1485df0 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TextSegment.php @@ -0,0 +1,149 @@ +google.cloud.videointelligence.v1.TextSegment + */ +class TextSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment where a text snippet was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + */ + protected $segment = null; + /** + * Confidence for the track of detected text. It is calculated as the highest + * over all frames where OCR detected text appears. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + /** + * Information related to the frames where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextFrame frames = 3; + */ + private $frames; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Video segment where a text snippet was detected. + * @type float $confidence + * Confidence for the track of detected text. It is calculated as the highest + * over all frames where OCR detected text appears. + * @type array<\Google\Cloud\VideoIntelligence\V1\TextFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * Information related to the frames where OCR detected text appears. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment where a text snippet was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment where a text snippet was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + + /** + * Confidence for the track of detected text. It is calculated as the highest + * over all frames where OCR detected text appears. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence for the track of detected text. It is calculated as the highest + * over all frames where OCR detected text appears. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Information related to the frames where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextFrame frames = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * Information related to the frames where OCR detected text appears. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextFrame frames = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\TextFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\TextFrame::class); + $this->frames = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TimestampedObject.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TimestampedObject.php new file mode 100644 index 00000000000..44afbfdf924 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/TimestampedObject.php @@ -0,0 +1,195 @@ +google.cloud.videointelligence.v1.TimestampedObject + */ +class TimestampedObject extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized Bounding box in a frame, where the object is located. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + */ + protected $normalized_bounding_box = null; + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this object. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + */ + protected $time_offset = null; + /** + * Optional. The attributes of the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $attributes; + /** + * Optional. The detected landmarks. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedLandmark landmarks = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $landmarks; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox $normalized_bounding_box + * Normalized Bounding box in a frame, where the object is located. + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this object. + * @type array<\Google\Cloud\VideoIntelligence\V1\DetectedAttribute>|\Google\Protobuf\Internal\RepeatedField $attributes + * Optional. The attributes of the object in the bounding box. + * @type array<\Google\Cloud\VideoIntelligence\V1\DetectedLandmark>|\Google\Protobuf\Internal\RepeatedField $landmarks + * Optional. The detected landmarks. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Normalized Bounding box in a frame, where the object is located. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + * @return \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox|null + */ + public function getNormalizedBoundingBox() + { + return $this->normalized_bounding_box; + } + + public function hasNormalizedBoundingBox() + { + return isset($this->normalized_bounding_box); + } + + public function clearNormalizedBoundingBox() + { + unset($this->normalized_bounding_box); + } + + /** + * Normalized Bounding box in a frame, where the object is located. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.NormalizedBoundingBox normalized_bounding_box = 1; + * @param \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox $var + * @return $this + */ + public function setNormalizedBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\NormalizedBoundingBox::class); + $this->normalized_bounding_box = $var; + + return $this; + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this object. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this object. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * Optional. The attributes of the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Optional. The attributes of the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\VideoIntelligence\V1\DetectedAttribute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\DetectedAttribute::class); + $this->attributes = $arr; + + return $this; + } + + /** + * Optional. The detected landmarks. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedLandmark landmarks = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLandmarks() + { + return $this->landmarks; + } + + /** + * Optional. The detected landmarks. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedLandmark landmarks = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\VideoIntelligence\V1\DetectedLandmark>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLandmarks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\DetectedLandmark::class); + $this->landmarks = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Track.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Track.php new file mode 100644 index 00000000000..e4ac51167e8 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/Track.php @@ -0,0 +1,179 @@ +google.cloud.videointelligence.v1.Track + */ +class Track extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment of a track. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + */ + protected $segment = null; + /** + * The object with timestamp and attributes per frame in the track. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TimestampedObject timestamped_objects = 2; + */ + private $timestamped_objects; + /** + * Optional. Attributes in the track level. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $attributes; + /** + * Optional. The confidence score of the tracked object. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Video segment of a track. + * @type array<\Google\Cloud\VideoIntelligence\V1\TimestampedObject>|\Google\Protobuf\Internal\RepeatedField $timestamped_objects + * The object with timestamp and attributes per frame in the track. + * @type array<\Google\Cloud\VideoIntelligence\V1\DetectedAttribute>|\Google\Protobuf\Internal\RepeatedField $attributes + * Optional. Attributes in the track level. + * @type float $confidence + * Optional. The confidence score of the tracked object. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment of a track. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment of a track. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + + /** + * The object with timestamp and attributes per frame in the track. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TimestampedObject timestamped_objects = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTimestampedObjects() + { + return $this->timestamped_objects; + } + + /** + * The object with timestamp and attributes per frame in the track. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TimestampedObject timestamped_objects = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\TimestampedObject>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTimestampedObjects($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\TimestampedObject::class); + $this->timestamped_objects = $arr; + + return $this; + } + + /** + * Optional. Attributes in the track level. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Optional. Attributes in the track level. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.DetectedAttribute attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\VideoIntelligence\V1\DetectedAttribute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\DetectedAttribute::class); + $this->attributes = $arr; + + return $this; + } + + /** + * Optional. The confidence score of the tracked object. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Optional. The confidence score of the tracked object. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationProgress.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationProgress.php new file mode 100644 index 00000000000..e9502cd96ac --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationProgress.php @@ -0,0 +1,283 @@ +google.cloud.videointelligence.v1.VideoAnnotationProgress + */ +class VideoAnnotationProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * Approximate percentage processed thus far. Guaranteed to be + * 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + */ + protected $progress_percent = 0; + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + */ + protected $start_time = null; + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + /** + * Specifies which feature is being tracked if the request contains more than + * one feature. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Feature feature = 5; + */ + protected $feature = 0; + /** + * Specifies which segment is being tracked if the request contains more than + * one segment. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 6; + */ + protected $segment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * @type int $progress_percent + * Approximate percentage processed thus far. Guaranteed to be + * 100 when fully processed. + * @type \Google\Protobuf\Timestamp $start_time + * Time when the request was received. + * @type \Google\Protobuf\Timestamp $update_time + * Time of the most recent update. + * @type int $feature + * Specifies which feature is being tracked if the request contains more than + * one feature. + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Specifies which segment is being tracked if the request contains more than + * one segment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * Approximate percentage processed thus far. Guaranteed to be + * 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Approximate percentage processed thus far. Guaranteed to be + * 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Specifies which feature is being tracked if the request contains more than + * one feature. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Feature feature = 5; + * @return int + */ + public function getFeature() + { + return $this->feature; + } + + /** + * Specifies which feature is being tracked if the request contains more than + * one feature. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.Feature feature = 5; + * @param int $var + * @return $this + */ + public function setFeature($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VideoIntelligence\V1\Feature::class); + $this->feature = $var; + + return $this; + } + + /** + * Specifies which segment is being tracked if the request contains more than + * one segment. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 6; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Specifies which segment is being tracked if the request contains more than + * one segment. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 6; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationResults.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationResults.php new file mode 100644 index 00000000000..e97685870f1 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoAnnotationResults.php @@ -0,0 +1,710 @@ +google.cloud.videointelligence.v1.VideoAnnotationResults + */ +class VideoAnnotationResults extends \Google\Protobuf\Internal\Message +{ + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * Video segment on which the annotation is run. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 10; + */ + protected $segment = null; + /** + * Topical label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_label_annotations = 2; + */ + private $segment_label_annotations; + /** + * Presence label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. Compared to the + * existing topical `segment_label_annotations`, this field presents more + * fine-grained, segment-level labels detected in video content and is made + * available only when the client sets `LabelDetectionConfig.model` to + * "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_presence_label_annotations = 23; + */ + private $segment_presence_label_annotations; + /** + * Topical label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_label_annotations = 3; + */ + private $shot_label_annotations; + /** + * Presence label annotations on shot level. There is exactly one element for + * each unique label. Compared to the existing topical + * `shot_label_annotations`, this field presents more fine-grained, shot-level + * labels detected in video content and is made available only when the client + * sets `LabelDetectionConfig.model` to "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_presence_label_annotations = 24; + */ + private $shot_presence_label_annotations; + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation frame_label_annotations = 4; + */ + private $frame_label_annotations; + /** + * Deprecated. Please use `face_detection_annotations` instead. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceAnnotation face_annotations = 5 [deprecated = true]; + * @deprecated + */ + private $face_annotations; + /** + * Face detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceDetectionAnnotation face_detection_annotations = 13; + */ + private $face_detection_annotations; + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment shot_annotations = 6; + */ + private $shot_annotations; + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentAnnotation explicit_annotation = 7; + */ + protected $explicit_annotation = null; + /** + * Speech transcription. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechTranscription speech_transcriptions = 11; + */ + private $speech_transcriptions; + /** + * OCR text detection and tracking. + * Annotations for list of detected text snippets. Each will have list of + * frame information associated with it. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextAnnotation text_annotations = 12; + */ + private $text_annotations; + /** + * Annotations for list of objects detected and tracked in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingAnnotation object_annotations = 14; + */ + private $object_annotations; + /** + * Annotations for list of logos detected, tracked and recognized in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LogoRecognitionAnnotation logo_recognition_annotations = 19; + */ + private $logo_recognition_annotations; + /** + * Person detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.PersonDetectionAnnotation person_detection_annotations = 20; + */ + private $person_detection_annotations; + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + */ + protected $error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * @type \Google\Cloud\VideoIntelligence\V1\VideoSegment $segment + * Video segment on which the annotation is run. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $segment_label_annotations + * Topical label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $segment_presence_label_annotations + * Presence label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. Compared to the + * existing topical `segment_label_annotations`, this field presents more + * fine-grained, segment-level labels detected in video content and is made + * available only when the client sets `LabelDetectionConfig.model` to + * "builtin/latest" in the request. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $shot_label_annotations + * Topical label annotations on shot level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $shot_presence_label_annotations + * Presence label annotations on shot level. There is exactly one element for + * each unique label. Compared to the existing topical + * `shot_label_annotations`, this field presents more fine-grained, shot-level + * labels detected in video content and is made available only when the client + * sets `LabelDetectionConfig.model` to "builtin/latest" in the request. + * @type array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $frame_label_annotations + * Label annotations on frame level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $face_annotations + * Deprecated. Please use `face_detection_annotations` instead. + * @type array<\Google\Cloud\VideoIntelligence\V1\FaceDetectionAnnotation>|\Google\Protobuf\Internal\RepeatedField $face_detection_annotations + * Face detection annotations. + * @type array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $shot_annotations + * Shot annotations. Each shot is represented as a video segment. + * @type \Google\Cloud\VideoIntelligence\V1\ExplicitContentAnnotation $explicit_annotation + * Explicit content annotation. + * @type array<\Google\Cloud\VideoIntelligence\V1\SpeechTranscription>|\Google\Protobuf\Internal\RepeatedField $speech_transcriptions + * Speech transcription. + * @type array<\Google\Cloud\VideoIntelligence\V1\TextAnnotation>|\Google\Protobuf\Internal\RepeatedField $text_annotations + * OCR text detection and tracking. + * Annotations for list of detected text snippets. Each will have list of + * frame information associated with it. + * @type array<\Google\Cloud\VideoIntelligence\V1\ObjectTrackingAnnotation>|\Google\Protobuf\Internal\RepeatedField $object_annotations + * Annotations for list of objects detected and tracked in video. + * @type array<\Google\Cloud\VideoIntelligence\V1\LogoRecognitionAnnotation>|\Google\Protobuf\Internal\RepeatedField $logo_recognition_annotations + * Annotations for list of logos detected, tracked and recognized in video. + * @type array<\Google\Cloud\VideoIntelligence\V1\PersonDetectionAnnotation>|\Google\Protobuf\Internal\RepeatedField $person_detection_annotations + * Person detection annotations. + * @type \Google\Rpc\Status $error + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Video file location in + * [Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * Video segment on which the annotation is run. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 10; + * @return \Google\Cloud\VideoIntelligence\V1\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment on which the annotation is run. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.VideoSegment segment = 10; + * @param \Google\Cloud\VideoIntelligence\V1\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segment = $var; + + return $this; + } + + /** + * Topical label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_label_annotations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegmentLabelAnnotations() + { + return $this->segment_label_annotations; + } + + /** + * Topical label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_label_annotations = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegmentLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelAnnotation::class); + $this->segment_label_annotations = $arr; + + return $this; + } + + /** + * Presence label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. Compared to the + * existing topical `segment_label_annotations`, this field presents more + * fine-grained, segment-level labels detected in video content and is made + * available only when the client sets `LabelDetectionConfig.model` to + * "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_presence_label_annotations = 23; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegmentPresenceLabelAnnotations() + { + return $this->segment_presence_label_annotations; + } + + /** + * Presence label annotations on video level or user-specified segment level. + * There is exactly one element for each unique label. Compared to the + * existing topical `segment_label_annotations`, this field presents more + * fine-grained, segment-level labels detected in video content and is made + * available only when the client sets `LabelDetectionConfig.model` to + * "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation segment_presence_label_annotations = 23; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegmentPresenceLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelAnnotation::class); + $this->segment_presence_label_annotations = $arr; + + return $this; + } + + /** + * Topical label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_label_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShotLabelAnnotations() + { + return $this->shot_label_annotations; + } + + /** + * Topical label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_label_annotations = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShotLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelAnnotation::class); + $this->shot_label_annotations = $arr; + + return $this; + } + + /** + * Presence label annotations on shot level. There is exactly one element for + * each unique label. Compared to the existing topical + * `shot_label_annotations`, this field presents more fine-grained, shot-level + * labels detected in video content and is made available only when the client + * sets `LabelDetectionConfig.model` to "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_presence_label_annotations = 24; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShotPresenceLabelAnnotations() + { + return $this->shot_presence_label_annotations; + } + + /** + * Presence label annotations on shot level. There is exactly one element for + * each unique label. Compared to the existing topical + * `shot_label_annotations`, this field presents more fine-grained, shot-level + * labels detected in video content and is made available only when the client + * sets `LabelDetectionConfig.model` to "builtin/latest" in the request. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation shot_presence_label_annotations = 24; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShotPresenceLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelAnnotation::class); + $this->shot_presence_label_annotations = $arr; + + return $this; + } + + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation frame_label_annotations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrameLabelAnnotations() + { + return $this->frame_label_annotations; + } + + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LabelAnnotation frame_label_annotations = 4; + * @param array<\Google\Cloud\VideoIntelligence\V1\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrameLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LabelAnnotation::class); + $this->frame_label_annotations = $arr; + + return $this; + } + + /** + * Deprecated. Please use `face_detection_annotations` instead. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceAnnotation face_annotations = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getFaceAnnotations() + { + @trigger_error('face_annotations is deprecated.', E_USER_DEPRECATED); + return $this->face_annotations; + } + + /** + * Deprecated. Please use `face_detection_annotations` instead. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceAnnotation face_annotations = 5 [deprecated = true]; + * @param array<\Google\Cloud\VideoIntelligence\V1\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setFaceAnnotations($var) + { + @trigger_error('face_annotations is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\FaceAnnotation::class); + $this->face_annotations = $arr; + + return $this; + } + + /** + * Face detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceDetectionAnnotation face_detection_annotations = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFaceDetectionAnnotations() + { + return $this->face_detection_annotations; + } + + /** + * Face detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.FaceDetectionAnnotation face_detection_annotations = 13; + * @param array<\Google\Cloud\VideoIntelligence\V1\FaceDetectionAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFaceDetectionAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\FaceDetectionAnnotation::class); + $this->face_detection_annotations = $arr; + + return $this; + } + + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment shot_annotations = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShotAnnotations() + { + return $this->shot_annotations; + } + + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment shot_annotations = 6; + * @param array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShotAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->shot_annotations = $arr; + + return $this; + } + + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentAnnotation explicit_annotation = 7; + * @return \Google\Cloud\VideoIntelligence\V1\ExplicitContentAnnotation|null + */ + public function getExplicitAnnotation() + { + return $this->explicit_annotation; + } + + public function hasExplicitAnnotation() + { + return isset($this->explicit_annotation); + } + + public function clearExplicitAnnotation() + { + unset($this->explicit_annotation); + } + + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentAnnotation explicit_annotation = 7; + * @param \Google\Cloud\VideoIntelligence\V1\ExplicitContentAnnotation $var + * @return $this + */ + public function setExplicitAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ExplicitContentAnnotation::class); + $this->explicit_annotation = $var; + + return $this; + } + + /** + * Speech transcription. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechTranscription speech_transcriptions = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpeechTranscriptions() + { + return $this->speech_transcriptions; + } + + /** + * Speech transcription. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.SpeechTranscription speech_transcriptions = 11; + * @param array<\Google\Cloud\VideoIntelligence\V1\SpeechTranscription>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpeechTranscriptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\SpeechTranscription::class); + $this->speech_transcriptions = $arr; + + return $this; + } + + /** + * OCR text detection and tracking. + * Annotations for list of detected text snippets. Each will have list of + * frame information associated with it. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextAnnotation text_annotations = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextAnnotations() + { + return $this->text_annotations; + } + + /** + * OCR text detection and tracking. + * Annotations for list of detected text snippets. Each will have list of + * frame information associated with it. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.TextAnnotation text_annotations = 12; + * @param array<\Google\Cloud\VideoIntelligence\V1\TextAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\TextAnnotation::class); + $this->text_annotations = $arr; + + return $this; + } + + /** + * Annotations for list of objects detected and tracked in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingAnnotation object_annotations = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getObjectAnnotations() + { + return $this->object_annotations; + } + + /** + * Annotations for list of objects detected and tracked in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.ObjectTrackingAnnotation object_annotations = 14; + * @param array<\Google\Cloud\VideoIntelligence\V1\ObjectTrackingAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setObjectAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\ObjectTrackingAnnotation::class); + $this->object_annotations = $arr; + + return $this; + } + + /** + * Annotations for list of logos detected, tracked and recognized in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LogoRecognitionAnnotation logo_recognition_annotations = 19; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLogoRecognitionAnnotations() + { + return $this->logo_recognition_annotations; + } + + /** + * Annotations for list of logos detected, tracked and recognized in video. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.LogoRecognitionAnnotation logo_recognition_annotations = 19; + * @param array<\Google\Cloud\VideoIntelligence\V1\LogoRecognitionAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLogoRecognitionAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\LogoRecognitionAnnotation::class); + $this->logo_recognition_annotations = $arr; + + return $this; + } + + /** + * Person detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.PersonDetectionAnnotation person_detection_annotations = 20; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPersonDetectionAnnotations() + { + return $this->person_detection_annotations; + } + + /** + * Person detection annotations. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.PersonDetectionAnnotation person_detection_annotations = 20; + * @param array<\Google\Cloud\VideoIntelligence\V1\PersonDetectionAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPersonDetectionAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\PersonDetectionAnnotation::class); + $this->person_detection_annotations = $arr; + + return $this; + } + + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoContext.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoContext.php new file mode 100644 index 00000000000..b74187dab46 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoContext.php @@ -0,0 +1,427 @@ +google.cloud.videointelligence.v1.VideoContext + */ +class VideoContext extends \Google\Protobuf\Internal\Message +{ + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 1; + */ + private $segments; + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionConfig label_detection_config = 2; + */ + protected $label_detection_config = null; + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ShotChangeDetectionConfig shot_change_detection_config = 3; + */ + protected $shot_change_detection_config = null; + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + */ + protected $explicit_content_detection_config = null; + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.FaceDetectionConfig face_detection_config = 5; + */ + protected $face_detection_config = null; + /** + * Config for SPEECH_TRANSCRIPTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.SpeechTranscriptionConfig speech_transcription_config = 6; + */ + protected $speech_transcription_config = null; + /** + * Config for TEXT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.TextDetectionConfig text_detection_config = 8; + */ + protected $text_detection_config = null; + /** + * Config for PERSON_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.PersonDetectionConfig person_detection_config = 11; + */ + protected $person_detection_config = null; + /** + * Config for OBJECT_TRACKING. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ObjectTrackingConfig object_tracking_config = 13; + */ + protected $object_tracking_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * @type \Google\Cloud\VideoIntelligence\V1\LabelDetectionConfig $label_detection_config + * Config for LABEL_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig $shot_change_detection_config + * Config for SHOT_CHANGE_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig $explicit_content_detection_config + * Config for EXPLICIT_CONTENT_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\FaceDetectionConfig $face_detection_config + * Config for FACE_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig $speech_transcription_config + * Config for SPEECH_TRANSCRIPTION. + * @type \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig $text_detection_config + * Config for TEXT_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\PersonDetectionConfig $person_detection_config + * Config for PERSON_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1\ObjectTrackingConfig $object_tracking_config + * Config for OBJECT_TRACKING. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1.VideoSegment segments = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1\VideoSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionConfig label_detection_config = 2; + * @return \Google\Cloud\VideoIntelligence\V1\LabelDetectionConfig|null + */ + public function getLabelDetectionConfig() + { + return $this->label_detection_config; + } + + public function hasLabelDetectionConfig() + { + return isset($this->label_detection_config); + } + + public function clearLabelDetectionConfig() + { + unset($this->label_detection_config); + } + + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.LabelDetectionConfig label_detection_config = 2; + * @param \Google\Cloud\VideoIntelligence\V1\LabelDetectionConfig $var + * @return $this + */ + public function setLabelDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\LabelDetectionConfig::class); + $this->label_detection_config = $var; + + return $this; + } + + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ShotChangeDetectionConfig shot_change_detection_config = 3; + * @return \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig|null + */ + public function getShotChangeDetectionConfig() + { + return $this->shot_change_detection_config; + } + + public function hasShotChangeDetectionConfig() + { + return isset($this->shot_change_detection_config); + } + + public function clearShotChangeDetectionConfig() + { + unset($this->shot_change_detection_config); + } + + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ShotChangeDetectionConfig shot_change_detection_config = 3; + * @param \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig $var + * @return $this + */ + public function setShotChangeDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ShotChangeDetectionConfig::class); + $this->shot_change_detection_config = $var; + + return $this; + } + + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + * @return \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig|null + */ + public function getExplicitContentDetectionConfig() + { + return $this->explicit_content_detection_config; + } + + public function hasExplicitContentDetectionConfig() + { + return isset($this->explicit_content_detection_config); + } + + public function clearExplicitContentDetectionConfig() + { + unset($this->explicit_content_detection_config); + } + + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + * @param \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig $var + * @return $this + */ + public function setExplicitContentDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ExplicitContentDetectionConfig::class); + $this->explicit_content_detection_config = $var; + + return $this; + } + + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.FaceDetectionConfig face_detection_config = 5; + * @return \Google\Cloud\VideoIntelligence\V1\FaceDetectionConfig|null + */ + public function getFaceDetectionConfig() + { + return $this->face_detection_config; + } + + public function hasFaceDetectionConfig() + { + return isset($this->face_detection_config); + } + + public function clearFaceDetectionConfig() + { + unset($this->face_detection_config); + } + + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.FaceDetectionConfig face_detection_config = 5; + * @param \Google\Cloud\VideoIntelligence\V1\FaceDetectionConfig $var + * @return $this + */ + public function setFaceDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\FaceDetectionConfig::class); + $this->face_detection_config = $var; + + return $this; + } + + /** + * Config for SPEECH_TRANSCRIPTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.SpeechTranscriptionConfig speech_transcription_config = 6; + * @return \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig|null + */ + public function getSpeechTranscriptionConfig() + { + return $this->speech_transcription_config; + } + + public function hasSpeechTranscriptionConfig() + { + return isset($this->speech_transcription_config); + } + + public function clearSpeechTranscriptionConfig() + { + unset($this->speech_transcription_config); + } + + /** + * Config for SPEECH_TRANSCRIPTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.SpeechTranscriptionConfig speech_transcription_config = 6; + * @param \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig $var + * @return $this + */ + public function setSpeechTranscriptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig::class); + $this->speech_transcription_config = $var; + + return $this; + } + + /** + * Config for TEXT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.TextDetectionConfig text_detection_config = 8; + * @return \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig|null + */ + public function getTextDetectionConfig() + { + return $this->text_detection_config; + } + + public function hasTextDetectionConfig() + { + return isset($this->text_detection_config); + } + + public function clearTextDetectionConfig() + { + unset($this->text_detection_config); + } + + /** + * Config for TEXT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.TextDetectionConfig text_detection_config = 8; + * @param \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig $var + * @return $this + */ + public function setTextDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\TextDetectionConfig::class); + $this->text_detection_config = $var; + + return $this; + } + + /** + * Config for PERSON_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.PersonDetectionConfig person_detection_config = 11; + * @return \Google\Cloud\VideoIntelligence\V1\PersonDetectionConfig|null + */ + public function getPersonDetectionConfig() + { + return $this->person_detection_config; + } + + public function hasPersonDetectionConfig() + { + return isset($this->person_detection_config); + } + + public function clearPersonDetectionConfig() + { + unset($this->person_detection_config); + } + + /** + * Config for PERSON_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.PersonDetectionConfig person_detection_config = 11; + * @param \Google\Cloud\VideoIntelligence\V1\PersonDetectionConfig $var + * @return $this + */ + public function setPersonDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\PersonDetectionConfig::class); + $this->person_detection_config = $var; + + return $this; + } + + /** + * Config for OBJECT_TRACKING. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ObjectTrackingConfig object_tracking_config = 13; + * @return \Google\Cloud\VideoIntelligence\V1\ObjectTrackingConfig|null + */ + public function getObjectTrackingConfig() + { + return $this->object_tracking_config; + } + + public function hasObjectTrackingConfig() + { + return isset($this->object_tracking_config); + } + + public function clearObjectTrackingConfig() + { + unset($this->object_tracking_config); + } + + /** + * Config for OBJECT_TRACKING. + * + * Generated from protobuf field .google.cloud.videointelligence.v1.ObjectTrackingConfig object_tracking_config = 13; + * @param \Google\Cloud\VideoIntelligence\V1\ObjectTrackingConfig $var + * @return $this + */ + public function setObjectTrackingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1\ObjectTrackingConfig::class); + $this->object_tracking_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoSegment.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoSegment.php new file mode 100644 index 00000000000..5153eebff21 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/VideoSegment.php @@ -0,0 +1,129 @@ +google.cloud.videointelligence.v1.VideoSegment + */ +class VideoSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + */ + protected $start_time_offset = null; + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + */ + protected $end_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $start_time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * @type \Google\Protobuf\Duration $end_time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/WordInfo.php b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/WordInfo.php new file mode 100644 index 00000000000..9e83ca0bd3d --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/proto/src/Google/Cloud/VideoIntelligence/V1/WordInfo.php @@ -0,0 +1,281 @@ +google.cloud.videointelligence.v1.WordInfo + */ +class WordInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the start of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration start_time = 1; + */ + protected $start_time = null; + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the end of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration end_time = 2; + */ + protected $end_time = null; + /** + * The word corresponding to this set of information. + * + * Generated from protobuf field string word = 3; + */ + protected $word = ''; + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $confidence = 0.0; + /** + * Output only. A distinct integer value is assigned for every speaker within + * the audio. This field specifies which one of those speakers was detected to + * have spoken this word. Value ranges from 1 up to diarization_speaker_count, + * and is only set if speaker diarization is enabled. + * + * Generated from protobuf field int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $speaker_tag = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $start_time + * Time offset relative to the beginning of the audio, and + * corresponding to the start of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * @type \Google\Protobuf\Duration $end_time + * Time offset relative to the beginning of the audio, and + * corresponding to the end of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * @type string $word + * The word corresponding to this set of information. + * @type float $confidence + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * @type int $speaker_tag + * Output only. A distinct integer value is assigned for every speaker within + * the audio. This field specifies which one of those speakers was detected to + * have spoken this word. Value ranges from 1 up to diarization_speaker_count, + * and is only set if speaker diarization is enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the start of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration start_time = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the start of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration start_time = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time = $var; + + return $this; + } + + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the end of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration end_time = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Time offset relative to the beginning of the audio, and + * corresponding to the end of the spoken word. This field is only set if + * `enable_word_time_offsets=true` and only in the top hypothesis. This is an + * experimental feature and the accuracy of the time offset can vary. + * + * Generated from protobuf field .google.protobuf.Duration end_time = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time = $var; + + return $this; + } + + /** + * The word corresponding to this set of information. + * + * Generated from protobuf field string word = 3; + * @return string + */ + public function getWord() + { + return $this->word; + } + + /** + * The word corresponding to this set of information. + * + * Generated from protobuf field string word = 3; + * @param string $var + * @return $this + */ + public function setWord($var) + { + GPBUtil::checkString($var, True); + $this->word = $var; + + return $this; + } + + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Output only. The confidence estimate between 0.0 and 1.0. A higher number + * indicates an estimated greater likelihood that the recognized words are + * correct. This field is set only for the top alternative. + * This field is not guaranteed to be accurate and users should not rely on it + * to be always provided. + * The default of 0.0 is a sentinel value indicating `confidence` was not set. + * + * Generated from protobuf field float confidence = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Output only. A distinct integer value is assigned for every speaker within + * the audio. This field specifies which one of those speakers was detected to + * have spoken this word. Value ranges from 1 up to diarization_speaker_count, + * and is only set if speaker diarization is enabled. + * + * Generated from protobuf field int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSpeakerTag() + { + return $this->speaker_tag; + } + + /** + * Output only. A distinct integer value is assigned for every speaker within + * the audio. This field specifies which one of those speakers was detected to + * have spoken this word. Value ranges from 1 up to diarization_speaker_count, + * and is only set if speaker diarization is enabled. + * + * Generated from protobuf field int32 speaker_tag = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSpeakerTag($var) + { + GPBUtil::checkInt32($var); + $this->speaker_tag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1/samples/V1/VideoIntelligenceServiceClient/annotate_video.php b/owl-bot-staging/VideoIntelligence/v1/samples/V1/VideoIntelligenceServiceClient/annotate_video.php new file mode 100644 index 00000000000..db898623b6b --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/samples/V1/VideoIntelligenceServiceClient/annotate_video.php @@ -0,0 +1,72 @@ +annotateVideo($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AnnotateVideoResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_sync] diff --git a/owl-bot-staging/VideoIntelligence/v1/src/V1/Client/VideoIntelligenceServiceClient.php b/owl-bot-staging/VideoIntelligence/v1/src/V1/Client/VideoIntelligenceServiceClient.php new file mode 100644 index 00000000000..76d018759f9 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/src/V1/Client/VideoIntelligenceServiceClient.php @@ -0,0 +1,229 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/video_intelligence_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/video_intelligence_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/video_intelligence_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/video_intelligence_service_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 'videointelligence.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Performs asynchronous video annotation. Progress and results can be + * retrieved through the `google.longrunning.Operations` interface. + * `Operation.metadata` contains `AnnotateVideoProgress` (progress). + * `Operation.response` contains `AnnotateVideoResponse` (results). + * + * The async variant is {@see VideoIntelligenceServiceClient::annotateVideoAsync()} + * . + * + * @example samples/V1/VideoIntelligenceServiceClient/annotate_video.php + * + * @param AnnotateVideoRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function annotateVideo(AnnotateVideoRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('AnnotateVideo', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1/src/V1/Gapic/VideoIntelligenceServiceGapicClient.php b/owl-bot-staging/VideoIntelligence/v1/src/V1/Gapic/VideoIntelligenceServiceGapicClient.php new file mode 100644 index 00000000000..2c6b2480eb6 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/src/V1/Gapic/VideoIntelligenceServiceGapicClient.php @@ -0,0 +1,341 @@ +annotateVideo(); + * $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 = $videoIntelligenceServiceClient->annotateVideo(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoIntelligenceServiceClient->close(); + * } + * ``` + * + * @deprecated Please use the new service client {@see \Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient}. + */ +class VideoIntelligenceServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.videointelligence.v1.VideoIntelligenceService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'videointelligence.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'videointelligence.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/video_intelligence_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/video_intelligence_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/video_intelligence_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/video_intelligence_service_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 'videointelligence.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); + } + + /** + * Performs asynchronous video annotation. Progress and results can be + * retrieved through the `google.longrunning.Operations` interface. + * `Operation.metadata` contains `AnnotateVideoProgress` (progress). + * `Operation.response` contains `AnnotateVideoResponse` (results). + * + * Sample code: + * ``` + * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); + * try { + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo(); + * $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 = $videoIntelligenceServiceClient->annotateVideo(); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoIntelligenceServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $inputUri + * Input video location. Currently, only + * [Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported. URIs must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify + * multiple videos, a video URI may include wildcards in the `object-id`. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` must be unset. + * @type string $inputContent + * The video data bytes. + * If unset, the input video(s) should be specified via the `input_uri`. + * If set, `input_uri` must be unset. + * @type int[] $features + * Required. Requested video annotation features. + * For allowed values, use constants defined on {@see \Google\Cloud\VideoIntelligence\V1\Feature} + * @type VideoContext $videoContext + * Additional video context and/or feature-specific parameters. + * @type string $outputUri + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported. These must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * @type string $locationId + * Optional. Cloud region where annotation should take place. Supported cloud + * regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no + * region is specified, the region will be determined based on video file + * location. + * @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 annotateVideo(array $optionalArgs = []) + { + $request = new AnnotateVideoRequest(); + if (isset($optionalArgs['inputUri'])) { + $request->setInputUri($optionalArgs['inputUri']); + } + + if (isset($optionalArgs['inputContent'])) { + $request->setInputContent($optionalArgs['inputContent']); + } + + if (isset($optionalArgs['features'])) { + $request->setFeatures($optionalArgs['features']); + } + + if (isset($optionalArgs['videoContext'])) { + $request->setVideoContext($optionalArgs['videoContext']); + } + + if (isset($optionalArgs['outputUri'])) { + $request->setOutputUri($optionalArgs['outputUri']); + } + + if (isset($optionalArgs['locationId'])) { + $request->setLocationId($optionalArgs['locationId']); + } + + return $this->startOperationsCall('AnnotateVideo', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1/src/V1/VideoIntelligenceServiceClient.php b/owl-bot-staging/VideoIntelligence/v1/src/V1/VideoIntelligenceServiceClient.php new file mode 100644 index 00000000000..4d9a09e2636 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/src/V1/VideoIntelligenceServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.videointelligence.v1.VideoIntelligenceService' => [ + 'AnnotateVideo' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VideoIntelligence\V1\AnnotateVideoResponse', + 'metadataReturnType' => '\Google\Cloud\VideoIntelligence\V1\AnnotateVideoProgress', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + ], + ], + ], +]; diff --git a/owl-bot-staging/VideoIntelligence/v1/src/V1/resources/video_intelligence_service_rest_client_config.php b/owl-bot-staging/VideoIntelligence/v1/src/V1/resources/video_intelligence_service_rest_client_config.php new file mode 100644 index 00000000000..91be17c63ed --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/src/V1/resources/video_intelligence_service_rest_client_config.php @@ -0,0 +1,80 @@ + [ + 'google.cloud.videointelligence.v1.VideoIntelligenceService' => [ + 'AnnotateVideo' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/videos:annotate', + 'body' => '*', + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/operations/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/operations/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/operations/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/Client/VideoIntelligenceServiceClientTest.php b/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/Client/VideoIntelligenceServiceClientTest.php new file mode 100644 index 00000000000..b2c08dabadf --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/Client/VideoIntelligenceServiceClientTest.php @@ -0,0 +1,238 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VideoIntelligenceServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VideoIntelligenceServiceClient($options); + } + + /** @test */ + public function annotateVideoTest() + { + $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/annotateVideoTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AnnotateVideoResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/annotateVideoTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new AnnotateVideoRequest(); + $response = $gapicClient->annotateVideo($request); + $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.videointelligence.v1.VideoIntelligenceService/AnnotateVideo', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + $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 annotateVideoExceptionTest() + { + $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/annotateVideoTest'); + $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); + $request = new AnnotateVideoRequest(); + $response = $gapicClient->annotateVideo($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + 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 annotateVideoAsyncTest() + { + $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/annotateVideoTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AnnotateVideoResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/annotateVideoTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new AnnotateVideoRequest(); + $response = $gapicClient->annotateVideoAsync($request)->wait(); + $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.videointelligence.v1.VideoIntelligenceService/AnnotateVideo', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + $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()); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/VideoIntelligenceServiceClientTest.php b/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/VideoIntelligenceServiceClientTest.php new file mode 100644 index 00000000000..28e39ed5bd7 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1/tests/Unit/V1/VideoIntelligenceServiceClientTest.php @@ -0,0 +1,176 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VideoIntelligenceServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VideoIntelligenceServiceClient($options); + } + + /** @test */ + public function annotateVideoTest() + { + $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/annotateVideoTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AnnotateVideoResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/annotateVideoTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $response = $gapicClient->annotateVideo(); + $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.videointelligence.v1.VideoIntelligenceService/AnnotateVideo', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + $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 annotateVideoExceptionTest() + { + $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/annotateVideoTest'); + $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); + $response = $gapicClient->annotateVideo(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + 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()); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1Beta2/VideoIntelligence.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1Beta2/VideoIntelligence.php new file mode 100644 index 00000000000..b458c796ae9 Binary files /dev/null and b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/GPBMetadata/Google/Cloud/Videointelligence/V1Beta2/VideoIntelligence.php differ diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoProgress.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoProgress.php new file mode 100644 index 00000000000..a62db0ec9e6 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoProgress.php @@ -0,0 +1,69 @@ +google.cloud.videointelligence.v1beta2.AnnotateVideoProgress + */ +class AnnotateVideoProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationProgress annotation_progress = 1; + */ + private $annotation_progress; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationProgress>|\Google\Protobuf\Internal\RepeatedField $annotation_progress + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationProgress annotation_progress = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotationProgress() + { + return $this->annotation_progress; + } + + /** + * Progress metadata for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationProgress annotation_progress = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationProgress>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotationProgress($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationProgress::class); + $this->annotation_progress = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoRequest.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoRequest.php new file mode 100644 index 00000000000..b051328890d --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoRequest.php @@ -0,0 +1,327 @@ +google.cloud.videointelligence.v1beta2.AnnotateVideoRequest + */ +class AnnotateVideoRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI + * may include wildcards in `object-id`, and thus identify multiple videos. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * The video data bytes. + * If unset, the input video(s) should be specified via `input_uri`. + * If set, `input_uri` should be unset. + * + * Generated from protobuf field bytes input_content = 6; + */ + protected $input_content = ''; + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $features; + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoContext video_context = 3; + */ + protected $video_context = null; + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $output_uri = ''; + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $location_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI + * may include wildcards in `object-id`, and thus identify multiple videos. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * @type string $input_content + * The video data bytes. + * If unset, the input video(s) should be specified via `input_uri`. + * If set, `input_uri` should be unset. + * @type array|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested video annotation features. + * @type \Google\Cloud\VideoIntelligence\V1beta2\VideoContext $video_context + * Additional video context and/or feature-specific parameters. + * @type string $output_uri + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * @type string $location_id + * Optional. Cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI + * may include wildcards in `object-id`, and thus identify multiple videos. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI + * may include wildcards in `object-id`, and thus identify multiple videos. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * The video data bytes. + * If unset, the input video(s) should be specified via `input_uri`. + * If set, `input_uri` should be unset. + * + * Generated from protobuf field bytes input_content = 6; + * @return string + */ + public function getInputContent() + { + return $this->input_content; + } + + /** + * The video data bytes. + * If unset, the input video(s) should be specified via `input_uri`. + * If set, `input_uri` should be unset. + * + * Generated from protobuf field bytes input_content = 6; + * @param string $var + * @return $this + */ + public function setInputContent($var) + { + GPBUtil::checkString($var, False); + $this->input_content = $var; + + return $this; + } + + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested video annotation features. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Feature features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VideoIntelligence\V1beta2\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoContext video_context = 3; + * @return \Google\Cloud\VideoIntelligence\V1beta2\VideoContext|null + */ + public function getVideoContext() + { + return $this->video_context; + } + + public function hasVideoContext() + { + return isset($this->video_context); + } + + public function clearVideoContext() + { + unset($this->video_context); + } + + /** + * Additional video context and/or feature-specific parameters. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoContext video_context = 3; + * @param \Google\Cloud\VideoIntelligence\V1beta2\VideoContext $var + * @return $this + */ + public function setVideoContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\VideoContext::class); + $this->video_context = $var; + + return $this; + } + + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOutputUri() + { + return $this->output_uri; + } + + /** + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * + * Generated from protobuf field string output_uri = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOutputUri($var) + { + GPBUtil::checkString($var, True); + $this->output_uri = $var; + + return $this; + } + + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLocationId() + { + return $this->location_id; + } + + /** + * Optional. Cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * + * Generated from protobuf field string location_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLocationId($var) + { + GPBUtil::checkString($var, True); + $this->location_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoResponse.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoResponse.php new file mode 100644 index 00000000000..15bca10c295 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/AnnotateVideoResponse.php @@ -0,0 +1,69 @@ +google.cloud.videointelligence.v1beta2.AnnotateVideoResponse + */ +class AnnotateVideoResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationResults annotation_results = 1; + */ + private $annotation_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationResults>|\Google\Protobuf\Internal\RepeatedField $annotation_results + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationResults annotation_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnnotationResults() + { + return $this->annotation_results; + } + + /** + * Annotation results for all videos specified in `AnnotateVideoRequest`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoAnnotationResults annotation_results = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationResults>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnnotationResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoAnnotationResults::class); + $this->annotation_results = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Entity.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Entity.php new file mode 100644 index 00000000000..93ddc343cce --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Entity.php @@ -0,0 +1,143 @@ +google.cloud.videointelligence.v1beta2.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + */ + protected $entity_id = ''; + /** + * Textual description, e.g. `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $entity_id + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * @type string $description + * Textual description, e.g. `Fixed-gear bicycle`. + * @type string $language_code + * Language code for `description` in BCP-47 format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + * @return string + */ + public function getEntityId() + { + return $this->entity_id; + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string entity_id = 1; + * @param string $var + * @return $this + */ + public function setEntityId($var) + { + GPBUtil::checkString($var, True); + $this->entity_id = $var; + + return $this; + } + + /** + * Textual description, e.g. `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Textual description, e.g. `Fixed-gear bicycle`. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Language code for `description` in BCP-47 format. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentAnnotation.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentAnnotation.php new file mode 100644 index 00000000000..56d9364b24e --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentAnnotation.php @@ -0,0 +1,69 @@ +google.cloud.videointelligence.v1beta2.ExplicitContentAnnotation + */ +class ExplicitContentAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.ExplicitContentFrame frames = 1; + */ + private $frames; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where explicit content was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.ExplicitContentFrame frames = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where explicit content was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.ExplicitContentFrame frames = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentFrame::class); + $this->frames = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentDetectionConfig.php new file mode 100644 index 00000000000..75f2f4a8af8 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentDetectionConfig.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1beta2.ExplicitContentDetectionConfig + */ +class ExplicitContentDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for explicit content detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentFrame.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentFrame.php new file mode 100644 index 00000000000..a4acccf7f26 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ExplicitContentFrame.php @@ -0,0 +1,115 @@ +google.cloud.videointelligence.v1beta2.ExplicitContentFrame + */ +class ExplicitContentFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + */ + protected $time_offset = null; + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Likelihood pornography_likelihood = 2; + */ + protected $pornography_likelihood = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * @type int $pornography_likelihood + * Likelihood of the pornography content.. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Likelihood pornography_likelihood = 2; + * @return int + */ + public function getPornographyLikelihood() + { + return $this->pornography_likelihood; + } + + /** + * Likelihood of the pornography content.. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Likelihood pornography_likelihood = 2; + * @param int $var + * @return $this + */ + public function setPornographyLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VideoIntelligence\V1beta2\Likelihood::class); + $this->pornography_likelihood = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceAnnotation.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceAnnotation.php new file mode 100644 index 00000000000..7b8e3170910 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceAnnotation.php @@ -0,0 +1,135 @@ +google.cloud.videointelligence.v1beta2.FaceAnnotation + */ +class FaceAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + */ + protected $thumbnail = ''; + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceSegment segments = 2; + */ + private $segments; + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceFrame frames = 3; + */ + private $frames; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $thumbnail + * Thumbnail of a representative face view (in JPEG format). + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\FaceSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where a face was detected. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\FaceFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where a face was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + * @return string + */ + public function getThumbnail() + { + return $this->thumbnail; + } + + /** + * Thumbnail of a representative face view (in JPEG format). + * + * Generated from protobuf field bytes thumbnail = 1; + * @param string $var + * @return $this + */ + public function setThumbnail($var) + { + GPBUtil::checkString($var, False); + $this->thumbnail = $var; + + return $this; + } + + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceSegment segments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceSegment segments = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\FaceSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\FaceSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceFrame frames = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where a face was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceFrame frames = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\FaceFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\FaceFrame::class); + $this->frames = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceDetectionConfig.php new file mode 100644 index 00000000000..350580eb3ff --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceDetectionConfig.php @@ -0,0 +1,109 @@ +google.cloud.videointelligence.v1beta2.FaceDetectionConfig + */ +class FaceDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + /** + * Whether bounding boxes be included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + */ + protected $include_bounding_boxes = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * @type bool $include_bounding_boxes + * Whether bounding boxes be included in the face annotation output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for face detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Whether bounding boxes be included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + * @return bool + */ + public function getIncludeBoundingBoxes() + { + return $this->include_bounding_boxes; + } + + /** + * Whether bounding boxes be included in the face annotation output. + * + * Generated from protobuf field bool include_bounding_boxes = 2; + * @param bool $var + * @return $this + */ + public function setIncludeBoundingBoxes($var) + { + GPBUtil::checkBool($var); + $this->include_bounding_boxes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceFrame.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceFrame.php new file mode 100644 index 00000000000..4e0b3f33afe --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceFrame.php @@ -0,0 +1,123 @@ +google.cloud.videointelligence.v1beta2.FaceFrame + */ +class FaceFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.NormalizedBoundingBox normalized_bounding_boxes = 1; + */ + private $normalized_bounding_boxes; + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + */ + protected $time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\NormalizedBoundingBox>|\Google\Protobuf\Internal\RepeatedField $normalized_bounding_boxes + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.NormalizedBoundingBox normalized_bounding_boxes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNormalizedBoundingBoxes() + { + return $this->normalized_bounding_boxes; + } + + /** + * Normalized Bounding boxes in a frame. + * There can be more than one boxes if the same face is detected in multiple + * locations within the current frame. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.NormalizedBoundingBox normalized_bounding_boxes = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\NormalizedBoundingBox>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNormalizedBoundingBoxes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\NormalizedBoundingBox::class); + $this->normalized_bounding_boxes = $arr; + + return $this; + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceSegment.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceSegment.php new file mode 100644 index 00000000000..47abe5a8e46 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/FaceSegment.php @@ -0,0 +1,77 @@ +google.cloud.videointelligence.v1beta2.FaceSegment + */ +class FaceSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + */ + protected $segment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment $segment + * Video segment where a face was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment where a face was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class); + $this->segment = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Feature.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Feature.php new file mode 100644 index 00000000000..bee87e3b163 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Feature.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1beta2.Feature + */ +class Feature +{ + /** + * Unspecified. + * + * Generated from protobuf enum FEATURE_UNSPECIFIED = 0; + */ + const FEATURE_UNSPECIFIED = 0; + /** + * Label detection. Detect objects, such as dog or flower. + * + * Generated from protobuf enum LABEL_DETECTION = 1; + */ + const LABEL_DETECTION = 1; + /** + * Shot change detection. + * + * Generated from protobuf enum SHOT_CHANGE_DETECTION = 2; + */ + const SHOT_CHANGE_DETECTION = 2; + /** + * Explicit content detection. + * + * Generated from protobuf enum EXPLICIT_CONTENT_DETECTION = 3; + */ + const EXPLICIT_CONTENT_DETECTION = 3; + /** + * Human face detection and tracking. + * + * Generated from protobuf enum FACE_DETECTION = 4; + */ + const FACE_DETECTION = 4; + + private static $valueToName = [ + self::FEATURE_UNSPECIFIED => 'FEATURE_UNSPECIFIED', + self::LABEL_DETECTION => 'LABEL_DETECTION', + self::SHOT_CHANGE_DETECTION => 'SHOT_CHANGE_DETECTION', + self::EXPLICIT_CONTENT_DETECTION => 'EXPLICIT_CONTENT_DETECTION', + self::FACE_DETECTION => 'FACE_DETECTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelAnnotation.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelAnnotation.php new file mode 100644 index 00000000000..3aa1f0ee7df --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelAnnotation.php @@ -0,0 +1,191 @@ +google.cloud.videointelligence.v1beta2.LabelAnnotation + */ +class LabelAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Entity entity = 1; + */ + protected $entity = null; + /** + * Common categories for the detected entity. + * E.g. when the label is `Terrier` the category is likely `dog`. And in some + * cases there might be more than one categories e.g. `Terrier` could also be + * a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Entity category_entities = 2; + */ + private $category_entities; + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelSegment segments = 3; + */ + private $segments; + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelFrame frames = 4; + */ + private $frames; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1beta2\Entity $entity + * Detected entity. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $category_entities + * Common categories for the detected entity. + * E.g. when the label is `Terrier` the category is likely `dog`. And in some + * cases there might be more than one categories e.g. `Terrier` could also be + * a `pet`. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\LabelSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * All video segments where a label was detected. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\LabelFrame>|\Google\Protobuf\Internal\RepeatedField $frames + * All video frames where a label was detected. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Entity entity = 1; + * @return \Google\Cloud\VideoIntelligence\V1beta2\Entity|null + */ + public function getEntity() + { + return $this->entity; + } + + public function hasEntity() + { + return isset($this->entity); + } + + public function clearEntity() + { + unset($this->entity); + } + + /** + * Detected entity. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.Entity entity = 1; + * @param \Google\Cloud\VideoIntelligence\V1beta2\Entity $var + * @return $this + */ + public function setEntity($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\Entity::class); + $this->entity = $var; + + return $this; + } + + /** + * Common categories for the detected entity. + * E.g. when the label is `Terrier` the category is likely `dog`. And in some + * cases there might be more than one categories e.g. `Terrier` could also be + * a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Entity category_entities = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategoryEntities() + { + return $this->category_entities; + } + + /** + * Common categories for the detected entity. + * E.g. when the label is `Terrier` the category is likely `dog`. And in some + * cases there might be more than one categories e.g. `Terrier` could also be + * a `pet`. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.Entity category_entities = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategoryEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\Entity::class); + $this->category_entities = $arr; + + return $this; + } + + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelSegment segments = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * All video segments where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelSegment segments = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\LabelSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelFrame frames = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrames() + { + return $this->frames; + } + + /** + * All video frames where a label was detected. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelFrame frames = 4; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\LabelFrame>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelFrame::class); + $this->frames = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionConfig.php new file mode 100644 index 00000000000..ae04363e879 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionConfig.php @@ -0,0 +1,159 @@ +google.cloud.videointelligence.v1beta2.LabelDetectionConfig + */ +class LabelDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionMode label_detection_mode = 1; + */ + protected $label_detection_mode = 0; + /** + * Whether the video has been shot from a stationary (i.e. non-moving) camera. + * When set to true, might improve detection accuracy for moving objects. + * Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + */ + protected $stationary_camera = false; + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $label_detection_mode + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * @type bool $stationary_camera + * Whether the video has been shot from a stationary (i.e. non-moving) camera. + * When set to true, might improve detection accuracy for moving objects. + * Should be used with `SHOT_AND_FRAME_MODE` enabled. + * @type string $model + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionMode label_detection_mode = 1; + * @return int + */ + public function getLabelDetectionMode() + { + return $this->label_detection_mode; + } + + /** + * What labels should be detected with LABEL_DETECTION, in addition to + * video-level labels or segment-level labels. + * If unspecified, defaults to `SHOT_MODE`. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionMode label_detection_mode = 1; + * @param int $var + * @return $this + */ + public function setLabelDetectionMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionMode::class); + $this->label_detection_mode = $var; + + return $this; + } + + /** + * Whether the video has been shot from a stationary (i.e. non-moving) camera. + * When set to true, might improve detection accuracy for moving objects. + * Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + * @return bool + */ + public function getStationaryCamera() + { + return $this->stationary_camera; + } + + /** + * Whether the video has been shot from a stationary (i.e. non-moving) camera. + * When set to true, might improve detection accuracy for moving objects. + * Should be used with `SHOT_AND_FRAME_MODE` enabled. + * + * Generated from protobuf field bool stationary_camera = 2; + * @param bool $var + * @return $this + */ + public function setStationaryCamera($var) + { + GPBUtil::checkBool($var); + $this->stationary_camera = $var; + + return $this; + } + + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for label detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionMode.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionMode.php new file mode 100644 index 00000000000..32e8cfccd76 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelDetectionMode.php @@ -0,0 +1,68 @@ +google.cloud.videointelligence.v1beta2.LabelDetectionMode + */ +class LabelDetectionMode +{ + /** + * Unspecified. + * + * Generated from protobuf enum LABEL_DETECTION_MODE_UNSPECIFIED = 0; + */ + const LABEL_DETECTION_MODE_UNSPECIFIED = 0; + /** + * Detect shot-level labels. + * + * Generated from protobuf enum SHOT_MODE = 1; + */ + const SHOT_MODE = 1; + /** + * Detect frame-level labels. + * + * Generated from protobuf enum FRAME_MODE = 2; + */ + const FRAME_MODE = 2; + /** + * Detect both shot-level and frame-level labels. + * + * Generated from protobuf enum SHOT_AND_FRAME_MODE = 3; + */ + const SHOT_AND_FRAME_MODE = 3; + + private static $valueToName = [ + self::LABEL_DETECTION_MODE_UNSPECIFIED => 'LABEL_DETECTION_MODE_UNSPECIFIED', + self::SHOT_MODE => 'SHOT_MODE', + self::FRAME_MODE => 'FRAME_MODE', + self::SHOT_AND_FRAME_MODE => 'SHOT_AND_FRAME_MODE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelFrame.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelFrame.php new file mode 100644 index 00000000000..5f8c46878c3 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelFrame.php @@ -0,0 +1,115 @@ +google.cloud.videointelligence.v1beta2.LabelFrame + */ +class LabelFrame extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + */ + protected $time_offset = null; + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $time_offset + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * @type float $confidence + * Confidence that the label is accurate. Range: [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, corresponding to the + * video frame for this location. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelSegment.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelSegment.php new file mode 100644 index 00000000000..a88a5e7cd07 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/LabelSegment.php @@ -0,0 +1,111 @@ +google.cloud.videointelligence.v1beta2.LabelSegment + */ +class LabelSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + */ + protected $segment = null; + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment $segment + * Video segment where a label was detected. + * @type float $confidence + * Confidence that the label is accurate. Range: [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + * @return \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment|null + */ + public function getSegment() + { + return $this->segment; + } + + public function hasSegment() + { + return isset($this->segment); + } + + public function clearSegment() + { + unset($this->segment); + } + + /** + * Video segment where a label was detected. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.VideoSegment segment = 1; + * @param \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment $var + * @return $this + */ + public function setSegment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class); + $this->segment = $var; + + return $this; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence that the label is accurate. Range: [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Likelihood.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Likelihood.php new file mode 100644 index 00000000000..e6446ff822a --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/Likelihood.php @@ -0,0 +1,82 @@ +google.cloud.videointelligence.v1beta2.Likelihood + */ +class Likelihood +{ + /** + * Unspecified likelihood. + * + * Generated from protobuf enum LIKELIHOOD_UNSPECIFIED = 0; + */ + const LIKELIHOOD_UNSPECIFIED = 0; + /** + * Very unlikely. + * + * Generated from protobuf enum VERY_UNLIKELY = 1; + */ + const VERY_UNLIKELY = 1; + /** + * Unlikely. + * + * Generated from protobuf enum UNLIKELY = 2; + */ + const UNLIKELY = 2; + /** + * Possible. + * + * Generated from protobuf enum POSSIBLE = 3; + */ + const POSSIBLE = 3; + /** + * Likely. + * + * Generated from protobuf enum LIKELY = 4; + */ + const LIKELY = 4; + /** + * Very likely. + * + * Generated from protobuf enum VERY_LIKELY = 5; + */ + const VERY_LIKELY = 5; + + private static $valueToName = [ + self::LIKELIHOOD_UNSPECIFIED => 'LIKELIHOOD_UNSPECIFIED', + self::VERY_UNLIKELY => 'VERY_UNLIKELY', + self::UNLIKELY => 'UNLIKELY', + self::POSSIBLE => 'POSSIBLE', + self::LIKELY => 'LIKELY', + self::VERY_LIKELY => 'VERY_LIKELY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/NormalizedBoundingBox.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/NormalizedBoundingBox.php new file mode 100644 index 00000000000..06cb95229c8 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/NormalizedBoundingBox.php @@ -0,0 +1,171 @@ +google.cloud.videointelligence.v1beta2.NormalizedBoundingBox + */ +class NormalizedBoundingBox extends \Google\Protobuf\Internal\Message +{ + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + */ + protected $left = 0.0; + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + */ + protected $top = 0.0; + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + */ + protected $right = 0.0; + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + */ + protected $bottom = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $left + * Left X coordinate. + * @type float $top + * Top Y coordinate. + * @type float $right + * Right X coordinate. + * @type float $bottom + * Bottom Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + * @return float + */ + public function getLeft() + { + return $this->left; + } + + /** + * Left X coordinate. + * + * Generated from protobuf field float left = 1; + * @param float $var + * @return $this + */ + public function setLeft($var) + { + GPBUtil::checkFloat($var); + $this->left = $var; + + return $this; + } + + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + * @return float + */ + public function getTop() + { + return $this->top; + } + + /** + * Top Y coordinate. + * + * Generated from protobuf field float top = 2; + * @param float $var + * @return $this + */ + public function setTop($var) + { + GPBUtil::checkFloat($var); + $this->top = $var; + + return $this; + } + + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + * @return float + */ + public function getRight() + { + return $this->right; + } + + /** + * Right X coordinate. + * + * Generated from protobuf field float right = 3; + * @param float $var + * @return $this + */ + public function setRight($var) + { + GPBUtil::checkFloat($var); + $this->right = $var; + + return $this; + } + + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + * @return float + */ + public function getBottom() + { + return $this->bottom; + } + + /** + * Bottom Y coordinate. + * + * Generated from protobuf field float bottom = 4; + * @param float $var + * @return $this + */ + public function setBottom($var) + { + GPBUtil::checkFloat($var); + $this->bottom = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ShotChangeDetectionConfig.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ShotChangeDetectionConfig.php new file mode 100644 index 00000000000..f461114a29f --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/ShotChangeDetectionConfig.php @@ -0,0 +1,75 @@ +google.cloud.videointelligence.v1beta2.ShotChangeDetectionConfig + */ +class ShotChangeDetectionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for shot change detection. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationProgress.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationProgress.php new file mode 100644 index 00000000000..5f45313b486 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationProgress.php @@ -0,0 +1,197 @@ +google.cloud.videointelligence.v1beta2.VideoAnnotationProgress + */ +class VideoAnnotationProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * Approximate percentage processed thus far. + * Guaranteed to be 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + */ + protected $progress_percent = 0; + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + */ + protected $start_time = null; + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * @type int $progress_percent + * Approximate percentage processed thus far. + * Guaranteed to be 100 when fully processed. + * @type \Google\Protobuf\Timestamp $start_time + * Time when the request was received. + * @type \Google\Protobuf\Timestamp $update_time + * Time of the most recent update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * Approximate percentage processed thus far. + * Guaranteed to be 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Approximate percentage processed thus far. + * Guaranteed to be 100 when fully processed. + * + * Generated from protobuf field int32 progress_percent = 2; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time when the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Time of the most recent update. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationResults.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationResults.php new file mode 100644 index 00000000000..976fddaf8c4 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoAnnotationResults.php @@ -0,0 +1,345 @@ +google.cloud.videointelligence.v1beta2.VideoAnnotationResults + */ +class VideoAnnotationResults extends \Google\Protobuf\Internal\Message +{ + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + */ + protected $input_uri = ''; + /** + * Label annotations on video level or user specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation segment_label_annotations = 2; + */ + private $segment_label_annotations; + /** + * Label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation shot_label_annotations = 3; + */ + private $shot_label_annotations; + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation frame_label_annotations = 4; + */ + private $frame_label_annotations; + /** + * Face annotations. There is exactly one element for each unique face. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceAnnotation face_annotations = 5; + */ + private $face_annotations; + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment shot_annotations = 6; + */ + private $shot_annotations; + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentAnnotation explicit_annotation = 7; + */ + protected $explicit_annotation = null; + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + */ + protected $error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_uri + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $segment_label_annotations + * Label annotations on video level or user specified segment level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $shot_label_annotations + * Label annotations on shot level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $frame_label_annotations + * Label annotations on frame level. + * There is exactly one element for each unique label. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $face_annotations + * Face annotations. There is exactly one element for each unique face. + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $shot_annotations + * Shot annotations. Each shot is represented as a video segment. + * @type \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentAnnotation $explicit_annotation + * Explicit content annotation. + * @type \Google\Rpc\Status $error + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Video file location in + * [Google Cloud Storage](https://cloud.google.com/storage/). + * + * Generated from protobuf field string input_uri = 1; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * Label annotations on video level or user specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation segment_label_annotations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegmentLabelAnnotations() + { + return $this->segment_label_annotations; + } + + /** + * Label annotations on video level or user specified segment level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation segment_label_annotations = 2; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegmentLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation::class); + $this->segment_label_annotations = $arr; + + return $this; + } + + /** + * Label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation shot_label_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShotLabelAnnotations() + { + return $this->shot_label_annotations; + } + + /** + * Label annotations on shot level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation shot_label_annotations = 3; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShotLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation::class); + $this->shot_label_annotations = $arr; + + return $this; + } + + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation frame_label_annotations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFrameLabelAnnotations() + { + return $this->frame_label_annotations; + } + + /** + * Label annotations on frame level. + * There is exactly one element for each unique label. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.LabelAnnotation frame_label_annotations = 4; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFrameLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\LabelAnnotation::class); + $this->frame_label_annotations = $arr; + + return $this; + } + + /** + * Face annotations. There is exactly one element for each unique face. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceAnnotation face_annotations = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFaceAnnotations() + { + return $this->face_annotations; + } + + /** + * Face annotations. There is exactly one element for each unique face. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.FaceAnnotation face_annotations = 5; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFaceAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\FaceAnnotation::class); + $this->face_annotations = $arr; + + return $this; + } + + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment shot_annotations = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getShotAnnotations() + { + return $this->shot_annotations; + } + + /** + * Shot annotations. Each shot is represented as a video segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment shot_annotations = 6; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setShotAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class); + $this->shot_annotations = $arr; + + return $this; + } + + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentAnnotation explicit_annotation = 7; + * @return \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentAnnotation|null + */ + public function getExplicitAnnotation() + { + return $this->explicit_annotation; + } + + public function hasExplicitAnnotation() + { + return isset($this->explicit_annotation); + } + + public function clearExplicitAnnotation() + { + unset($this->explicit_annotation); + } + + /** + * Explicit content annotation. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentAnnotation explicit_annotation = 7; + * @param \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentAnnotation $var + * @return $this + */ + public function setExplicitAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentAnnotation::class); + $this->explicit_annotation = $var; + + return $this; + } + + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, indicates an error. Note that for a single `AnnotateVideoRequest` + * some videos may succeed and some may fail. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoContext.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoContext.php new file mode 100644 index 00000000000..8d7922f911f --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoContext.php @@ -0,0 +1,251 @@ +google.cloud.videointelligence.v1beta2.VideoContext + */ +class VideoContext extends \Google\Protobuf\Internal\Message +{ + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment segments = 1; + */ + private $segments; + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionConfig label_detection_config = 2; + */ + protected $label_detection_config = null; + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ShotChangeDetectionConfig shot_change_detection_config = 3; + */ + protected $shot_change_detection_config = null; + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + */ + protected $explicit_content_detection_config = null; + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.FaceDetectionConfig face_detection_config = 5; + */ + protected $face_detection_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VideoIntelligence\V1beta2\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $segments + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * @type \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig $label_detection_config + * Config for LABEL_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1beta2\ShotChangeDetectionConfig $shot_change_detection_config + * Config for SHOT_CHANGE_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentDetectionConfig $explicit_content_detection_config + * Config for EXPLICIT_CONTENT_DETECTION. + * @type \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig $face_detection_config + * Config for FACE_DETECTION. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment segments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * Video segments to annotate. The segments may overlap and are not required + * to be contiguous or span the whole video. If unspecified, each video is + * treated as a single segment. + * + * Generated from protobuf field repeated .google.cloud.videointelligence.v1beta2.VideoSegment segments = 1; + * @param array<\Google\Cloud\VideoIntelligence\V1beta2\VideoSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VideoIntelligence\V1beta2\VideoSegment::class); + $this->segments = $arr; + + return $this; + } + + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionConfig label_detection_config = 2; + * @return \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig|null + */ + public function getLabelDetectionConfig() + { + return $this->label_detection_config; + } + + public function hasLabelDetectionConfig() + { + return isset($this->label_detection_config); + } + + public function clearLabelDetectionConfig() + { + unset($this->label_detection_config); + } + + /** + * Config for LABEL_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.LabelDetectionConfig label_detection_config = 2; + * @param \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig $var + * @return $this + */ + public function setLabelDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\LabelDetectionConfig::class); + $this->label_detection_config = $var; + + return $this; + } + + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ShotChangeDetectionConfig shot_change_detection_config = 3; + * @return \Google\Cloud\VideoIntelligence\V1beta2\ShotChangeDetectionConfig|null + */ + public function getShotChangeDetectionConfig() + { + return $this->shot_change_detection_config; + } + + public function hasShotChangeDetectionConfig() + { + return isset($this->shot_change_detection_config); + } + + public function clearShotChangeDetectionConfig() + { + unset($this->shot_change_detection_config); + } + + /** + * Config for SHOT_CHANGE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ShotChangeDetectionConfig shot_change_detection_config = 3; + * @param \Google\Cloud\VideoIntelligence\V1beta2\ShotChangeDetectionConfig $var + * @return $this + */ + public function setShotChangeDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\ShotChangeDetectionConfig::class); + $this->shot_change_detection_config = $var; + + return $this; + } + + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + * @return \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentDetectionConfig|null + */ + public function getExplicitContentDetectionConfig() + { + return $this->explicit_content_detection_config; + } + + public function hasExplicitContentDetectionConfig() + { + return isset($this->explicit_content_detection_config); + } + + public function clearExplicitContentDetectionConfig() + { + unset($this->explicit_content_detection_config); + } + + /** + * Config for EXPLICIT_CONTENT_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.ExplicitContentDetectionConfig explicit_content_detection_config = 4; + * @param \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentDetectionConfig $var + * @return $this + */ + public function setExplicitContentDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\ExplicitContentDetectionConfig::class); + $this->explicit_content_detection_config = $var; + + return $this; + } + + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.FaceDetectionConfig face_detection_config = 5; + * @return \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig|null + */ + public function getFaceDetectionConfig() + { + return $this->face_detection_config; + } + + public function hasFaceDetectionConfig() + { + return isset($this->face_detection_config); + } + + public function clearFaceDetectionConfig() + { + unset($this->face_detection_config); + } + + /** + * Config for FACE_DETECTION. + * + * Generated from protobuf field .google.cloud.videointelligence.v1beta2.FaceDetectionConfig face_detection_config = 5; + * @param \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig $var + * @return $this + */ + public function setFaceDetectionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VideoIntelligence\V1beta2\FaceDetectionConfig::class); + $this->face_detection_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoSegment.php b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoSegment.php new file mode 100644 index 00000000000..c5e2afc5d21 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/proto/src/Google/Cloud/VideoIntelligence/V1beta2/VideoSegment.php @@ -0,0 +1,129 @@ +google.cloud.videointelligence.v1beta2.VideoSegment + */ +class VideoSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + */ + protected $start_time_offset = null; + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + */ + protected $end_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $start_time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * @type \Google\Protobuf\Duration $end_time_offset + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Videointelligence\V1Beta2\VideoIntelligence::initOnce(); + parent::__construct($data); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the start of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * Time-offset, relative to the beginning of the video, + * corresponding to the end of the segment (inclusive). + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/samples/V1beta2/VideoIntelligenceServiceClient/annotate_video.php b/owl-bot-staging/VideoIntelligence/v1beta2/samples/V1beta2/VideoIntelligenceServiceClient/annotate_video.php new file mode 100644 index 00000000000..4a0f55e4118 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/samples/V1beta2/VideoIntelligenceServiceClient/annotate_video.php @@ -0,0 +1,84 @@ +annotateVideo($features); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AnnotateVideoResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $featuresElement = Feature::FEATURE_UNSPECIFIED; + + annotate_video_sample($featuresElement); +} +// [END videointelligence_v1beta2_generated_VideoIntelligenceService_AnnotateVideo_sync] diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php new file mode 100644 index 00000000000..fd333eeb6b7 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/Gapic/VideoIntelligenceServiceGapicClient.php @@ -0,0 +1,350 @@ +annotateVideo($features); + * $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 = $videoIntelligenceServiceClient->annotateVideo($features); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoIntelligenceServiceClient->close(); + * } + * ``` + * + * @experimental + * + * @deprecated This class will be removed in the next major version update. + */ +class VideoIntelligenceServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.videointelligence.v1beta2.VideoIntelligenceService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'videointelligence.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'videointelligence.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/video_intelligence_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/video_intelligence_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/video_intelligence_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/video_intelligence_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 'videointelligence.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Performs asynchronous video annotation. Progress and results can be + * retrieved through the `google.longrunning.Operations` interface. + * `Operation.metadata` contains `AnnotateVideoProgress` (progress). + * `Operation.response` contains `AnnotateVideoResponse` (results). + * + * Sample code: + * ``` + * $videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); + * try { + * $features = []; + * $operationResponse = $videoIntelligenceServiceClient->annotateVideo($features); + * $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 = $videoIntelligenceServiceClient->annotateVideo($features); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoIntelligenceServiceClient->resumeOperation($operationName, 'annotateVideo'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoIntelligenceServiceClient->close(); + * } + * ``` + * + * @param int[] $features Required. Requested video annotation features. + * For allowed values, use constants defined on {@see \Google\Cloud\VideoIntelligence\V1beta2\Feature} + * @param array $optionalArgs { + * Optional. + * + * @type string $inputUri + * Input video location. Currently, only + * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are + * supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). A video URI + * may include wildcards in `object-id`, and thus identify multiple videos. + * Supported wildcards: '*' to match 0 or more characters; + * '?' to match 1 character. If unset, the input video should be embedded + * in the request as `input_content`. If set, `input_content` should be unset. + * @type string $inputContent + * The video data bytes. + * If unset, the input video(s) should be specified via `input_uri`. + * If set, `input_uri` should be unset. + * @type VideoContext $videoContext + * Additional video context and/or feature-specific parameters. + * @type string $outputUri + * Optional. Location where the output (in JSON format) should be stored. + * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) + * URIs are supported, which must be specified in the following format: + * `gs://bucket-id/object-id` (other URI formats return + * [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For + * more information, see [Request + * URIs](https://cloud.google.com/storage/docs/request-endpoints). + * @type string $locationId + * Optional. Cloud region where annotation should take place. Supported cloud + * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region + * is specified, a region will be determined based on video file location. + * @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 + * + * @experimental + */ + public function annotateVideo($features, array $optionalArgs = []) + { + $request = new AnnotateVideoRequest(); + $request->setFeatures($features); + if (isset($optionalArgs['inputUri'])) { + $request->setInputUri($optionalArgs['inputUri']); + } + + if (isset($optionalArgs['inputContent'])) { + $request->setInputContent($optionalArgs['inputContent']); + } + + if (isset($optionalArgs['videoContext'])) { + $request->setVideoContext($optionalArgs['videoContext']); + } + + if (isset($optionalArgs['outputUri'])) { + $request->setOutputUri($optionalArgs['outputUri']); + } + + if (isset($optionalArgs['locationId'])) { + $request->setLocationId($optionalArgs['locationId']); + } + + return $this->startOperationsCall('AnnotateVideo', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/VideoIntelligenceServiceClient.php b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/VideoIntelligenceServiceClient.php new file mode 100644 index 00000000000..3fe45cc8648 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/VideoIntelligenceServiceClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.videointelligence.v1beta2.VideoIntelligenceService' => [ + 'AnnotateVideo' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VideoIntelligence\V1beta2\AnnotateVideoResponse', + 'metadataReturnType' => '\Google\Cloud\VideoIntelligence\V1beta2\AnnotateVideoProgress', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/resources/video_intelligence_service_rest_client_config.php b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/resources/video_intelligence_service_rest_client_config.php new file mode 100644 index 00000000000..86b6189ac47 --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/src/V1beta2/resources/video_intelligence_service_rest_client_config.php @@ -0,0 +1,80 @@ + [ + 'google.cloud.videointelligence.v1beta2.VideoIntelligenceService' => [ + 'AnnotateVideo' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/videos:annotate', + 'body' => '*', + ], + ], + 'google.longrunning.Operations' => [ + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta2/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta2/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta2/operations/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta2/{name=projects/*/locations/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta2/operations/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta2/operations/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VideoIntelligence/v1beta2/tests/Unit/V1beta2/VideoIntelligenceServiceClientTest.php b/owl-bot-staging/VideoIntelligence/v1beta2/tests/Unit/V1beta2/VideoIntelligenceServiceClientTest.php new file mode 100644 index 00000000000..1551f5a1c3e --- /dev/null +++ b/owl-bot-staging/VideoIntelligence/v1beta2/tests/Unit/V1beta2/VideoIntelligenceServiceClientTest.php @@ -0,0 +1,182 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VideoIntelligenceServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VideoIntelligenceServiceClient($options); + } + + /** @test */ + public function annotateVideoTest() + { + $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/annotateVideoTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AnnotateVideoResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/annotateVideoTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $features = []; + $response = $gapicClient->annotateVideo($features); + $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.videointelligence.v1beta2.VideoIntelligenceService/AnnotateVideo', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFeatures(); + $this->assertProtobufEquals($features, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + $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 annotateVideoExceptionTest() + { + $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/annotateVideoTest'); + $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 + $features = []; + $response = $gapicClient->annotateVideo($features); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/annotateVideoTest'); + 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()); + } +} diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Outputs.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Outputs.php new file mode 100644 index 00000000000..8a26de1c866 Binary files /dev/null and b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Outputs.php differ diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Resources.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Resources.php new file mode 100644 index 00000000000..b24d0d88d30 Binary files /dev/null and b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Resources.php differ diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Service.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Service.php new file mode 100644 index 00000000000..37258943886 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/GPBMetadata/Google/Cloud/Video/Livestream/V1/Service.php @@ -0,0 +1,215 @@ +internalAddGeneratedFile( + ' +D +.google/cloud/video/livestream/v1/service.proto google.cloud.video.livestream.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto0google/cloud/video/livestream/v1/resources.proto#google/longrunning/operations.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto" +CreateAssetRequest7 +parent ( B\'AA!livestream.googleapis.com/Asset; +asset ( 2\'.google.cloud.video.livestream.v1.AssetBA +asset_id ( BA + +request_id ( "_ +DeleteAssetRequest5 +name ( B\'AA! +livestream.googleapis.com/Asset + +request_id ( " +ListAssetsRequest7 +parent ( B\'AA!livestream.googleapis.com/Asset + page_size ( + +page_token (  +filter (  +order_by ( "{ +ListAssetsResponse7 +assets ( 2\'.google.cloud.video.livestream.v1.Asset +next_page_token (  + unreachable ( "H +GetAssetRequest5 +name ( B\'AA! +livestream.googleapis.com/Asset" +CreateChannelRequest9 +parent ( B)AA#!livestream.googleapis.com/Channel? +channel ( 2).google.cloud.video.livestream.v1.ChannelBA + +channel_id ( BA + +request_id ( " +ListChannelsRequest9 +parent ( B)AA#!livestream.googleapis.com/Channel + page_size ( + +page_token (  +filter (  +order_by ( " +ListChannelsResponse; +channels ( 2).google.cloud.video.livestream.v1.Channel +next_page_token (  + unreachable ( "L +GetChannelRequest7 +name ( B)AA# +!livestream.googleapis.com/Channel"r +DeleteChannelRequest7 +name ( B)AA# +!livestream.googleapis.com/Channel + +request_id (  +force (" +UpdateChannelRequest/ + update_mask ( 2.google.protobuf.FieldMask? +channel ( 2).google.cloud.video.livestream.v1.ChannelBA + +request_id ( "b +StartChannelRequest7 +name ( B)AA# +!livestream.googleapis.com/Channel + +request_id ( "a +StopChannelRequest7 +name ( B)AA# +!livestream.googleapis.com/Channel + +request_id ( " +CreateInputRequest7 +parent ( B\'AA!livestream.googleapis.com/Input; +input ( 2\'.google.cloud.video.livestream.v1.InputBA +input_id ( BA + +request_id ( " +ListInputsRequest7 +parent ( B\'AA!livestream.googleapis.com/Input + page_size ( + +page_token (  +filter (  +order_by ( "{ +ListInputsResponse7 +inputs ( 2\'.google.cloud.video.livestream.v1.Input +next_page_token (  + unreachable ( "H +GetInputRequest5 +name ( B\'AA! +livestream.googleapis.com/Input"_ +DeleteInputRequest5 +name ( B\'AA! +livestream.googleapis.com/Input + +request_id ( " +UpdateInputRequest/ + update_mask ( 2.google.protobuf.FieldMask; +input ( 2\'.google.cloud.video.livestream.v1.InputBA + +request_id ( " +CreateEventRequest7 +parent ( B\'AA!livestream.googleapis.com/Event; +event ( 2\'.google.cloud.video.livestream.v1.EventBA +event_id ( BA + +request_id ( " +ListEventsRequest7 +parent ( B\'AA!livestream.googleapis.com/Event + page_size ( + +page_token (  +filter (  +order_by ( "{ +ListEventsResponse7 +events ( 2\'.google.cloud.video.livestream.v1.Event +next_page_token (  + unreachable ( "H +GetEventRequest5 +name ( B\'AA! +livestream.googleapis.com/Event"_ +DeleteEventRequest5 +name ( B\'AA! +livestream.googleapis.com/Event + +request_id ( " +ChannelOperationResponse" +OperationMetadata4 + create_time ( 2.google.protobuf.TimestampBA1 +end_time ( 2.google.protobuf.TimestampBA +target ( BA +verb ( BA# +requested_cancellation (BA + api_version ( BA"F +GetPoolRequest4 +name ( B&AA +livestream.googleapis.com/Pool" +UpdatePoolRequest/ + update_mask ( 2.google.protobuf.FieldMask9 +pool ( 2&.google.cloud.video.livestream.v1.PoolBA + +request_id ( 2" +LivestreamService + CreateChannel6.google.cloud.video.livestream.v1.CreateChannelRequest.google.longrunning.Operation"xA +ChannelOperationMetadataAparent,channel,channel_id7",/v1/{parent=projects/*/locations/*}/channels:channel + ListChannels5.google.cloud.video.livestream.v1.ListChannelsRequest6.google.cloud.video.livestream.v1.ListChannelsResponse"=Aparent.,/v1/{parent=projects/*/locations/*}/channels + +GetChannel3.google.cloud.video.livestream.v1.GetChannelRequest).google.cloud.video.livestream.v1.Channel";Aname.,/v1/{name=projects/*/locations/*/channels/*} + DeleteChannel6.google.cloud.video.livestream.v1.DeleteChannelRequest.google.longrunning.Operation"hA* +google.protobuf.EmptyOperationMetadataAname.*,/v1/{name=projects/*/locations/*/channels/*} + UpdateChannel6.google.cloud.video.livestream.v1.UpdateChannelRequest.google.longrunning.Operation"zA +ChannelOperationMetadataAchannel,update_mask?24/v1/{channel.name=projects/*/locations/*/channels/*}:channel + StartChannel5.google.cloud.video.livestream.v1.StartChannelRequest.google.longrunning.Operation"tA- +ChannelOperationResponseOperationMetadataAname7"2/v1/{name=projects/*/locations/*/channels/*}:start:* + StopChannel4.google.cloud.video.livestream.v1.StopChannelRequest.google.longrunning.Operation"sA- +ChannelOperationResponseOperationMetadataAname6"1/v1/{name=projects/*/locations/*/channels/*}:stop:* + CreateInput4.google.cloud.video.livestream.v1.CreateInputRequest.google.longrunning.Operation"nA +InputOperationMetadataAparent,input,input_id3"*/v1/{parent=projects/*/locations/*}/inputs:input + +ListInputs3.google.cloud.video.livestream.v1.ListInputsRequest4.google.cloud.video.livestream.v1.ListInputsResponse";Aparent,*/v1/{parent=projects/*/locations/*}/inputs +GetInput1.google.cloud.video.livestream.v1.GetInputRequest\'.google.cloud.video.livestream.v1.Input"9Aname,*/v1/{name=projects/*/locations/*/inputs/*} + DeleteInput4.google.cloud.video.livestream.v1.DeleteInputRequest.google.longrunning.Operation"fA* +google.protobuf.EmptyOperationMetadataAname,**/v1/{name=projects/*/locations/*/inputs/*} + UpdateInput4.google.cloud.video.livestream.v1.UpdateInputRequest.google.longrunning.Operation"pA +InputOperationMetadataAinput,update_mask920/v1/{input.name=projects/*/locations/*/inputs/*}:input + CreateEvent4.google.cloud.video.livestream.v1.CreateEventRequest\'.google.cloud.video.livestream.v1.Event"\\Aparent,event,event_id>"5/v1/{parent=projects/*/locations/*/channels/*}/events:event + +ListEvents3.google.cloud.video.livestream.v1.ListEventsRequest4.google.cloud.video.livestream.v1.ListEventsResponse"FAparent75/v1/{parent=projects/*/locations/*/channels/*}/events +GetEvent1.google.cloud.video.livestream.v1.GetEventRequest\'.google.cloud.video.livestream.v1.Event"DAname75/v1/{name=projects/*/locations/*/channels/*/events/*} + DeleteEvent4.google.cloud.video.livestream.v1.DeleteEventRequest.google.protobuf.Empty"DAname7*5/v1/{name=projects/*/locations/*/channels/*/events/*} + CreateAsset4.google.cloud.video.livestream.v1.CreateAssetRequest.google.longrunning.Operation"nA +AssetOperationMetadataAparent,asset,asset_id3"*/v1/{parent=projects/*/locations/*}/assets:asset + DeleteAsset4.google.cloud.video.livestream.v1.DeleteAssetRequest.google.longrunning.Operation"fA* +google.protobuf.EmptyOperationMetadataAname,**/v1/{name=projects/*/locations/*/assets/*} +GetAsset1.google.cloud.video.livestream.v1.GetAssetRequest\'.google.cloud.video.livestream.v1.Asset"9Aname,*/v1/{name=projects/*/locations/*/assets/*} + +ListAssets3.google.cloud.video.livestream.v1.ListAssetsRequest4.google.cloud.video.livestream.v1.ListAssetsResponse";Aparent,*/v1/{parent=projects/*/locations/*}/assets +GetPool0.google.cloud.video.livestream.v1.GetPoolRequest&.google.cloud.video.livestream.v1.Pool"8Aname+)/v1/{name=projects/*/locations/*/pools/*} + +UpdatePool3.google.cloud.video.livestream.v1.UpdatePoolRequest.google.longrunning.Operation"kA +PoolOperationMetadataApool,update_mask62./v1/{pool.name=projects/*/locations/*/pools/*}:poolMAlivestream.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +$com.google.cloud.video.livestream.v1B ServiceProtoPZDcloud.google.com/go/video/livestream/apiv1/livestreampb;livestreampb Google.Cloud.Video.LiveStream.V1 Google\\Cloud\\Video\\LiveStream\\V1$Google::Cloud::Video::LiveStream::V1Ad +*secretmanager.googleapis.com/SecretVersion6projects/{project}/secrets/{secret}/versions/{version}AN +compute.googleapis.com/Network,projects/{project}/global/networks/{network}bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset.php new file mode 100644 index 00000000000..ab700b859ec --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset.php @@ -0,0 +1,416 @@ +google.cloud.video.livestream.v1.Asset + */ +class Asset extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the asset, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Based64-encoded CRC32c checksum of the asset file. For more information, + * see the crc32c checksum of the [Cloud Storage Objects + * resource](https://cloud.google.com/storage/docs/json_api/v1/objects). + * If crc32c is omitted or left empty when the asset is created, this field is + * filled by the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * If crc32c is set, the asset can't be created if the crc32c value does not + * match with the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * + * Generated from protobuf field string crc32c = 7; + */ + protected $crc32c = ''; + /** + * Output only. The state of the asset resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Only present when `state` is `ERROR`. The reason for the error + * state of the asset. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + protected $resource; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the asset, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined key/value metadata. + * @type \Google\Cloud\Video\LiveStream\V1\Asset\VideoAsset $video + * VideoAsset represents a video. + * @type \Google\Cloud\Video\LiveStream\V1\Asset\ImageAsset $image + * ImageAsset represents an image. + * @type string $crc32c + * Based64-encoded CRC32c checksum of the asset file. For more information, + * see the crc32c checksum of the [Cloud Storage Objects + * resource](https://cloud.google.com/storage/docs/json_api/v1/objects). + * If crc32c is omitted or left empty when the asset is created, this field is + * filled by the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * If crc32c is set, the asset can't be created if the crc32c value does not + * match with the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * @type int $state + * Output only. The state of the asset resource. + * @type \Google\Rpc\Status $error + * Output only. Only present when `state` is `ERROR`. The reason for the error + * state of the asset. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the asset, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the asset, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * VideoAsset represents a video. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.VideoAsset video = 5; + * @return \Google\Cloud\Video\LiveStream\V1\Asset\VideoAsset|null + */ + public function getVideo() + { + return $this->readOneof(5); + } + + public function hasVideo() + { + return $this->hasOneof(5); + } + + /** + * VideoAsset represents a video. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.VideoAsset video = 5; + * @param \Google\Cloud\Video\LiveStream\V1\Asset\VideoAsset $var + * @return $this + */ + public function setVideo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Asset\VideoAsset::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * ImageAsset represents an image. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.ImageAsset image = 6; + * @return \Google\Cloud\Video\LiveStream\V1\Asset\ImageAsset|null + */ + public function getImage() + { + return $this->readOneof(6); + } + + public function hasImage() + { + return $this->hasOneof(6); + } + + /** + * ImageAsset represents an image. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.ImageAsset image = 6; + * @param \Google\Cloud\Video\LiveStream\V1\Asset\ImageAsset $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Asset\ImageAsset::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Based64-encoded CRC32c checksum of the asset file. For more information, + * see the crc32c checksum of the [Cloud Storage Objects + * resource](https://cloud.google.com/storage/docs/json_api/v1/objects). + * If crc32c is omitted or left empty when the asset is created, this field is + * filled by the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * If crc32c is set, the asset can't be created if the crc32c value does not + * match with the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * + * Generated from protobuf field string crc32c = 7; + * @return string + */ + public function getCrc32C() + { + return $this->crc32c; + } + + /** + * Based64-encoded CRC32c checksum of the asset file. For more information, + * see the crc32c checksum of the [Cloud Storage Objects + * resource](https://cloud.google.com/storage/docs/json_api/v1/objects). + * If crc32c is omitted or left empty when the asset is created, this field is + * filled by the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * If crc32c is set, the asset can't be created if the crc32c value does not + * match with the crc32c checksum of the Cloud Storage object indicated by + * [VideoAsset.uri] or [ImageAsset.uri]. + * + * Generated from protobuf field string crc32c = 7; + * @param string $var + * @return $this + */ + public function setCrc32C($var) + { + GPBUtil::checkString($var, True); + $this->crc32c = $var; + + return $this; + } + + /** + * Output only. The state of the asset resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the asset resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Asset\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Only present when `state` is `ERROR`. The reason for the error + * state of the asset. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Only present when `state` is `ERROR`. The reason for the error + * state of the asset. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * @return string + */ + public function getResource() + { + return $this->whichOneof("resource"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/ImageAsset.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/ImageAsset.php new file mode 100644 index 00000000000..9fd78cc29b4 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/ImageAsset.php @@ -0,0 +1,70 @@ +google.cloud.video.livestream.v1.Asset.ImageAsset + */ +class ImageAsset extends \Google\Protobuf\Internal\Message +{ + /** + * Cloud Storage URI of the image. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Cloud Storage URI of the image. The format is `gs://my-bucket/my-object`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Cloud Storage URI of the image. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Cloud Storage URI of the image. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ImageAsset::class, \Google\Cloud\Video\LiveStream\V1\Asset_ImageAsset::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/State.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/State.php new file mode 100644 index 00000000000..4e41f646153 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/State.php @@ -0,0 +1,78 @@ +google.cloud.video.livestream.v1.Asset.State + */ +class State +{ + /** + * State is not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The asset is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The asset is ready for use. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The asset is being deleted. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + /** + * The asset has an error. + * + * Generated from protobuf enum ERROR = 4; + */ + const ERROR = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Video\LiveStream\V1\Asset_State::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/VideoAsset.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/VideoAsset.php new file mode 100644 index 00000000000..31acfd1216f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Asset/VideoAsset.php @@ -0,0 +1,72 @@ +google.cloud.video.livestream.v1.Asset.VideoAsset + */ +class VideoAsset extends \Google\Protobuf\Internal\Message +{ + /** + * Cloud Storage URI of the video. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Cloud Storage URI of the video. The format is `gs://my-bucket/my-object`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Cloud Storage URI of the video. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Cloud Storage URI of the video. The format is `gs://my-bucket/my-object`. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VideoAsset::class, \Google\Cloud\Video\LiveStream\V1\Asset_VideoAsset::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioFormat.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioFormat.php new file mode 100644 index 00000000000..183a2100156 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioFormat.php @@ -0,0 +1,135 @@ +google.cloud.video.livestream.v1.AudioFormat + */ +class AudioFormat extends \Google\Protobuf\Internal\Message +{ + /** + * Audio codec used in this audio stream. + * + * Generated from protobuf field string codec = 1; + */ + protected $codec = ''; + /** + * The number of audio channels. + * + * Generated from protobuf field int32 channel_count = 2; + */ + protected $channel_count = 0; + /** + * A list of channel names specifying the layout of the audio channels. + * + * Generated from protobuf field repeated string channel_layout = 3; + */ + private $channel_layout; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $codec + * Audio codec used in this audio stream. + * @type int $channel_count + * The number of audio channels. + * @type array|\Google\Protobuf\Internal\RepeatedField $channel_layout + * A list of channel names specifying the layout of the audio channels. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Audio codec used in this audio stream. + * + * Generated from protobuf field string codec = 1; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * Audio codec used in this audio stream. + * + * Generated from protobuf field string codec = 1; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + + /** + * The number of audio channels. + * + * Generated from protobuf field int32 channel_count = 2; + * @return int + */ + public function getChannelCount() + { + return $this->channel_count; + } + + /** + * The number of audio channels. + * + * Generated from protobuf field int32 channel_count = 2; + * @param int $var + * @return $this + */ + public function setChannelCount($var) + { + GPBUtil::checkInt32($var); + $this->channel_count = $var; + + return $this; + } + + /** + * A list of channel names specifying the layout of the audio channels. + * + * Generated from protobuf field repeated string channel_layout = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannelLayout() + { + return $this->channel_layout; + } + + /** + * A list of channel names specifying the layout of the audio channels. + * + * Generated from protobuf field repeated string channel_layout = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelLayout($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->channel_layout = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream.php new file mode 100644 index 00000000000..00455938495 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream.php @@ -0,0 +1,327 @@ +google.cloud.video.livestream.v1.AudioStream + */ +class AudioStream extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies whether pass through (transmuxing) is enabled or not. + * If set to `true`, the rest of the settings, other than `mapping`, will be + * ignored. The default is `false`. + * + * Generated from protobuf field bool transmux = 8; + */ + protected $transmux = false; + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * + * Generated from protobuf field string codec = 1; + */ + protected $codec = ''; + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + */ + protected $channel_count = 0; + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `[fl, fr]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + */ + private $channel_layout; + /** + * The mapping for the input streams and audio channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStream.AudioMapping mapping = 5; + */ + private $mapping; + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + */ + protected $sample_rate_hertz = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $transmux + * Specifies whether pass through (transmuxing) is enabled or not. + * If set to `true`, the rest of the settings, other than `mapping`, will be + * ignored. The default is `false`. + * @type string $codec + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * @type int $bitrate_bps + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * @type int $channel_count + * Number of audio channels. Must be between 1 and 6. The default is 2. + * @type array|\Google\Protobuf\Internal\RepeatedField $channel_layout + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `[fl, fr]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * @type array<\Google\Cloud\Video\LiveStream\V1\AudioStream\AudioMapping>|\Google\Protobuf\Internal\RepeatedField $mapping + * The mapping for the input streams and audio channels. + * @type int $sample_rate_hertz + * The audio sample rate in Hertz. The default is 48000 Hertz. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Specifies whether pass through (transmuxing) is enabled or not. + * If set to `true`, the rest of the settings, other than `mapping`, will be + * ignored. The default is `false`. + * + * Generated from protobuf field bool transmux = 8; + * @return bool + */ + public function getTransmux() + { + return $this->transmux; + } + + /** + * Specifies whether pass through (transmuxing) is enabled or not. + * If set to `true`, the rest of the settings, other than `mapping`, will be + * ignored. The default is `false`. + * + * Generated from protobuf field bool transmux = 8; + * @param bool $var + * @return $this + */ + public function setTransmux($var) + { + GPBUtil::checkBool($var); + $this->transmux = $var; + + return $this; + } + + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * + * Generated from protobuf field string codec = 1; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * + * Generated from protobuf field string codec = 1; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + * @return int + */ + public function getChannelCount() + { + return $this->channel_count; + } + + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + * @param int $var + * @return $this + */ + public function setChannelCount($var) + { + GPBUtil::checkInt32($var); + $this->channel_count = $var; + + return $this; + } + + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `[fl, fr]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannelLayout() + { + return $this->channel_layout; + } + + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `[fl, fr]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelLayout($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->channel_layout = $arr; + + return $this; + } + + /** + * The mapping for the input streams and audio channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStream.AudioMapping mapping = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMapping() + { + return $this->mapping; + } + + /** + * The mapping for the input streams and audio channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStream.AudioMapping mapping = 5; + * @param array<\Google\Cloud\Video\LiveStream\V1\AudioStream\AudioMapping>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMapping($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\AudioStream\AudioMapping::class); + $this->mapping = $arr; + + return $this; + } + + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream/AudioMapping.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream/AudioMapping.php new file mode 100644 index 00000000000..032ef41bd53 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStream/AudioMapping.php @@ -0,0 +1,246 @@ +google.cloud.video.livestream.v1.AudioStream.AudioMapping + */ +class AudioMapping extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `Channel` + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that identifies the input that this audio mapping applies to. If an + * active input doesn't have an audio mapping, the primary audio track in + * the input stream will be selected. + * + * Generated from protobuf field string input_key = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_key = ''; + /** + * Required. The zero-based index of the track in the input stream. + * All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in + * the same [AudioStream][google.cloud.video.livestream.v1.AudioStream] must + * have the same input track. + * + * Generated from protobuf field int32 input_track = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_track = 0; + /** + * Required. The zero-based index of the channel in the input stream. + * + * Generated from protobuf field int32 input_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_channel = 0; + /** + * Required. The zero-based index of the channel in the output audio stream. + * Must be consistent with the + * [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel]. + * + * Generated from protobuf field int32 output_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_channel = 0; + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 5; + */ + protected $gain_db = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_key + * Required. The `Channel` + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that identifies the input that this audio mapping applies to. If an + * active input doesn't have an audio mapping, the primary audio track in + * the input stream will be selected. + * @type int $input_track + * Required. The zero-based index of the track in the input stream. + * All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in + * the same [AudioStream][google.cloud.video.livestream.v1.AudioStream] must + * have the same input track. + * @type int $input_channel + * Required. The zero-based index of the channel in the input stream. + * @type int $output_channel + * Required. The zero-based index of the channel in the output audio stream. + * Must be consistent with the + * [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel]. + * @type float $gain_db + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `Channel` + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that identifies the input that this audio mapping applies to. If an + * active input doesn't have an audio mapping, the primary audio track in + * the input stream will be selected. + * + * Generated from protobuf field string input_key = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputKey() + { + return $this->input_key; + } + + /** + * Required. The `Channel` + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that identifies the input that this audio mapping applies to. If an + * active input doesn't have an audio mapping, the primary audio track in + * the input stream will be selected. + * + * Generated from protobuf field string input_key = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputKey($var) + { + GPBUtil::checkString($var, True); + $this->input_key = $var; + + return $this; + } + + /** + * Required. The zero-based index of the track in the input stream. + * All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in + * the same [AudioStream][google.cloud.video.livestream.v1.AudioStream] must + * have the same input track. + * + * Generated from protobuf field int32 input_track = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInputTrack() + { + return $this->input_track; + } + + /** + * Required. The zero-based index of the track in the input stream. + * All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in + * the same [AudioStream][google.cloud.video.livestream.v1.AudioStream] must + * have the same input track. + * + * Generated from protobuf field int32 input_track = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInputTrack($var) + { + GPBUtil::checkInt32($var); + $this->input_track = $var; + + return $this; + } + + /** + * Required. The zero-based index of the channel in the input stream. + * + * Generated from protobuf field int32 input_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInputChannel() + { + return $this->input_channel; + } + + /** + * Required. The zero-based index of the channel in the input stream. + * + * Generated from protobuf field int32 input_channel = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInputChannel($var) + { + GPBUtil::checkInt32($var); + $this->input_channel = $var; + + return $this; + } + + /** + * Required. The zero-based index of the channel in the output audio stream. + * Must be consistent with the + * [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel]. + * + * Generated from protobuf field int32 output_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getOutputChannel() + { + return $this->output_channel; + } + + /** + * Required. The zero-based index of the channel in the output audio stream. + * Must be consistent with the + * [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel]. + * + * Generated from protobuf field int32 output_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setOutputChannel($var) + { + GPBUtil::checkInt32($var); + $this->output_channel = $var; + + return $this; + } + + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 5; + * @return float + */ + public function getGainDb() + { + return $this->gain_db; + } + + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 5; + * @param float $var + * @return $this + */ + public function setGainDb($var) + { + GPBUtil::checkDouble($var); + $this->gain_db = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AudioMapping::class, \Google\Cloud\Video\LiveStream\V1\AudioStream_AudioMapping::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStreamProperty.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStreamProperty.php new file mode 100644 index 00000000000..320aecc2008 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/AudioStreamProperty.php @@ -0,0 +1,111 @@ +google.cloud.video.livestream.v1.AudioStreamProperty + */ +class AudioStreamProperty extends \Google\Protobuf\Internal\Message +{ + /** + * Index of this audio stream. + * + * Generated from protobuf field int32 index = 1; + */ + protected $index = 0; + /** + * Properties of the audio format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.AudioFormat audio_format = 2; + */ + protected $audio_format = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $index + * Index of this audio stream. + * @type \Google\Cloud\Video\LiveStream\V1\AudioFormat $audio_format + * Properties of the audio format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Index of this audio stream. + * + * Generated from protobuf field int32 index = 1; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * Index of this audio stream. + * + * Generated from protobuf field int32 index = 1; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * Properties of the audio format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.AudioFormat audio_format = 2; + * @return \Google\Cloud\Video\LiveStream\V1\AudioFormat|null + */ + public function getAudioFormat() + { + return $this->audio_format; + } + + public function hasAudioFormat() + { + return isset($this->audio_format); + } + + public function clearAudioFormat() + { + unset($this->audio_format); + } + + /** + * Properties of the audio format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.AudioFormat audio_format = 2; + * @param \Google\Cloud\Video\LiveStream\V1\AudioFormat $var + * @return $this + */ + public function setAudioFormat($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\AudioFormat::class); + $this->audio_format = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel.php new file mode 100644 index 00000000000..e776a7a3ec7 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel.php @@ -0,0 +1,745 @@ +google.cloud.video.livestream.v1.Channel + */ +class Channel extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the channel, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * A list of input attachments that this channel uses. + * One channel can have multiple inputs as the input sources. Only one + * input can be selected as the input source at one time. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.InputAttachment input_attachments = 16; + */ + private $input_attachments; + /** + * Output only. The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that serves as the current input source. The first input in the + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments] + * is the initial input source. + * + * Generated from protobuf field string active_input = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $active_input = ''; + /** + * Required. Information about the output (that is, the Cloud Storage bucket + * to store the generated live stream). + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.Output output = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output = null; + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.ElementaryStream elementary_streams = 10; + */ + private $elementary_streams; + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.MuxStream mux_streams = 11; + */ + private $mux_streams; + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Manifest manifests = 12; + */ + private $manifests; + /** + * List of output sprite sheets. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.SpriteSheet sprite_sheets = 13; + */ + private $sprite_sheets; + /** + * Output only. State of the streaming operation. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.StreamingState streaming_state = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $streaming_state = 0; + /** + * Output only. A description of the reason for the streaming error. This + * property is always present when + * [streaming_state][google.cloud.video.livestream.v1.Channel.streaming_state] + * is + * [STREAMING_ERROR][google.cloud.video.livestream.v1.Channel.StreamingState.STREAMING_ERROR]. + * + * Generated from protobuf field .google.rpc.Status streaming_error = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $streaming_error = null; + /** + * Configuration of platform logs for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig log_config = 19; + */ + protected $log_config = null; + /** + * Configuration of timecode for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig timecode_config = 21; + */ + protected $timecode_config = null; + /** + * Encryption configurations for this channel. Each configuration has an ID + * which is referred to by each MuxStream to indicate which configuration is + * used for that output. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Encryption encryptions = 24; + */ + private $encryptions; + /** + * The configuration for input sources defined in + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments]. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig input_config = 25; + */ + protected $input_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the channel, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined key/value metadata. + * @type array<\Google\Cloud\Video\LiveStream\V1\InputAttachment>|\Google\Protobuf\Internal\RepeatedField $input_attachments + * A list of input attachments that this channel uses. + * One channel can have multiple inputs as the input sources. Only one + * input can be selected as the input source at one time. + * @type string $active_input + * Output only. The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that serves as the current input source. The first input in the + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments] + * is the initial input source. + * @type \Google\Cloud\Video\LiveStream\V1\Channel\Output $output + * Required. Information about the output (that is, the Cloud Storage bucket + * to store the generated live stream). + * @type array<\Google\Cloud\Video\LiveStream\V1\ElementaryStream>|\Google\Protobuf\Internal\RepeatedField $elementary_streams + * List of elementary streams. + * @type array<\Google\Cloud\Video\LiveStream\V1\MuxStream>|\Google\Protobuf\Internal\RepeatedField $mux_streams + * List of multiplexing settings for output streams. + * @type array<\Google\Cloud\Video\LiveStream\V1\Manifest>|\Google\Protobuf\Internal\RepeatedField $manifests + * List of output manifests. + * @type array<\Google\Cloud\Video\LiveStream\V1\SpriteSheet>|\Google\Protobuf\Internal\RepeatedField $sprite_sheets + * List of output sprite sheets. + * @type int $streaming_state + * Output only. State of the streaming operation. + * @type \Google\Rpc\Status $streaming_error + * Output only. A description of the reason for the streaming error. This + * property is always present when + * [streaming_state][google.cloud.video.livestream.v1.Channel.streaming_state] + * is + * [STREAMING_ERROR][google.cloud.video.livestream.v1.Channel.StreamingState.STREAMING_ERROR]. + * @type \Google\Cloud\Video\LiveStream\V1\LogConfig $log_config + * Configuration of platform logs for this channel. + * @type \Google\Cloud\Video\LiveStream\V1\TimecodeConfig $timecode_config + * Configuration of timecode for this channel. + * @type array<\Google\Cloud\Video\LiveStream\V1\Encryption>|\Google\Protobuf\Internal\RepeatedField $encryptions + * Encryption configurations for this channel. Each configuration has an ID + * which is referred to by each MuxStream to indicate which configuration is + * used for that output. + * @type \Google\Cloud\Video\LiveStream\V1\InputConfig $input_config + * The configuration for input sources defined in + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the channel, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the channel, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * A list of input attachments that this channel uses. + * One channel can have multiple inputs as the input sources. Only one + * input can be selected as the input source at one time. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.InputAttachment input_attachments = 16; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputAttachments() + { + return $this->input_attachments; + } + + /** + * A list of input attachments that this channel uses. + * One channel can have multiple inputs as the input sources. Only one + * input can be selected as the input source at one time. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.InputAttachment input_attachments = 16; + * @param array<\Google\Cloud\Video\LiveStream\V1\InputAttachment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputAttachments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\InputAttachment::class); + $this->input_attachments = $arr; + + return $this; + } + + /** + * Output only. The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that serves as the current input source. The first input in the + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments] + * is the initial input source. + * + * Generated from protobuf field string active_input = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getActiveInput() + { + return $this->active_input; + } + + /** + * Output only. The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * that serves as the current input source. The first input in the + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments] + * is the initial input source. + * + * Generated from protobuf field string active_input = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setActiveInput($var) + { + GPBUtil::checkString($var, True); + $this->active_input = $var; + + return $this; + } + + /** + * Required. Information about the output (that is, the Cloud Storage bucket + * to store the generated live stream). + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.Output output = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Channel\Output|null + */ + public function getOutput() + { + return $this->output; + } + + public function hasOutput() + { + return isset($this->output); + } + + public function clearOutput() + { + unset($this->output); + } + + /** + * Required. Information about the output (that is, the Cloud Storage bucket + * to store the generated live stream). + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.Output output = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Channel\Output $var + * @return $this + */ + public function setOutput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Channel\Output::class); + $this->output = $var; + + return $this; + } + + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.ElementaryStream elementary_streams = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElementaryStreams() + { + return $this->elementary_streams; + } + + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.ElementaryStream elementary_streams = 10; + * @param array<\Google\Cloud\Video\LiveStream\V1\ElementaryStream>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElementaryStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\ElementaryStream::class); + $this->elementary_streams = $arr; + + return $this; + } + + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.MuxStream mux_streams = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMuxStreams() + { + return $this->mux_streams; + } + + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.MuxStream mux_streams = 11; + * @param array<\Google\Cloud\Video\LiveStream\V1\MuxStream>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMuxStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\MuxStream::class); + $this->mux_streams = $arr; + + return $this; + } + + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Manifest manifests = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManifests() + { + return $this->manifests; + } + + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Manifest manifests = 12; + * @param array<\Google\Cloud\Video\LiveStream\V1\Manifest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManifests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Manifest::class); + $this->manifests = $arr; + + return $this; + } + + /** + * List of output sprite sheets. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.SpriteSheet sprite_sheets = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpriteSheets() + { + return $this->sprite_sheets; + } + + /** + * List of output sprite sheets. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.SpriteSheet sprite_sheets = 13; + * @param array<\Google\Cloud\Video\LiveStream\V1\SpriteSheet>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpriteSheets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\SpriteSheet::class); + $this->sprite_sheets = $arr; + + return $this; + } + + /** + * Output only. State of the streaming operation. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.StreamingState streaming_state = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getStreamingState() + { + return $this->streaming_state; + } + + /** + * Output only. State of the streaming operation. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel.StreamingState streaming_state = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setStreamingState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Channel\StreamingState::class); + $this->streaming_state = $var; + + return $this; + } + + /** + * Output only. A description of the reason for the streaming error. This + * property is always present when + * [streaming_state][google.cloud.video.livestream.v1.Channel.streaming_state] + * is + * [STREAMING_ERROR][google.cloud.video.livestream.v1.Channel.StreamingState.STREAMING_ERROR]. + * + * Generated from protobuf field .google.rpc.Status streaming_error = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getStreamingError() + { + return $this->streaming_error; + } + + public function hasStreamingError() + { + return isset($this->streaming_error); + } + + public function clearStreamingError() + { + unset($this->streaming_error); + } + + /** + * Output only. A description of the reason for the streaming error. This + * property is always present when + * [streaming_state][google.cloud.video.livestream.v1.Channel.streaming_state] + * is + * [STREAMING_ERROR][google.cloud.video.livestream.v1.Channel.StreamingState.STREAMING_ERROR]. + * + * Generated from protobuf field .google.rpc.Status streaming_error = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStreamingError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->streaming_error = $var; + + return $this; + } + + /** + * Configuration of platform logs for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig log_config = 19; + * @return \Google\Cloud\Video\LiveStream\V1\LogConfig|null + */ + public function getLogConfig() + { + return $this->log_config; + } + + public function hasLogConfig() + { + return isset($this->log_config); + } + + public function clearLogConfig() + { + unset($this->log_config); + } + + /** + * Configuration of platform logs for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig log_config = 19; + * @param \Google\Cloud\Video\LiveStream\V1\LogConfig $var + * @return $this + */ + public function setLogConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\LogConfig::class); + $this->log_config = $var; + + return $this; + } + + /** + * Configuration of timecode for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig timecode_config = 21; + * @return \Google\Cloud\Video\LiveStream\V1\TimecodeConfig|null + */ + public function getTimecodeConfig() + { + return $this->timecode_config; + } + + public function hasTimecodeConfig() + { + return isset($this->timecode_config); + } + + public function clearTimecodeConfig() + { + unset($this->timecode_config); + } + + /** + * Configuration of timecode for this channel. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig timecode_config = 21; + * @param \Google\Cloud\Video\LiveStream\V1\TimecodeConfig $var + * @return $this + */ + public function setTimecodeConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\TimecodeConfig::class); + $this->timecode_config = $var; + + return $this; + } + + /** + * Encryption configurations for this channel. Each configuration has an ID + * which is referred to by each MuxStream to indicate which configuration is + * used for that output. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Encryption encryptions = 24; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEncryptions() + { + return $this->encryptions; + } + + /** + * Encryption configurations for this channel. Each configuration has an ID + * which is referred to by each MuxStream to indicate which configuration is + * used for that output. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Encryption encryptions = 24; + * @param array<\Google\Cloud\Video\LiveStream\V1\Encryption>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEncryptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Encryption::class); + $this->encryptions = $arr; + + return $this; + } + + /** + * The configuration for input sources defined in + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments]. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig input_config = 25; + * @return \Google\Cloud\Video\LiveStream\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * The configuration for input sources defined in + * [input_attachments][google.cloud.video.livestream.v1.Channel.input_attachments]. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig input_config = 25; + * @param \Google\Cloud\Video\LiveStream\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/Output.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/Output.php new file mode 100644 index 00000000000..1124a848808 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/Output.php @@ -0,0 +1,70 @@ +google.cloud.video.livestream.v1.Channel.Output + */ +class Output extends \Google\Protobuf\Internal\Message +{ + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Output::class, \Google\Cloud\Video\LiveStream\V1\Channel_Output::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/StreamingState.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/StreamingState.php new file mode 100644 index 00000000000..87b538780fb --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Channel/StreamingState.php @@ -0,0 +1,104 @@ +google.cloud.video.livestream.v1.Channel.StreamingState + */ +class StreamingState +{ + /** + * Streaming state is not specified. + * + * Generated from protobuf enum STREAMING_STATE_UNSPECIFIED = 0; + */ + const STREAMING_STATE_UNSPECIFIED = 0; + /** + * Channel is getting the input stream, generating the live streams to the + * specified output location. + * + * Generated from protobuf enum STREAMING = 1; + */ + const STREAMING = 1; + /** + * Channel is waiting for the input stream through the input. + * + * Generated from protobuf enum AWAITING_INPUT = 2; + */ + const AWAITING_INPUT = 2; + /** + * Channel is running, but has trouble publishing the live streams onto the + * specified output location (for example, the specified Cloud Storage + * bucket is not writable). + * + * Generated from protobuf enum STREAMING_ERROR = 4; + */ + const STREAMING_ERROR = 4; + /** + * Channel is generating live streams with no input stream. Live streams are + * filled out with black screen, while input stream is missing. + * Not supported yet. + * + * Generated from protobuf enum STREAMING_NO_INPUT = 5; + */ + const STREAMING_NO_INPUT = 5; + /** + * Channel is stopped, finishing live streams. + * + * Generated from protobuf enum STOPPED = 6; + */ + const STOPPED = 6; + /** + * Channel is starting. + * + * Generated from protobuf enum STARTING = 7; + */ + const STARTING = 7; + /** + * Channel is stopping. + * + * Generated from protobuf enum STOPPING = 8; + */ + const STOPPING = 8; + + private static $valueToName = [ + self::STREAMING_STATE_UNSPECIFIED => 'STREAMING_STATE_UNSPECIFIED', + self::STREAMING => 'STREAMING', + self::AWAITING_INPUT => 'AWAITING_INPUT', + self::STREAMING_ERROR => 'STREAMING_ERROR', + self::STREAMING_NO_INPUT => 'STREAMING_NO_INPUT', + self::STOPPED => 'STOPPED', + self::STARTING => 'STARTING', + self::STOPPING => 'STOPPING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StreamingState::class, \Google\Cloud\Video\LiveStream\V1\Channel_StreamingState::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ChannelOperationResponse.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ChannelOperationResponse.php new file mode 100644 index 00000000000..df5cc456724 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ChannelOperationResponse.php @@ -0,0 +1,33 @@ +google.cloud.video.livestream.v1.ChannelOperationResponse + */ +class ChannelOperationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateAssetRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateAssetRequest.php new file mode 100644 index 00000000000..101635a6352 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateAssetRequest.php @@ -0,0 +1,252 @@ +google.cloud.video.livestream.v1.CreateAssetRequest + */ +class CreateAssetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The asset resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset asset = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $asset = null; + /** + * Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string asset_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $asset_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\LiveStream\V1\Asset $asset Required. The asset resource to be created. + * @param string $assetId Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * @return \Google\Cloud\Video\LiveStream\V1\CreateAssetRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\LiveStream\V1\Asset $asset, string $assetId): self + { + return (new self()) + ->setParent($parent) + ->setAsset($asset) + ->setAssetId($assetId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type \Google\Cloud\Video\LiveStream\V1\Asset $asset + * Required. The asset resource to be created. + * @type string $asset_id + * Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The asset resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset asset = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Asset|null + */ + public function getAsset() + { + return $this->asset; + } + + public function hasAsset() + { + return isset($this->asset); + } + + public function clearAsset() + { + unset($this->asset); + } + + /** + * Required. The asset resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Asset asset = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Asset $var + * @return $this + */ + public function setAsset($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Asset::class); + $this->asset = $var; + + return $this; + } + + /** + * Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string asset_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAssetId() + { + return $this->asset_id; + } + + /** + * Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string asset_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAssetId($var) + { + GPBUtil::checkString($var, True); + $this->asset_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateChannelRequest.php new file mode 100644 index 00000000000..6945278c5aa --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateChannelRequest.php @@ -0,0 +1,252 @@ +google.cloud.video.livestream.v1.CreateChannelRequest + */ +class CreateChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The channel resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $channel = null; + /** + * Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string channel_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $channel_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\LiveStream\V1\Channel $channel Required. The channel resource to be created. + * @param string $channelId Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * @return \Google\Cloud\Video\LiveStream\V1\CreateChannelRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\LiveStream\V1\Channel $channel, string $channelId): self + { + return (new self()) + ->setParent($parent) + ->setChannel($channel) + ->setChannelId($channelId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type \Google\Cloud\Video\LiveStream\V1\Channel $channel + * Required. The channel resource to be created. + * @type string $channel_id + * Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The channel resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Channel|null + */ + public function getChannel() + { + return $this->channel; + } + + public function hasChannel() + { + return isset($this->channel); + } + + public function clearChannel() + { + unset($this->channel); + } + + /** + * Required. The channel resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Channel $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Channel::class); + $this->channel = $var; + + return $this; + } + + /** + * Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string channel_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getChannelId() + { + return $this->channel_id; + } + + /** + * Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string channel_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setChannelId($var) + { + GPBUtil::checkString($var, True); + $this->channel_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateEventRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateEventRequest.php new file mode 100644 index 00000000000..821c7f956b9 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateEventRequest.php @@ -0,0 +1,252 @@ +google.cloud.video.livestream.v1.CreateEventRequest + */ +class CreateEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The event resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event event = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event = null; + /** + * Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string event_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * @param \Google\Cloud\Video\LiveStream\V1\Event $event Required. The event resource to be created. + * @param string $eventId Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * @return \Google\Cloud\Video\LiveStream\V1\CreateEventRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\LiveStream\V1\Event $event, string $eventId): self + { + return (new self()) + ->setParent($parent) + ->setEvent($event) + ->setEventId($eventId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type \Google\Cloud\Video\LiveStream\V1\Event $event + * Required. The event resource to be created. + * @type string $event_id + * Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The event resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event event = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Event|null + */ + public function getEvent() + { + return $this->event; + } + + public function hasEvent() + { + return isset($this->event); + } + + public function clearEvent() + { + unset($this->event); + } + + /** + * Required. The event resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event event = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Event $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event::class); + $this->event = $var; + + return $this; + } + + /** + * Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string event_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEventId() + { + return $this->event_id; + } + + /** + * Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string event_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEventId($var) + { + GPBUtil::checkString($var, True); + $this->event_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateInputRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateInputRequest.php new file mode 100644 index 00000000000..839b2d4d046 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/CreateInputRequest.php @@ -0,0 +1,252 @@ +google.cloud.video.livestream.v1.CreateInputRequest + */ +class CreateInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The input resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string input_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\LiveStream\V1\Input $input Required. The input resource to be created. + * @param string $inputId Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * @return \Google\Cloud\Video\LiveStream\V1\CreateInputRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\LiveStream\V1\Input $input, string $inputId): self + { + return (new self()) + ->setParent($parent) + ->setInput($input) + ->setInputId($inputId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type \Google\Cloud\Video\LiveStream\V1\Input $input + * Required. The input resource to be created. + * @type string $input_id + * Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The input resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Input|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The input resource to be created. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Input $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Input::class); + $this->input = $var; + + return $this; + } + + /** + * Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string input_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputId() + { + return $this->input_id; + } + + /** + * Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * + * Generated from protobuf field string input_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputId($var) + { + GPBUtil::checkString($var, True); + $this->input_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteAssetRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteAssetRequest.php new file mode 100644 index 00000000000..6265ac92c35 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteAssetRequest.php @@ -0,0 +1,160 @@ +google.cloud.video.livestream.v1.DeleteAssetRequest + */ +class DeleteAssetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. Please see + * {@see LivestreamServiceClient::assetName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\DeleteAssetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteChannelRequest.php new file mode 100644 index 00000000000..e5ad476fe21 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteChannelRequest.php @@ -0,0 +1,206 @@ +google.cloud.video.livestream.v1.DeleteChannelRequest + */ +class DeleteChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + /** + * If the `force` field is set to the default value of `false`, you must + * delete all of a channel's events before you can delete the channel itself. + * If the field is set to `true`, requests to delete a channel also delete + * associated channel events. + * + * Generated from protobuf field bool force = 3; + */ + protected $force = false; + + /** + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\DeleteChannelRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @type bool $force + * If the `force` field is set to the default value of `false`, you must + * delete all of a channel's events before you can delete the channel itself. + * If the field is set to `true`, requests to delete a channel also delete + * associated channel events. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * If the `force` field is set to the default value of `false`, you must + * delete all of a channel's events before you can delete the channel itself. + * If the field is set to `true`, requests to delete a channel also delete + * associated channel events. + * + * Generated from protobuf field bool force = 3; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * If the `force` field is set to the default value of `false`, you must + * delete all of a channel's events before you can delete the channel itself. + * If the field is set to `true`, requests to delete a channel also delete + * associated channel events. + * + * Generated from protobuf field bool force = 3; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteEventRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteEventRequest.php new file mode 100644 index 00000000000..870470706fe --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteEventRequest.php @@ -0,0 +1,160 @@ +google.cloud.video.livestream.v1.DeleteEventRequest + */ +class DeleteEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. Please see + * {@see LivestreamServiceClient::eventName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\DeleteEventRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteInputRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteInputRequest.php new file mode 100644 index 00000000000..457d3d144f6 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/DeleteInputRequest.php @@ -0,0 +1,160 @@ +google.cloud.video.livestream.v1.DeleteInputRequest + */ +class DeleteInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. Please see + * {@see LivestreamServiceClient::inputName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\DeleteInputRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ElementaryStream.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ElementaryStream.php new file mode 100644 index 00000000000..029528a39f4 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ElementaryStream.php @@ -0,0 +1,177 @@ +google.cloud.video.livestream.v1.ElementaryStream + */ +class ElementaryStream extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + */ + protected $key = ''; + protected $elementary_stream; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this elementary stream. + * @type \Google\Cloud\Video\LiveStream\V1\VideoStream $video_stream + * Encoding of a video stream. + * @type \Google\Cloud\Video\LiveStream\V1\AudioStream $audio_stream + * Encoding of an audio stream. + * @type \Google\Cloud\Video\LiveStream\V1\TextStream $text_stream + * Encoding of a text stream. For example, closed captions or subtitles. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Encoding of a video stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoStream video_stream = 1; + * @return \Google\Cloud\Video\LiveStream\V1\VideoStream|null + */ + public function getVideoStream() + { + return $this->readOneof(1); + } + + public function hasVideoStream() + { + return $this->hasOneof(1); + } + + /** + * Encoding of a video stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoStream video_stream = 1; + * @param \Google\Cloud\Video\LiveStream\V1\VideoStream $var + * @return $this + */ + public function setVideoStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\VideoStream::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Encoding of an audio stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.AudioStream audio_stream = 2; + * @return \Google\Cloud\Video\LiveStream\V1\AudioStream|null + */ + public function getAudioStream() + { + return $this->readOneof(2); + } + + public function hasAudioStream() + { + return $this->hasOneof(2); + } + + /** + * Encoding of an audio stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.AudioStream audio_stream = 2; + * @param \Google\Cloud\Video\LiveStream\V1\AudioStream $var + * @return $this + */ + public function setAudioStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\AudioStream::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Encoding of a text stream. For example, closed captions or subtitles. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TextStream text_stream = 3; + * @return \Google\Cloud\Video\LiveStream\V1\TextStream|null + */ + public function getTextStream() + { + return $this->readOneof(3); + } + + public function hasTextStream() + { + return $this->hasOneof(3); + } + + /** + * Encoding of a text stream. For example, closed captions or subtitles. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TextStream text_stream = 3; + * @param \Google\Cloud\Video\LiveStream\V1\TextStream $var + * @return $this + */ + public function setTextStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\TextStream::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getElementaryStream() + { + return $this->whichOneof("elementary_stream"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption.php new file mode 100644 index 00000000000..a0e5fa6b0c1 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption.php @@ -0,0 +1,261 @@ +google.cloud.video.livestream.v1.Encryption + */ +class Encryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $id = ''; + /** + * Required. Configuration for DRM systems. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.DrmSystems drm_systems = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $drm_systems = null; + protected $secret_source; + protected $encryption_mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Required. Identifier for this set of encryption options. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\SecretManagerSource $secret_manager_key_source + * For keys stored in Google Secret Manager. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\DrmSystems $drm_systems + * Required. Configuration for DRM systems. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\Aes128Encryption $aes128 + * Configuration for HLS AES-128 encryption. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\SampleAesEncryption $sample_aes + * Configuration for HLS SAMPLE-AES encryption. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\MpegCommonEncryption $mpeg_cenc + * Configuration for MPEG-Dash Common Encryption (MPEG-CENC). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * For keys stored in Google Secret Manager. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.SecretManagerSource secret_manager_key_source = 7; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\SecretManagerSource|null + */ + public function getSecretManagerKeySource() + { + return $this->readOneof(7); + } + + public function hasSecretManagerKeySource() + { + return $this->hasOneof(7); + } + + /** + * For keys stored in Google Secret Manager. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.SecretManagerSource secret_manager_key_source = 7; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\SecretManagerSource $var + * @return $this + */ + public function setSecretManagerKeySource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\SecretManagerSource::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Required. Configuration for DRM systems. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.DrmSystems drm_systems = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\DrmSystems|null + */ + public function getDrmSystems() + { + return $this->drm_systems; + } + + public function hasDrmSystems() + { + return isset($this->drm_systems); + } + + public function clearDrmSystems() + { + unset($this->drm_systems); + } + + /** + * Required. Configuration for DRM systems. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.DrmSystems drm_systems = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\DrmSystems $var + * @return $this + */ + public function setDrmSystems($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\DrmSystems::class); + $this->drm_systems = $var; + + return $this; + } + + /** + * Configuration for HLS AES-128 encryption. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Aes128Encryption aes128 = 4; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\Aes128Encryption|null + */ + public function getAes128() + { + return $this->readOneof(4); + } + + public function hasAes128() + { + return $this->hasOneof(4); + } + + /** + * Configuration for HLS AES-128 encryption. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Aes128Encryption aes128 = 4; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\Aes128Encryption $var + * @return $this + */ + public function setAes128($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\Aes128Encryption::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Configuration for HLS SAMPLE-AES encryption. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.SampleAesEncryption sample_aes = 5; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\SampleAesEncryption|null + */ + public function getSampleAes() + { + return $this->readOneof(5); + } + + public function hasSampleAes() + { + return $this->hasOneof(5); + } + + /** + * Configuration for HLS SAMPLE-AES encryption. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.SampleAesEncryption sample_aes = 5; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\SampleAesEncryption $var + * @return $this + */ + public function setSampleAes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\SampleAesEncryption::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Configuration for MPEG-Dash Common Encryption (MPEG-CENC). + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.MpegCommonEncryption mpeg_cenc = 6; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\MpegCommonEncryption|null + */ + public function getMpegCenc() + { + return $this->readOneof(6); + } + + public function hasMpegCenc() + { + return $this->hasOneof(6); + } + + /** + * Configuration for MPEG-Dash Common Encryption (MPEG-CENC). + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.MpegCommonEncryption mpeg_cenc = 6; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\MpegCommonEncryption $var + * @return $this + */ + public function setMpegCenc($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\MpegCommonEncryption::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getSecretSource() + { + return $this->whichOneof("secret_source"); + } + + /** + * @return string + */ + public function getEncryptionMode() + { + return $this->whichOneof("encryption_mode"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Aes128Encryption.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Aes128Encryption.php new file mode 100644 index 00000000000..1903c805f7f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Aes128Encryption.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.Aes128Encryption + */ +class Aes128Encryption extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aes128Encryption::class, \Google\Cloud\Video\LiveStream\V1\Encryption_Aes128Encryption::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Clearkey.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Clearkey.php new file mode 100644 index 00000000000..cf2a3c4ff2d --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Clearkey.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.Clearkey + */ +class Clearkey extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Clearkey::class, \Google\Cloud\Video\LiveStream\V1\Encryption_Clearkey::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/DrmSystems.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/DrmSystems.php new file mode 100644 index 00000000000..c0123be1577 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/DrmSystems.php @@ -0,0 +1,213 @@ +google.cloud.video.livestream.v1.Encryption.DrmSystems + */ +class DrmSystems extends \Google\Protobuf\Internal\Message +{ + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Widevine widevine = 1; + */ + protected $widevine = null; + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Fairplay fairplay = 2; + */ + protected $fairplay = null; + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Playready playready = 3; + */ + protected $playready = null; + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Clearkey clearkey = 4; + */ + protected $clearkey = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\Widevine $widevine + * Widevine configuration. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\Fairplay $fairplay + * Fairplay configuration. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\Playready $playready + * Playready configuration. + * @type \Google\Cloud\Video\LiveStream\V1\Encryption\Clearkey $clearkey + * Clearkey configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Widevine widevine = 1; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\Widevine|null + */ + public function getWidevine() + { + return $this->widevine; + } + + public function hasWidevine() + { + return isset($this->widevine); + } + + public function clearWidevine() + { + unset($this->widevine); + } + + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Widevine widevine = 1; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\Widevine $var + * @return $this + */ + public function setWidevine($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\Widevine::class); + $this->widevine = $var; + + return $this; + } + + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Fairplay fairplay = 2; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\Fairplay|null + */ + public function getFairplay() + { + return $this->fairplay; + } + + public function hasFairplay() + { + return isset($this->fairplay); + } + + public function clearFairplay() + { + unset($this->fairplay); + } + + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Fairplay fairplay = 2; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\Fairplay $var + * @return $this + */ + public function setFairplay($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\Fairplay::class); + $this->fairplay = $var; + + return $this; + } + + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Playready playready = 3; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\Playready|null + */ + public function getPlayready() + { + return $this->playready; + } + + public function hasPlayready() + { + return isset($this->playready); + } + + public function clearPlayready() + { + unset($this->playready); + } + + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Playready playready = 3; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\Playready $var + * @return $this + */ + public function setPlayready($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\Playready::class); + $this->playready = $var; + + return $this; + } + + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Clearkey clearkey = 4; + * @return \Google\Cloud\Video\LiveStream\V1\Encryption\Clearkey|null + */ + public function getClearkey() + { + return $this->clearkey; + } + + public function hasClearkey() + { + return isset($this->clearkey); + } + + public function clearClearkey() + { + unset($this->clearkey); + } + + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Encryption.Clearkey clearkey = 4; + * @param \Google\Cloud\Video\LiveStream\V1\Encryption\Clearkey $var + * @return $this + */ + public function setClearkey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Encryption\Clearkey::class); + $this->clearkey = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DrmSystems::class, \Google\Cloud\Video\LiveStream\V1\Encryption_DrmSystems::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Fairplay.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Fairplay.php new file mode 100644 index 00000000000..dc53b5d3a7d --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Fairplay.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.Fairplay + */ +class Fairplay extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Fairplay::class, \Google\Cloud\Video\LiveStream\V1\Encryption_Fairplay::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/MpegCommonEncryption.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/MpegCommonEncryption.php new file mode 100644 index 00000000000..828acd25e26 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/MpegCommonEncryption.php @@ -0,0 +1,78 @@ +google.cloud.video.livestream.v1.Encryption.MpegCommonEncryption + */ +class MpegCommonEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Specify the encryption scheme, supported schemes: + * - `cenc` - AES-CTR subsample + * - `cbcs`- AES-CBC subsample pattern + * + * Generated from protobuf field string scheme = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scheme = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scheme + * Required. Specify the encryption scheme, supported schemes: + * - `cenc` - AES-CTR subsample + * - `cbcs`- AES-CBC subsample pattern + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Specify the encryption scheme, supported schemes: + * - `cenc` - AES-CTR subsample + * - `cbcs`- AES-CBC subsample pattern + * + * Generated from protobuf field string scheme = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getScheme() + { + return $this->scheme; + } + + /** + * Required. Specify the encryption scheme, supported schemes: + * - `cenc` - AES-CTR subsample + * - `cbcs`- AES-CBC subsample pattern + * + * Generated from protobuf field string scheme = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setScheme($var) + { + GPBUtil::checkString($var, True); + $this->scheme = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MpegCommonEncryption::class, \Google\Cloud\Video\LiveStream\V1\Encryption_MpegCommonEncryption::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Playready.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Playready.php new file mode 100644 index 00000000000..a1296c0e258 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Playready.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.Playready + */ +class Playready extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Playready::class, \Google\Cloud\Video\LiveStream\V1\Encryption_Playready::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SampleAesEncryption.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SampleAesEncryption.php new file mode 100644 index 00000000000..566b81c20da --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SampleAesEncryption.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.SampleAesEncryption + */ +class SampleAesEncryption extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SampleAesEncryption::class, \Google\Cloud\Video\LiveStream\V1\Encryption_SampleAesEncryption::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SecretManagerSource.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SecretManagerSource.php new file mode 100644 index 00000000000..0cd57526844 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/SecretManagerSource.php @@ -0,0 +1,74 @@ +google.cloud.video.livestream.v1.Encryption.SecretManagerSource + */ +class SecretManagerSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Secret Version containing the encryption key. + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $secret_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $secret_version + * Required. The name of the Secret Version containing the encryption key. + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Secret Version containing the encryption key. + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersion() + { + return $this->secret_version; + } + + /** + * Required. The name of the Secret Version containing the encryption key. + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersion($var) + { + GPBUtil::checkString($var, True); + $this->secret_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretManagerSource::class, \Google\Cloud\Video\LiveStream\V1\Encryption_SecretManagerSource::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Widevine.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Widevine.php new file mode 100644 index 00000000000..a14e8b2be44 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Encryption/Widevine.php @@ -0,0 +1,36 @@ +google.cloud.video.livestream.v1.Encryption.Widevine + */ +class Widevine extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Widevine::class, \Google\Cloud\Video\LiveStream\V1\Encryption_Widevine::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event.php new file mode 100644 index 00000000000..bfd03c15ae6 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event.php @@ -0,0 +1,601 @@ +google.cloud.video.livestream.v1.Event + */ +class Event extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the event, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * When this field is set to true, the event will be executed at the earliest + * time that the server can schedule the event and + * [execution_time][google.cloud.video.livestream.v1.Event.execution_time] + * will be populated with the time that the server actually schedules the + * event. + * + * Generated from protobuf field bool execute_now = 9; + */ + protected $execute_now = false; + /** + * The time to execute the event. If you set + * [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `true`, then do not set this field in the `CreateEvent` request. In + * this case, the server schedules the event and populates this field. If you + * set [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `false`, then you must set this field to at least 10 seconds in the future + * or else the event can't be created. + * + * Generated from protobuf field .google.protobuf.Timestamp execution_time = 10; + */ + protected $execution_time = null; + /** + * Output only. The state of the event. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + protected $task; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the event, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined key/value metadata. + * @type \Google\Cloud\Video\LiveStream\V1\Event\InputSwitchTask $input_switch + * Switches to another input stream. + * @type \Google\Cloud\Video\LiveStream\V1\Event\AdBreakTask $ad_break + * Inserts a new ad opportunity. + * @type \Google\Cloud\Video\LiveStream\V1\Event\ReturnToProgramTask $return_to_program + * Stops any running ad break. + * @type \Google\Cloud\Video\LiveStream\V1\Event\SlateTask $slate + * Inserts a slate. + * @type \Google\Cloud\Video\LiveStream\V1\Event\MuteTask $mute + * Mutes the stream. + * @type \Google\Cloud\Video\LiveStream\V1\Event\UnmuteTask $unmute + * Unmutes the stream. + * @type bool $execute_now + * When this field is set to true, the event will be executed at the earliest + * time that the server can schedule the event and + * [execution_time][google.cloud.video.livestream.v1.Event.execution_time] + * will be populated with the time that the server actually schedules the + * event. + * @type \Google\Protobuf\Timestamp $execution_time + * The time to execute the event. If you set + * [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `true`, then do not set this field in the `CreateEvent` request. In + * this case, the server schedules the event and populates this field. If you + * set [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `false`, then you must set this field to at least 10 seconds in the future + * or else the event can't be created. + * @type int $state + * Output only. The state of the event. + * @type \Google\Rpc\Status $error + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the event, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the event, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Switches to another input stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.InputSwitchTask input_switch = 5; + * @return \Google\Cloud\Video\LiveStream\V1\Event\InputSwitchTask|null + */ + public function getInputSwitch() + { + return $this->readOneof(5); + } + + public function hasInputSwitch() + { + return $this->hasOneof(5); + } + + /** + * Switches to another input stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.InputSwitchTask input_switch = 5; + * @param \Google\Cloud\Video\LiveStream\V1\Event\InputSwitchTask $var + * @return $this + */ + public function setInputSwitch($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\InputSwitchTask::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Inserts a new ad opportunity. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.AdBreakTask ad_break = 6; + * @return \Google\Cloud\Video\LiveStream\V1\Event\AdBreakTask|null + */ + public function getAdBreak() + { + return $this->readOneof(6); + } + + public function hasAdBreak() + { + return $this->hasOneof(6); + } + + /** + * Inserts a new ad opportunity. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.AdBreakTask ad_break = 6; + * @param \Google\Cloud\Video\LiveStream\V1\Event\AdBreakTask $var + * @return $this + */ + public function setAdBreak($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\AdBreakTask::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Stops any running ad break. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.ReturnToProgramTask return_to_program = 13; + * @return \Google\Cloud\Video\LiveStream\V1\Event\ReturnToProgramTask|null + */ + public function getReturnToProgram() + { + return $this->readOneof(13); + } + + public function hasReturnToProgram() + { + return $this->hasOneof(13); + } + + /** + * Stops any running ad break. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.ReturnToProgramTask return_to_program = 13; + * @param \Google\Cloud\Video\LiveStream\V1\Event\ReturnToProgramTask $var + * @return $this + */ + public function setReturnToProgram($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\ReturnToProgramTask::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Inserts a slate. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.SlateTask slate = 14; + * @return \Google\Cloud\Video\LiveStream\V1\Event\SlateTask|null + */ + public function getSlate() + { + return $this->readOneof(14); + } + + public function hasSlate() + { + return $this->hasOneof(14); + } + + /** + * Inserts a slate. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.SlateTask slate = 14; + * @param \Google\Cloud\Video\LiveStream\V1\Event\SlateTask $var + * @return $this + */ + public function setSlate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\SlateTask::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Mutes the stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.MuteTask mute = 15; + * @return \Google\Cloud\Video\LiveStream\V1\Event\MuteTask|null + */ + public function getMute() + { + return $this->readOneof(15); + } + + public function hasMute() + { + return $this->hasOneof(15); + } + + /** + * Mutes the stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.MuteTask mute = 15; + * @param \Google\Cloud\Video\LiveStream\V1\Event\MuteTask $var + * @return $this + */ + public function setMute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\MuteTask::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Unmutes the stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.UnmuteTask unmute = 16; + * @return \Google\Cloud\Video\LiveStream\V1\Event\UnmuteTask|null + */ + public function getUnmute() + { + return $this->readOneof(16); + } + + public function hasUnmute() + { + return $this->hasOneof(16); + } + + /** + * Unmutes the stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.UnmuteTask unmute = 16; + * @param \Google\Cloud\Video\LiveStream\V1\Event\UnmuteTask $var + * @return $this + */ + public function setUnmute($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Event\UnmuteTask::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * When this field is set to true, the event will be executed at the earliest + * time that the server can schedule the event and + * [execution_time][google.cloud.video.livestream.v1.Event.execution_time] + * will be populated with the time that the server actually schedules the + * event. + * + * Generated from protobuf field bool execute_now = 9; + * @return bool + */ + public function getExecuteNow() + { + return $this->execute_now; + } + + /** + * When this field is set to true, the event will be executed at the earliest + * time that the server can schedule the event and + * [execution_time][google.cloud.video.livestream.v1.Event.execution_time] + * will be populated with the time that the server actually schedules the + * event. + * + * Generated from protobuf field bool execute_now = 9; + * @param bool $var + * @return $this + */ + public function setExecuteNow($var) + { + GPBUtil::checkBool($var); + $this->execute_now = $var; + + return $this; + } + + /** + * The time to execute the event. If you set + * [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `true`, then do not set this field in the `CreateEvent` request. In + * this case, the server schedules the event and populates this field. If you + * set [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `false`, then you must set this field to at least 10 seconds in the future + * or else the event can't be created. + * + * Generated from protobuf field .google.protobuf.Timestamp execution_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExecutionTime() + { + return $this->execution_time; + } + + public function hasExecutionTime() + { + return isset($this->execution_time); + } + + public function clearExecutionTime() + { + unset($this->execution_time); + } + + /** + * The time to execute the event. If you set + * [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `true`, then do not set this field in the `CreateEvent` request. In + * this case, the server schedules the event and populates this field. If you + * set [execute_now][google.cloud.video.livestream.v1.Event.execute_now] to + * `false`, then you must set this field to at least 10 seconds in the future + * or else the event can't be created. + * + * Generated from protobuf field .google.protobuf.Timestamp execution_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExecutionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->execution_time = $var; + + return $this; + } + + /** + * Output only. The state of the event. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the event. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Event.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Event\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * @return string + */ + public function getTask() + { + return $this->whichOneof("task"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/AdBreakTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/AdBreakTask.php new file mode 100644 index 00000000000..31d381b2eed --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/AdBreakTask.php @@ -0,0 +1,80 @@ +google.cloud.video.livestream.v1.Event.AdBreakTask + */ +class AdBreakTask extends \Google\Protobuf\Internal\Message +{ + /** + * Duration of an ad opportunity. Must be greater than 0. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Duration of an ad opportunity. Must be greater than 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Duration of an ad opportunity. Must be greater than 0. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration of an ad opportunity. Must be greater than 0. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AdBreakTask::class, \Google\Cloud\Video\LiveStream\V1\Event_AdBreakTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/InputSwitchTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/InputSwitchTask.php new file mode 100644 index 00000000000..bae050a14d8 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/InputSwitchTask.php @@ -0,0 +1,78 @@ +google.cloud.video.livestream.v1.Event.InputSwitchTask + */ +class InputSwitchTask extends \Google\Protobuf\Internal\Message +{ + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * of the input to switch to. + * + * Generated from protobuf field string input_key = 1; + */ + protected $input_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_key + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * of the input to switch to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * of the input to switch to. + * + * Generated from protobuf field string input_key = 1; + * @return string + */ + public function getInputKey() + { + return $this->input_key; + } + + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] + * of the input to switch to. + * + * Generated from protobuf field string input_key = 1; + * @param string $var + * @return $this + */ + public function setInputKey($var) + { + GPBUtil::checkString($var, True); + $this->input_key = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InputSwitchTask::class, \Google\Cloud\Video\LiveStream\V1\Event_InputSwitchTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/MuteTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/MuteTask.php new file mode 100644 index 00000000000..f080a8603fb --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/MuteTask.php @@ -0,0 +1,84 @@ +google.cloud.video.livestream.v1.Event.MuteTask + */ +class MuteTask extends \Google\Protobuf\Internal\Message +{ + /** + * Duration for which the stream should be muted. If omitted, the stream + * will be muted until an UnmuteTask event is sent. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Duration for which the stream should be muted. If omitted, the stream + * will be muted until an UnmuteTask event is sent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Duration for which the stream should be muted. If omitted, the stream + * will be muted until an UnmuteTask event is sent. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration for which the stream should be muted. If omitted, the stream + * will be muted until an UnmuteTask event is sent. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MuteTask::class, \Google\Cloud\Video\LiveStream\V1\Event_MuteTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/ReturnToProgramTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/ReturnToProgramTask.php new file mode 100644 index 00000000000..f544f6fa571 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/ReturnToProgramTask.php @@ -0,0 +1,37 @@ +google.cloud.video.livestream.v1.Event.ReturnToProgramTask + */ +class ReturnToProgramTask extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReturnToProgramTask::class, \Google\Cloud\Video\LiveStream\V1\Event_ReturnToProgramTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/SlateTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/SlateTask.php new file mode 100644 index 00000000000..18111874b49 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/SlateTask.php @@ -0,0 +1,130 @@ +google.cloud.video.livestream.v1.Event.SlateTask + */ +class SlateTask extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Duration of the slate. Must be greater than 0 if specified. + * Omit this field for a long running slate. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + /** + * Slate asset to use for the duration. If its duration is less than the + * duration of the SlateTask, then it will be looped. The slate must be + * represented in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string asset = 2 [(.google.api.resource_reference) = { + */ + protected $asset = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Optional. Duration of the slate. Must be greater than 0 if specified. + * Omit this field for a long running slate. + * @type string $asset + * Slate asset to use for the duration. If its duration is less than the + * duration of the SlateTask, then it will be looped. The slate must be + * represented in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Duration of the slate. Must be greater than 0 if specified. + * Omit this field for a long running slate. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Optional. Duration of the slate. Must be greater than 0 if specified. + * Omit this field for a long running slate. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Slate asset to use for the duration. If its duration is less than the + * duration of the SlateTask, then it will be looped. The slate must be + * represented in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string asset = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getAsset() + { + return $this->asset; + } + + /** + * Slate asset to use for the duration. If its duration is less than the + * duration of the SlateTask, then it will be looped. The slate must be + * represented in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * + * Generated from protobuf field string asset = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAsset($var) + { + GPBUtil::checkString($var, True); + $this->asset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SlateTask::class, \Google\Cloud\Video\LiveStream\V1\Event_SlateTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/State.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/State.php new file mode 100644 index 00000000000..fd2043aa016 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/State.php @@ -0,0 +1,92 @@ +google.cloud.video.livestream.v1.Event.State + */ +class State +{ + /** + * Event state is not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Event is scheduled but not executed yet. + * + * Generated from protobuf enum SCHEDULED = 1; + */ + const SCHEDULED = 1; + /** + * Event is being executed. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * Event has been successfully executed. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * Event fails to be executed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * Event has been created but not scheduled yet. + * + * Generated from protobuf enum PENDING = 5; + */ + const PENDING = 5; + /** + * Event was stopped before running for its full duration. + * + * Generated from protobuf enum STOPPED = 6; + */ + const STOPPED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::SCHEDULED => 'SCHEDULED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::PENDING => 'PENDING', + self::STOPPED => 'STOPPED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Video\LiveStream\V1\Event_State::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/UnmuteTask.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/UnmuteTask.php new file mode 100644 index 00000000000..9ab47234d35 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Event/UnmuteTask.php @@ -0,0 +1,37 @@ +google.cloud.video.livestream.v1.Event.UnmuteTask + */ +class UnmuteTask extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UnmuteTask::class, \Google\Cloud\Video\LiveStream\V1\Event_UnmuteTask::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetAssetRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetAssetRequest.php new file mode 100644 index 00000000000..9077122dea4 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetAssetRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.livestream.v1.GetAssetRequest + */ +class GetAssetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. Please see + * {@see LivestreamServiceClient::assetName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\GetAssetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetChannelRequest.php new file mode 100644 index 00000000000..2050793dd1f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetChannelRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.livestream.v1.GetChannelRequest + */ +class GetChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\GetChannelRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetEventRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetEventRequest.php new file mode 100644 index 00000000000..cc2a6577543 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetEventRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.livestream.v1.GetEventRequest + */ +class GetEventRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. Please see + * {@see LivestreamServiceClient::eventName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\GetEventRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetInputRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetInputRequest.php new file mode 100644 index 00000000000..da3712d40ec --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetInputRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.livestream.v1.GetInputRequest + */ +class GetInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. Please see + * {@see LivestreamServiceClient::inputName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\GetInputRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetPoolRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetPoolRequest.php new file mode 100644 index 00000000000..413d850b4b5 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/GetPoolRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.livestream.v1.GetPoolRequest + */ +class GetPoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. Please see + * {@see LivestreamServiceClient::poolName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\GetPoolRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input.php new file mode 100644 index 00000000000..804f7b0d808 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input.php @@ -0,0 +1,460 @@ +google.cloud.video.livestream.v1.Input + */ +class Input extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Source type. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Type type = 5; + */ + protected $type = 0; + /** + * Tier defines the maximum input specification that is accepted by the + * video pipeline. The billing is charged based on the tier specified here. + * See [Pricing](https://cloud.google.com/livestream/pricing) for more detail. + * The default is `HD`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Tier tier = 14; + */ + protected $tier = 0; + /** + * Output only. URI to push the input stream to. + * Its format depends on the input + * [type][google.cloud.video.livestream.v1.Input.type], for example: + * * `RTMP_PUSH`: `rtmp://1.2.3.4/live/{STREAM-ID}` + * * `SRT_PUSH`: `srt://1.2.3.4:4201?streamid={STREAM-ID}` + * + * Generated from protobuf field string uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uri = ''; + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig preprocessing_config = 9; + */ + protected $preprocessing_config = null; + /** + * Security rule for access control. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.SecurityRule security_rules = 12; + */ + protected $security_rules = null; + /** + * Output only. The information for the input stream. This field will be + * present only when this input receives the input stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputStreamProperty input_stream_property = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $input_stream_property = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined key/value metadata. + * @type int $type + * Source type. + * @type int $tier + * Tier defines the maximum input specification that is accepted by the + * video pipeline. The billing is charged based on the tier specified here. + * See [Pricing](https://cloud.google.com/livestream/pricing) for more detail. + * The default is `HD`. + * @type string $uri + * Output only. URI to push the input stream to. + * Its format depends on the input + * [type][google.cloud.video.livestream.v1.Input.type], for example: + * * `RTMP_PUSH`: `rtmp://1.2.3.4/live/{STREAM-ID}` + * * `SRT_PUSH`: `srt://1.2.3.4:4201?streamid={STREAM-ID}` + * @type \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig $preprocessing_config + * Preprocessing configurations. + * @type \Google\Cloud\Video\LiveStream\V1\Input\SecurityRule $security_rules + * Security rule for access control. + * @type \Google\Cloud\Video\LiveStream\V1\InputStreamProperty $input_stream_property + * Output only. The information for the input stream. This field will be + * present only when this input receives the input stream. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Source type. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Type type = 5; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Source type. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Type type = 5; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Input\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Tier defines the maximum input specification that is accepted by the + * video pipeline. The billing is charged based on the tier specified here. + * See [Pricing](https://cloud.google.com/livestream/pricing) for more detail. + * The default is `HD`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Tier tier = 14; + * @return int + */ + public function getTier() + { + return $this->tier; + } + + /** + * Tier defines the maximum input specification that is accepted by the + * video pipeline. The billing is charged based on the tier specified here. + * See [Pricing](https://cloud.google.com/livestream/pricing) for more detail. + * The default is `HD`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.Tier tier = 14; + * @param int $var + * @return $this + */ + public function setTier($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Input\Tier::class); + $this->tier = $var; + + return $this; + } + + /** + * Output only. URI to push the input stream to. + * Its format depends on the input + * [type][google.cloud.video.livestream.v1.Input.type], for example: + * * `RTMP_PUSH`: `rtmp://1.2.3.4/live/{STREAM-ID}` + * * `SRT_PUSH`: `srt://1.2.3.4:4201?streamid={STREAM-ID}` + * + * Generated from protobuf field string uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Output only. URI to push the input stream to. + * Its format depends on the input + * [type][google.cloud.video.livestream.v1.Input.type], for example: + * * `RTMP_PUSH`: `rtmp://1.2.3.4/live/{STREAM-ID}` + * * `SRT_PUSH`: `srt://1.2.3.4:4201?streamid={STREAM-ID}` + * + * Generated from protobuf field string uri = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig preprocessing_config = 9; + * @return \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig|null + */ + public function getPreprocessingConfig() + { + return $this->preprocessing_config; + } + + public function hasPreprocessingConfig() + { + return isset($this->preprocessing_config); + } + + public function clearPreprocessingConfig() + { + unset($this->preprocessing_config); + } + + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig preprocessing_config = 9; + * @param \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig $var + * @return $this + */ + public function setPreprocessingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig::class); + $this->preprocessing_config = $var; + + return $this; + } + + /** + * Security rule for access control. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.SecurityRule security_rules = 12; + * @return \Google\Cloud\Video\LiveStream\V1\Input\SecurityRule|null + */ + public function getSecurityRules() + { + return $this->security_rules; + } + + public function hasSecurityRules() + { + return isset($this->security_rules); + } + + public function clearSecurityRules() + { + unset($this->security_rules); + } + + /** + * Security rule for access control. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input.SecurityRule security_rules = 12; + * @param \Google\Cloud\Video\LiveStream\V1\Input\SecurityRule $var + * @return $this + */ + public function setSecurityRules($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Input\SecurityRule::class); + $this->security_rules = $var; + + return $this; + } + + /** + * Output only. The information for the input stream. This field will be + * present only when this input receives the input stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputStreamProperty input_stream_property = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Video\LiveStream\V1\InputStreamProperty|null + */ + public function getInputStreamProperty() + { + return $this->input_stream_property; + } + + public function hasInputStreamProperty() + { + return isset($this->input_stream_property); + } + + public function clearInputStreamProperty() + { + unset($this->input_stream_property); + } + + /** + * Output only. The information for the input stream. This field will be + * present only when this input receives the input stream. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputStreamProperty input_stream_property = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Video\LiveStream\V1\InputStreamProperty $var + * @return $this + */ + public function setInputStreamProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\InputStreamProperty::class); + $this->input_stream_property = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/SecurityRule.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/SecurityRule.php new file mode 100644 index 00000000000..c5c7244181e --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/SecurityRule.php @@ -0,0 +1,80 @@ +google.cloud.video.livestream.v1.Input.SecurityRule + */ +class SecurityRule extends \Google\Protobuf\Internal\Message +{ + /** + * At least one ip range must match unless none specified. The IP range is + * defined by CIDR block: for example, `192.0.1.0/24` for a range and + * `192.0.1.0/32` for a single IP address. + * + * Generated from protobuf field repeated string ip_ranges = 1; + */ + private $ip_ranges; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $ip_ranges + * At least one ip range must match unless none specified. The IP range is + * defined by CIDR block: for example, `192.0.1.0/24` for a range and + * `192.0.1.0/32` for a single IP address. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * At least one ip range must match unless none specified. The IP range is + * defined by CIDR block: for example, `192.0.1.0/24` for a range and + * `192.0.1.0/32` for a single IP address. + * + * Generated from protobuf field repeated string ip_ranges = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIpRanges() + { + return $this->ip_ranges; + } + + /** + * At least one ip range must match unless none specified. The IP range is + * defined by CIDR block: for example, `192.0.1.0/24` for a range and + * `192.0.1.0/32` for a single IP address. + * + * Generated from protobuf field repeated string ip_ranges = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIpRanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->ip_ranges = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecurityRule::class, \Google\Cloud\Video\LiveStream\V1\Input_SecurityRule::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Tier.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Tier.php new file mode 100644 index 00000000000..e1cc73c68de --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Tier.php @@ -0,0 +1,71 @@ +google.cloud.video.livestream.v1.Input.Tier + */ +class Tier +{ + /** + * Tier is not specified. + * + * Generated from protobuf enum TIER_UNSPECIFIED = 0; + */ + const TIER_UNSPECIFIED = 0; + /** + * Resolution < 1280x720. Bitrate <= 6 Mbps. FPS <= 60. + * + * Generated from protobuf enum SD = 1; + */ + const SD = 1; + /** + * Resolution <= 1920x1080. Bitrate <= 25 Mbps. FPS <= 60. + * + * Generated from protobuf enum HD = 2; + */ + const HD = 2; + /** + * Resolution <= 4096x2160. Not supported yet. + * + * Generated from protobuf enum UHD = 3; + */ + const UHD = 3; + + private static $valueToName = [ + self::TIER_UNSPECIFIED => 'TIER_UNSPECIFIED', + self::SD => 'SD', + self::HD => 'HD', + self::UHD => 'UHD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tier::class, \Google\Cloud\Video\LiveStream\V1\Input_Tier::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Type.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Type.php new file mode 100644 index 00000000000..2008bef3297 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Input/Type.php @@ -0,0 +1,64 @@ +google.cloud.video.livestream.v1.Input.Type + */ +class Type +{ + /** + * Input type is not specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Input will take an rtmp input stream. + * + * Generated from protobuf enum RTMP_PUSH = 1; + */ + const RTMP_PUSH = 1; + /** + * Input will take an srt (Secure Reliable Transport) input stream. + * + * Generated from protobuf enum SRT_PUSH = 2; + */ + const SRT_PUSH = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::RTMP_PUSH => 'RTMP_PUSH', + self::SRT_PUSH => 'SRT_PUSH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Video\LiveStream\V1\Input_Type::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment.php new file mode 100644 index 00000000000..86ffab06266 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment.php @@ -0,0 +1,149 @@ +google.cloud.video.livestream.v1.InputAttachment + */ +class InputAttachment extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this input attachment. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The resource name of an existing input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string input = 2 [(.google.api.resource_reference) = { + */ + protected $input = ''; + /** + * Automatic failover configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover automatic_failover = 3; + */ + protected $automatic_failover = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this input attachment. + * @type string $input + * The resource name of an existing input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * @type \Google\Cloud\Video\LiveStream\V1\InputAttachment\AutomaticFailover $automatic_failover + * Automatic failover configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this input attachment. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this input attachment. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The resource name of an existing input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string input = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getInput() + { + return $this->input; + } + + /** + * The resource name of an existing input, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * + * Generated from protobuf field string input = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkString($var, True); + $this->input = $var; + + return $this; + } + + /** + * Automatic failover configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover automatic_failover = 3; + * @return \Google\Cloud\Video\LiveStream\V1\InputAttachment\AutomaticFailover|null + */ + public function getAutomaticFailover() + { + return $this->automatic_failover; + } + + public function hasAutomaticFailover() + { + return isset($this->automatic_failover); + } + + public function clearAutomaticFailover() + { + unset($this->automatic_failover); + } + + /** + * Automatic failover configurations. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover automatic_failover = 3; + * @param \Google\Cloud\Video\LiveStream\V1\InputAttachment\AutomaticFailover $var + * @return $this + */ + public function setAutomaticFailover($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\InputAttachment\AutomaticFailover::class); + $this->automatic_failover = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment/AutomaticFailover.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment/AutomaticFailover.php new file mode 100644 index 00000000000..d9ae8181935 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputAttachment/AutomaticFailover.php @@ -0,0 +1,82 @@ +google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover + */ +class AutomaticFailover extends \Google\Protobuf\Internal\Message +{ + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key]s + * of inputs to failover to when this input is disconnected. Currently, only + * up to one backup input is supported. + * + * Generated from protobuf field repeated string input_keys = 1; + */ + private $input_keys; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $input_keys + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key]s + * of inputs to failover to when this input is disconnected. Currently, only + * up to one backup input is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key]s + * of inputs to failover to when this input is disconnected. Currently, only + * up to one backup input is supported. + * + * Generated from protobuf field repeated string input_keys = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputKeys() + { + return $this->input_keys; + } + + /** + * The + * [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key]s + * of inputs to failover to when this input is disconnected. Currently, only + * up to one backup input is supported. + * + * Generated from protobuf field repeated string input_keys = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->input_keys = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutomaticFailover::class, \Google\Cloud\Video\LiveStream\V1\InputAttachment_AutomaticFailover::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig.php new file mode 100644 index 00000000000..fc6b529049d --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig.php @@ -0,0 +1,67 @@ +google.cloud.video.livestream.v1.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Input switch mode. Default mode is `FAILOVER_PREFER_PRIMARY`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig.InputSwitchMode input_switch_mode = 1; + */ + protected $input_switch_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $input_switch_mode + * Input switch mode. Default mode is `FAILOVER_PREFER_PRIMARY`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Input switch mode. Default mode is `FAILOVER_PREFER_PRIMARY`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig.InputSwitchMode input_switch_mode = 1; + * @return int + */ + public function getInputSwitchMode() + { + return $this->input_switch_mode; + } + + /** + * Input switch mode. Default mode is `FAILOVER_PREFER_PRIMARY`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.InputConfig.InputSwitchMode input_switch_mode = 1; + * @param int $var + * @return $this + */ + public function setInputSwitchMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\InputConfig\InputSwitchMode::class); + $this->input_switch_mode = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig/InputSwitchMode.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig/InputSwitchMode.php new file mode 100644 index 00000000000..0a991af8249 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputConfig/InputSwitchMode.php @@ -0,0 +1,72 @@ +google.cloud.video.livestream.v1.InputConfig.InputSwitchMode + */ +class InputSwitchMode +{ + /** + * The input switch mode is not specified. + * + * Generated from protobuf enum INPUT_SWITCH_MODE_UNSPECIFIED = 0; + */ + const INPUT_SWITCH_MODE_UNSPECIFIED = 0; + /** + * Automatic failover is enabled. The primary input stream is always + * preferred over its backup input streams configured using the + * [AutomaticFailover][google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover] + * field. + * + * Generated from protobuf enum FAILOVER_PREFER_PRIMARY = 1; + */ + const FAILOVER_PREFER_PRIMARY = 1; + /** + * Automatic failover is disabled. You must use the + * [inputSwitch][google.cloud.video.livestream.v1.Event.input_switch] event + * to switch the active input source for the channel to stream from. When + * this mode is chosen, the + * [AutomaticFailover][google.cloud.video.livestream.v1.InputAttachment.AutomaticFailover] + * field is ignored. + * + * Generated from protobuf enum MANUAL = 3; + */ + const MANUAL = 3; + + private static $valueToName = [ + self::INPUT_SWITCH_MODE_UNSPECIFIED => 'INPUT_SWITCH_MODE_UNSPECIFIED', + self::FAILOVER_PREFER_PRIMARY => 'FAILOVER_PREFER_PRIMARY', + self::MANUAL => 'MANUAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InputSwitchMode::class, \Google\Cloud\Video\LiveStream\V1\InputConfig_InputSwitchMode::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputStreamProperty.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputStreamProperty.php new file mode 100644 index 00000000000..42b27a63066 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/InputStreamProperty.php @@ -0,0 +1,149 @@ +google.cloud.video.livestream.v1.InputStreamProperty + */ +class InputStreamProperty extends \Google\Protobuf\Internal\Message +{ + /** + * The time that the current input stream is accepted and the connection is + * established. + * + * Generated from protobuf field .google.protobuf.Timestamp last_establish_time = 1; + */ + protected $last_establish_time = null; + /** + * Properties of the video streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.VideoStreamProperty video_streams = 2; + */ + private $video_streams; + /** + * Properties of the audio streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStreamProperty audio_streams = 3; + */ + private $audio_streams; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $last_establish_time + * The time that the current input stream is accepted and the connection is + * established. + * @type array<\Google\Cloud\Video\LiveStream\V1\VideoStreamProperty>|\Google\Protobuf\Internal\RepeatedField $video_streams + * Properties of the video streams. + * @type array<\Google\Cloud\Video\LiveStream\V1\AudioStreamProperty>|\Google\Protobuf\Internal\RepeatedField $audio_streams + * Properties of the audio streams. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The time that the current input stream is accepted and the connection is + * established. + * + * Generated from protobuf field .google.protobuf.Timestamp last_establish_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastEstablishTime() + { + return $this->last_establish_time; + } + + public function hasLastEstablishTime() + { + return isset($this->last_establish_time); + } + + public function clearLastEstablishTime() + { + unset($this->last_establish_time); + } + + /** + * The time that the current input stream is accepted and the connection is + * established. + * + * Generated from protobuf field .google.protobuf.Timestamp last_establish_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastEstablishTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_establish_time = $var; + + return $this; + } + + /** + * Properties of the video streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.VideoStreamProperty video_streams = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVideoStreams() + { + return $this->video_streams; + } + + /** + * Properties of the video streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.VideoStreamProperty video_streams = 2; + * @param array<\Google\Cloud\Video\LiveStream\V1\VideoStreamProperty>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVideoStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\VideoStreamProperty::class); + $this->video_streams = $arr; + + return $this; + } + + /** + * Properties of the audio streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStreamProperty audio_streams = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAudioStreams() + { + return $this->audio_streams; + } + + /** + * Properties of the audio streams. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.AudioStreamProperty audio_streams = 3; + * @param array<\Google\Cloud\Video\LiveStream\V1\AudioStreamProperty>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAudioStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\AudioStreamProperty::class); + $this->audio_streams = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsRequest.php new file mode 100644 index 00000000000..ed3d44e9986 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsRequest.php @@ -0,0 +1,226 @@ +google.cloud.video.livestream.v1.ListAssetsRequest + */ +class ListAssetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\ListAssetsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsResponse.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsResponse.php new file mode 100644 index 00000000000..ec154d7bbaf --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListAssetsResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.livestream.v1.ListAssetsResponse + */ +class ListAssetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Assets + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Asset assets = 1; + */ + private $assets; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\LiveStream\V1\Asset>|\Google\Protobuf\Internal\RepeatedField $assets + * The list of Assets + * @type string $next_page_token + * The next_page_token value returned from a previous List request, if any. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Assets + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Asset assets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssets() + { + return $this->assets; + } + + /** + * The list of Assets + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Asset assets = 1; + * @param array<\Google\Cloud\Video\LiveStream\V1\Asset>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Asset::class); + $this->assets = $arr; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsRequest.php new file mode 100644 index 00000000000..2dbfdfd1b10 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsRequest.php @@ -0,0 +1,242 @@ +google.cloud.video.livestream.v1.ListChannelsRequest + */ +class ListChannelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListChannelsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\ListChannelsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type int $page_size + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListChannelsResponse.next_page_token] + * to determine if there are more items left to be queried. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * The filter to apply to list results. + * @type string $order_by + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListChannelsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListChannelsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsResponse.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsResponse.php new file mode 100644 index 00000000000..c535a18d345 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListChannelsResponse.php @@ -0,0 +1,139 @@ +google.cloud.video.livestream.v1.ListChannelsResponse + */ +class ListChannelsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Channel channels = 1; + */ + private $channels; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\LiveStream\V1\Channel>|\Google\Protobuf\Internal\RepeatedField $channels + * A list of channels. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * A list of channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Channel channels = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannels() + { + return $this->channels; + } + + /** + * A list of channels. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Channel channels = 1; + * @param array<\Google\Cloud\Video\LiveStream\V1\Channel>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Channel::class); + $this->channels = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsRequest.php new file mode 100644 index 00000000000..2e459d167a5 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsRequest.php @@ -0,0 +1,242 @@ +google.cloud.video.livestream.v1.ListEventsRequest + */ +class ListEventsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListEventsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\ListEventsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type int $page_size + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListEventsResponse.next_page_token] + * to determine if there are more items left to be queried. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * The filter to apply to list results. + * @type string $order_by + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListEventsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListEventsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsResponse.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsResponse.php new file mode 100644 index 00000000000..9c30220fcb3 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListEventsResponse.php @@ -0,0 +1,139 @@ +google.cloud.video.livestream.v1.ListEventsResponse + */ +class ListEventsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of events. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Event events = 1; + */ + private $events; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\LiveStream\V1\Event>|\Google\Protobuf\Internal\RepeatedField $events + * A list of events. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * A list of events. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Event events = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * A list of events. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Event events = 1; + * @param array<\Google\Cloud\Video\LiveStream\V1\Event>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Event::class); + $this->events = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsRequest.php new file mode 100644 index 00000000000..95a3d958d8f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsRequest.php @@ -0,0 +1,242 @@ +google.cloud.video.livestream.v1.ListInputsRequest + */ +class ListInputsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListInputsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Specifies the ordering of results following syntax at [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. Please see + * {@see LivestreamServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\ListInputsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @type int $page_size + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListInputsResponse.next_page_token] + * to determine if there are more items left to be queried. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * The filter to apply to list results. + * @type string $order_by + * Specifies the ordering of results following syntax at [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListInputsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * [next_page_token][google.cloud.video.livestream.v1.ListInputsResponse.next_page_token] + * to determine if there are more items left to be queried. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter to apply to list results. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Specifies the ordering of results following syntax at [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Specifies the ordering of results following syntax at [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsResponse.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsResponse.php new file mode 100644 index 00000000000..a996747b4e2 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/ListInputsResponse.php @@ -0,0 +1,139 @@ +google.cloud.video.livestream.v1.ListInputsResponse + */ +class ListInputsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of inputs. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Input inputs = 1; + */ + private $inputs; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\LiveStream\V1\Input>|\Google\Protobuf\Internal\RepeatedField $inputs + * A list of inputs. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * A list of inputs. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Input inputs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputs() + { + return $this->inputs; + } + + /** + * A list of inputs. + * + * Generated from protobuf field repeated .google.cloud.video.livestream.v1.Input inputs = 1; + * @param array<\Google\Cloud\Video\LiveStream\V1\Input>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\LiveStream\V1\Input::class); + $this->inputs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig.php new file mode 100644 index 00000000000..24c7138b582 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig.php @@ -0,0 +1,70 @@ +google.cloud.video.livestream.v1.LogConfig + */ +class LogConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The severity level of platform logging for this resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig.LogSeverity log_severity = 1; + */ + protected $log_severity = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $log_severity + * The severity level of platform logging for this resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The severity level of platform logging for this resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig.LogSeverity log_severity = 1; + * @return int + */ + public function getLogSeverity() + { + return $this->log_severity; + } + + /** + * The severity level of platform logging for this resource. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.LogConfig.LogSeverity log_severity = 1; + * @param int $var + * @return $this + */ + public function setLogSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\LogConfig\LogSeverity::class); + $this->log_severity = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig/LogSeverity.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig/LogSeverity.php new file mode 100644 index 00000000000..f8a3b5c5423 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/LogConfig/LogSeverity.php @@ -0,0 +1,92 @@ +google.cloud.video.livestream.v1.LogConfig.LogSeverity + */ +class LogSeverity +{ + /** + * Log severity is not specified. This is the same as log severity is OFF. + * + * Generated from protobuf enum LOG_SEVERITY_UNSPECIFIED = 0; + */ + const LOG_SEVERITY_UNSPECIFIED = 0; + /** + * Log is turned off. + * + * Generated from protobuf enum OFF = 1; + */ + const OFF = 1; + /** + * Log with severity higher than or equal to DEBUG are logged. + * + * Generated from protobuf enum DEBUG = 100; + */ + const DEBUG = 100; + /** + * Logs with severity higher than or equal to INFO are logged. + * + * Generated from protobuf enum INFO = 200; + */ + const INFO = 200; + /** + * Logs with severity higher than or equal to WARNING are logged. + * + * Generated from protobuf enum WARNING = 400; + */ + const WARNING = 400; + /** + * Logs with severity higher than or equal to ERROR are logged. + * + * Generated from protobuf enum ERROR = 500; + */ + const ERROR = 500; + + private static $valueToName = [ + self::LOG_SEVERITY_UNSPECIFIED => 'LOG_SEVERITY_UNSPECIFIED', + self::OFF => 'OFF', + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LogSeverity::class, \Google\Cloud\Video\LiveStream\V1\LogConfig_LogSeverity::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest.php new file mode 100644 index 00000000000..23356416c1f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest.php @@ -0,0 +1,327 @@ +google.cloud.video.livestream.v1.Manifest + */ +class Manifest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest` + * [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple + * manifests are added to the channel, each must have a unique file name. + * + * Generated from protobuf field string file_name = 1; + */ + protected $file_name = ''; + /** + * Required. Type of the manifest, can be `HLS` or `DASH`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Required. List of `MuxStream` + * [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear + * in this manifest. + * - For HLS, either `fmp4` or `ts` mux streams can be specified but not + * mixed. + * - For DASH, only `fmp4` mux streams can be specified. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $mux_streams; + /** + * Maximum number of segments that this manifest holds. Once the manifest + * reaches this maximum number of segments, whenever a new segment is added to + * the manifest, the oldest segment will be removed from the manifest. + * The minimum value is 3 and the default value is 5. + * + * Generated from protobuf field int32 max_segment_count = 4; + */ + protected $max_segment_count = 0; + /** + * How long to keep a segment on the output Google Cloud Storage bucket after + * it is removed from the manifest. This field should be large enough to cover + * the manifest propagation delay. Otherwise, a player could receive 404 + * errors while accessing segments which are listed in the manifest that the + * player has, but were already deleted from the output Google Cloud Storage + * bucket. Default value is `60s`. + * + * Generated from protobuf field .google.protobuf.Duration segment_keep_duration = 5; + */ + protected $segment_keep_duration = null; + /** + * Whether to use the timecode, as specified in timecode config, when setting: + * - `availabilityStartTime` attribute in DASH manifests. + * - `#EXT-X-PROGRAM-DATE-TIME` tag in HLS manifests. + * If false, ignore the input timecode and use the time from system clock + * when the manifest is first generated. This is the default behavior. + * + * Generated from protobuf field bool use_timecode_as_timeline = 6; + */ + protected $use_timecode_as_timeline = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_name + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest` + * [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple + * manifests are added to the channel, each must have a unique file name. + * @type int $type + * Required. Type of the manifest, can be `HLS` or `DASH`. + * @type array|\Google\Protobuf\Internal\RepeatedField $mux_streams + * Required. List of `MuxStream` + * [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear + * in this manifest. + * - For HLS, either `fmp4` or `ts` mux streams can be specified but not + * mixed. + * - For DASH, only `fmp4` mux streams can be specified. + * @type int $max_segment_count + * Maximum number of segments that this manifest holds. Once the manifest + * reaches this maximum number of segments, whenever a new segment is added to + * the manifest, the oldest segment will be removed from the manifest. + * The minimum value is 3 and the default value is 5. + * @type \Google\Protobuf\Duration $segment_keep_duration + * How long to keep a segment on the output Google Cloud Storage bucket after + * it is removed from the manifest. This field should be large enough to cover + * the manifest propagation delay. Otherwise, a player could receive 404 + * errors while accessing segments which are listed in the manifest that the + * player has, but were already deleted from the output Google Cloud Storage + * bucket. Default value is `60s`. + * @type bool $use_timecode_as_timeline + * Whether to use the timecode, as specified in timecode config, when setting: + * - `availabilityStartTime` attribute in DASH manifests. + * - `#EXT-X-PROGRAM-DATE-TIME` tag in HLS manifests. + * If false, ignore the input timecode and use the time from system clock + * when the manifest is first generated. This is the default behavior. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest` + * [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple + * manifests are added to the channel, each must have a unique file name. + * + * Generated from protobuf field string file_name = 1; + * @return string + */ + public function getFileName() + { + return $this->file_name; + } + + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest` + * [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple + * manifests are added to the channel, each must have a unique file name. + * + * Generated from protobuf field string file_name = 1; + * @param string $var + * @return $this + */ + public function setFileName($var) + { + GPBUtil::checkString($var, True); + $this->file_name = $var; + + return $this; + } + + /** + * Required. Type of the manifest, can be `HLS` or `DASH`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. Type of the manifest, can be `HLS` or `DASH`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\Manifest\ManifestType::class); + $this->type = $var; + + return $this; + } + + /** + * Required. List of `MuxStream` + * [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear + * in this manifest. + * - For HLS, either `fmp4` or `ts` mux streams can be specified but not + * mixed. + * - For DASH, only `fmp4` mux streams can be specified. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMuxStreams() + { + return $this->mux_streams; + } + + /** + * Required. List of `MuxStream` + * [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear + * in this manifest. + * - For HLS, either `fmp4` or `ts` mux streams can be specified but not + * mixed. + * - For DASH, only `fmp4` mux streams can be specified. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMuxStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->mux_streams = $arr; + + return $this; + } + + /** + * Maximum number of segments that this manifest holds. Once the manifest + * reaches this maximum number of segments, whenever a new segment is added to + * the manifest, the oldest segment will be removed from the manifest. + * The minimum value is 3 and the default value is 5. + * + * Generated from protobuf field int32 max_segment_count = 4; + * @return int + */ + public function getMaxSegmentCount() + { + return $this->max_segment_count; + } + + /** + * Maximum number of segments that this manifest holds. Once the manifest + * reaches this maximum number of segments, whenever a new segment is added to + * the manifest, the oldest segment will be removed from the manifest. + * The minimum value is 3 and the default value is 5. + * + * Generated from protobuf field int32 max_segment_count = 4; + * @param int $var + * @return $this + */ + public function setMaxSegmentCount($var) + { + GPBUtil::checkInt32($var); + $this->max_segment_count = $var; + + return $this; + } + + /** + * How long to keep a segment on the output Google Cloud Storage bucket after + * it is removed from the manifest. This field should be large enough to cover + * the manifest propagation delay. Otherwise, a player could receive 404 + * errors while accessing segments which are listed in the manifest that the + * player has, but were already deleted from the output Google Cloud Storage + * bucket. Default value is `60s`. + * + * Generated from protobuf field .google.protobuf.Duration segment_keep_duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getSegmentKeepDuration() + { + return $this->segment_keep_duration; + } + + public function hasSegmentKeepDuration() + { + return isset($this->segment_keep_duration); + } + + public function clearSegmentKeepDuration() + { + unset($this->segment_keep_duration); + } + + /** + * How long to keep a segment on the output Google Cloud Storage bucket after + * it is removed from the manifest. This field should be large enough to cover + * the manifest propagation delay. Otherwise, a player could receive 404 + * errors while accessing segments which are listed in the manifest that the + * player has, but were already deleted from the output Google Cloud Storage + * bucket. Default value is `60s`. + * + * Generated from protobuf field .google.protobuf.Duration segment_keep_duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSegmentKeepDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->segment_keep_duration = $var; + + return $this; + } + + /** + * Whether to use the timecode, as specified in timecode config, when setting: + * - `availabilityStartTime` attribute in DASH manifests. + * - `#EXT-X-PROGRAM-DATE-TIME` tag in HLS manifests. + * If false, ignore the input timecode and use the time from system clock + * when the manifest is first generated. This is the default behavior. + * + * Generated from protobuf field bool use_timecode_as_timeline = 6; + * @return bool + */ + public function getUseTimecodeAsTimeline() + { + return $this->use_timecode_as_timeline; + } + + /** + * Whether to use the timecode, as specified in timecode config, when setting: + * - `availabilityStartTime` attribute in DASH manifests. + * - `#EXT-X-PROGRAM-DATE-TIME` tag in HLS manifests. + * If false, ignore the input timecode and use the time from system clock + * when the manifest is first generated. This is the default behavior. + * + * Generated from protobuf field bool use_timecode_as_timeline = 6; + * @param bool $var + * @return $this + */ + public function setUseTimecodeAsTimeline($var) + { + GPBUtil::checkBool($var); + $this->use_timecode_as_timeline = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest/ManifestType.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest/ManifestType.php new file mode 100644 index 00000000000..f3c9bee3a91 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Manifest/ManifestType.php @@ -0,0 +1,64 @@ +google.cloud.video.livestream.v1.Manifest.ManifestType + */ +class ManifestType +{ + /** + * The manifest type is not specified. + * + * Generated from protobuf enum MANIFEST_TYPE_UNSPECIFIED = 0; + */ + const MANIFEST_TYPE_UNSPECIFIED = 0; + /** + * Create an `HLS` manifest. The corresponding file extension is `.m3u8`. + * + * Generated from protobuf enum HLS = 1; + */ + const HLS = 1; + /** + * Create a `DASH` manifest. The corresponding file extension is `.mpd`. + * + * Generated from protobuf enum DASH = 2; + */ + const DASH = 2; + + private static $valueToName = [ + self::MANIFEST_TYPE_UNSPECIFIED => 'MANIFEST_TYPE_UNSPECIFIED', + self::HLS => 'HLS', + self::DASH => 'DASH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ManifestType::class, \Google\Cloud\Video\LiveStream\V1\Manifest_ManifestType::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/MuxStream.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/MuxStream.php new file mode 100644 index 00000000000..b5198e42c2f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/MuxStream.php @@ -0,0 +1,249 @@ +google.cloud.video.livestream.v1.MuxStream + */ +class MuxStream extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this multiplexed stream. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The container format. The default is `fmp4`. + * Supported container formats: + * - `fmp4` - the corresponding file extension is `.m4s` + * - `ts` - the corresponding file extension is `.ts` + * + * Generated from protobuf field string container = 3; + */ + protected $container = ''; + /** + * List of `ElementaryStream` + * [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed + * in this stream. + * - For `fmp4` container, must contain either one video or one audio stream. + * - For `ts` container, must contain exactly one audio stream and up to one + * video stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + */ + private $elementary_streams; + /** + * Segment settings for `fmp4` and `ts`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.SegmentSettings segment_settings = 5; + */ + protected $segment_settings = null; + /** + * Identifier of the encryption configuration to use. If omitted, output + * will be unencrypted. + * + * Generated from protobuf field string encryption_id = 6; + */ + protected $encryption_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this multiplexed stream. + * @type string $container + * The container format. The default is `fmp4`. + * Supported container formats: + * - `fmp4` - the corresponding file extension is `.m4s` + * - `ts` - the corresponding file extension is `.ts` + * @type array|\Google\Protobuf\Internal\RepeatedField $elementary_streams + * List of `ElementaryStream` + * [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed + * in this stream. + * - For `fmp4` container, must contain either one video or one audio stream. + * - For `ts` container, must contain exactly one audio stream and up to one + * video stream. + * @type \Google\Cloud\Video\LiveStream\V1\SegmentSettings $segment_settings + * Segment settings for `fmp4` and `ts`. + * @type string $encryption_id + * Identifier of the encryption configuration to use. If omitted, output + * will be unencrypted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this multiplexed stream. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this multiplexed stream. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The container format. The default is `fmp4`. + * Supported container formats: + * - `fmp4` - the corresponding file extension is `.m4s` + * - `ts` - the corresponding file extension is `.ts` + * + * Generated from protobuf field string container = 3; + * @return string + */ + public function getContainer() + { + return $this->container; + } + + /** + * The container format. The default is `fmp4`. + * Supported container formats: + * - `fmp4` - the corresponding file extension is `.m4s` + * - `ts` - the corresponding file extension is `.ts` + * + * Generated from protobuf field string container = 3; + * @param string $var + * @return $this + */ + public function setContainer($var) + { + GPBUtil::checkString($var, True); + $this->container = $var; + + return $this; + } + + /** + * List of `ElementaryStream` + * [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed + * in this stream. + * - For `fmp4` container, must contain either one video or one audio stream. + * - For `ts` container, must contain exactly one audio stream and up to one + * video stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElementaryStreams() + { + return $this->elementary_streams; + } + + /** + * List of `ElementaryStream` + * [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed + * in this stream. + * - For `fmp4` container, must contain either one video or one audio stream. + * - For `ts` container, must contain exactly one audio stream and up to one + * video stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElementaryStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->elementary_streams = $arr; + + return $this; + } + + /** + * Segment settings for `fmp4` and `ts`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.SegmentSettings segment_settings = 5; + * @return \Google\Cloud\Video\LiveStream\V1\SegmentSettings|null + */ + public function getSegmentSettings() + { + return $this->segment_settings; + } + + public function hasSegmentSettings() + { + return isset($this->segment_settings); + } + + public function clearSegmentSettings() + { + unset($this->segment_settings); + } + + /** + * Segment settings for `fmp4` and `ts`. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.SegmentSettings segment_settings = 5; + * @param \Google\Cloud\Video\LiveStream\V1\SegmentSettings $var + * @return $this + */ + public function setSegmentSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\SegmentSettings::class); + $this->segment_settings = $var; + + return $this; + } + + /** + * Identifier of the encryption configuration to use. If omitted, output + * will be unencrypted. + * + * Generated from protobuf field string encryption_id = 6; + * @return string + */ + public function getEncryptionId() + { + return $this->encryption_id; + } + + /** + * Identifier of the encryption configuration to use. If omitted, output + * will be unencrypted. + * + * Generated from protobuf field string encryption_id = 6; + * @param string $var + * @return $this + */ + public function setEncryptionId($var) + { + GPBUtil::checkString($var, True); + $this->encryption_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/OperationMetadata.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/OperationMetadata.php new file mode 100644 index 00000000000..ccb892bc11c --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/OperationMetadata.php @@ -0,0 +1,273 @@ +google.cloud.video.livestream.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool.php new file mode 100644 index 00000000000..83f7a3a308a --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool.php @@ -0,0 +1,240 @@ +google.cloud.video.livestream.v1.Pool + */ +class Pool extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the pool, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * Network configuration for the pool. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool.NetworkConfig network_config = 5; + */ + protected $network_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the pool, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The creation time. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time. + * @type array|\Google\Protobuf\Internal\MapField $labels + * User-defined key/value metadata. + * @type \Google\Cloud\Video\LiveStream\V1\Pool\NetworkConfig $network_config + * Network configuration for the pool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the pool, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the pool, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The creation time. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * User-defined key/value metadata. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Network configuration for the pool. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool.NetworkConfig network_config = 5; + * @return \Google\Cloud\Video\LiveStream\V1\Pool\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Network configuration for the pool. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool.NetworkConfig network_config = 5; + * @param \Google\Cloud\Video\LiveStream\V1\Pool\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Pool\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool/NetworkConfig.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool/NetworkConfig.php new file mode 100644 index 00000000000..55b3f9770e0 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/Pool/NetworkConfig.php @@ -0,0 +1,94 @@ +google.cloud.video.livestream.v1.Pool.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * peered_network is the network resource URL of the network that is peered + * to the service provider network. Must be of the format + * projects/NETWORK_PROJECT_NUMBER/global/networks/NETWORK_NAME, where + * NETWORK_PROJECT_NUMBER is the project number of the Cloud project that + * holds your VPC network and NETWORK_NAME is the name of your VPC network. + * If peered_network is omitted or empty, the pool will use endpoints that + * are publicly available. + * + * Generated from protobuf field string peered_network = 1 [(.google.api.resource_reference) = { + */ + protected $peered_network = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $peered_network + * peered_network is the network resource URL of the network that is peered + * to the service provider network. Must be of the format + * projects/NETWORK_PROJECT_NUMBER/global/networks/NETWORK_NAME, where + * NETWORK_PROJECT_NUMBER is the project number of the Cloud project that + * holds your VPC network and NETWORK_NAME is the name of your VPC network. + * If peered_network is omitted or empty, the pool will use endpoints that + * are publicly available. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * peered_network is the network resource URL of the network that is peered + * to the service provider network. Must be of the format + * projects/NETWORK_PROJECT_NUMBER/global/networks/NETWORK_NAME, where + * NETWORK_PROJECT_NUMBER is the project number of the Cloud project that + * holds your VPC network and NETWORK_NAME is the name of your VPC network. + * If peered_network is omitted or empty, the pool will use endpoints that + * are publicly available. + * + * Generated from protobuf field string peered_network = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getPeeredNetwork() + { + return $this->peered_network; + } + + /** + * peered_network is the network resource URL of the network that is peered + * to the service provider network. Must be of the format + * projects/NETWORK_PROJECT_NUMBER/global/networks/NETWORK_NAME, where + * NETWORK_PROJECT_NUMBER is the project number of the Cloud project that + * holds your VPC network and NETWORK_NAME is the name of your VPC network. + * If peered_network is omitted or empty, the pool will use endpoints that + * are publicly available. + * + * Generated from protobuf field string peered_network = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPeeredNetwork($var) + { + GPBUtil::checkString($var, True); + $this->peered_network = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NetworkConfig::class, \Google\Cloud\Video\LiveStream\V1\Pool_NetworkConfig::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig.php new file mode 100644 index 00000000000..3f496613544 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig.php @@ -0,0 +1,165 @@ +google.cloud.video.livestream.v1.PreprocessingConfig + */ +class PreprocessingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Audio audio = 1; + */ + protected $audio = null; + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Crop crop = 2; + */ + protected $crop = null; + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Pad pad = 3; + */ + protected $pad = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Audio $audio + * Audio preprocessing configuration. + * @type \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Crop $crop + * Specify the video cropping configuration. + * @type \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Pad $pad + * Specify the video pad filter configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Audio audio = 1; + * @return \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Audio|null + */ + public function getAudio() + { + return $this->audio; + } + + public function hasAudio() + { + return isset($this->audio); + } + + public function clearAudio() + { + unset($this->audio); + } + + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Audio audio = 1; + * @param \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Audio $var + * @return $this + */ + public function setAudio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Audio::class); + $this->audio = $var; + + return $this; + } + + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Crop crop = 2; + * @return \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Crop|null + */ + public function getCrop() + { + return $this->crop; + } + + public function hasCrop() + { + return isset($this->crop); + } + + public function clearCrop() + { + unset($this->crop); + } + + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Crop crop = 2; + * @param \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Crop $var + * @return $this + */ + public function setCrop($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Crop::class); + $this->crop = $var; + + return $this; + } + + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Pad pad = 3; + * @return \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Pad|null + */ + public function getPad() + { + return $this->pad; + } + + public function hasPad() + { + return isset($this->pad); + } + + public function clearPad() + { + unset($this->pad); + } + + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.PreprocessingConfig.Pad pad = 3; + * @param \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Pad $var + * @return $this + */ + public function setPad($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig\Pad::class); + $this->pad = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Audio.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Audio.php new file mode 100644 index 00000000000..5e62f61a053 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Audio.php @@ -0,0 +1,106 @@ +google.cloud.video.livestream.v1.PreprocessingConfig.Audio + */ +class Audio extends \Google\Protobuf\Internal\Message +{ + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 according to the following: + * - -24 is the Advanced Television Systems Committee (ATSC A/85) + * - -23 is the EU R128 broadcast standard + * - -19 is the prior standard for online mono audio + * - -18 is the ReplayGain standard + * - -16 is the prior standard for stereo audio + * - -14 is the new online audio standard recommended by Spotify, as well as + * Amazon Echo + * - 0 disables normalization. The default is 0. + * + * Generated from protobuf field double lufs = 1; + */ + protected $lufs = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $lufs + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 according to the following: + * - -24 is the Advanced Television Systems Committee (ATSC A/85) + * - -23 is the EU R128 broadcast standard + * - -19 is the prior standard for online mono audio + * - -18 is the ReplayGain standard + * - -16 is the prior standard for stereo audio + * - -14 is the new online audio standard recommended by Spotify, as well as + * Amazon Echo + * - 0 disables normalization. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 according to the following: + * - -24 is the Advanced Television Systems Committee (ATSC A/85) + * - -23 is the EU R128 broadcast standard + * - -19 is the prior standard for online mono audio + * - -18 is the ReplayGain standard + * - -16 is the prior standard for stereo audio + * - -14 is the new online audio standard recommended by Spotify, as well as + * Amazon Echo + * - 0 disables normalization. The default is 0. + * + * Generated from protobuf field double lufs = 1; + * @return float + */ + public function getLufs() + { + return $this->lufs; + } + + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 according to the following: + * - -24 is the Advanced Television Systems Committee (ATSC A/85) + * - -23 is the EU R128 broadcast standard + * - -19 is the prior standard for online mono audio + * - -18 is the ReplayGain standard + * - -16 is the prior standard for stereo audio + * - -14 is the new online audio standard recommended by Spotify, as well as + * Amazon Echo + * - 0 disables normalization. The default is 0. + * + * Generated from protobuf field double lufs = 1; + * @param float $var + * @return $this + */ + public function setLufs($var) + { + GPBUtil::checkDouble($var); + $this->lufs = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Audio::class, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig_Audio::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Crop.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Crop.php new file mode 100644 index 00000000000..71c8d4b86cd --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Crop.php @@ -0,0 +1,173 @@ +google.cloud.video.livestream.v1.PreprocessingConfig.Crop + */ +class Crop extends \Google\Protobuf\Internal\Message +{ + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + */ + protected $top_pixels = 0; + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + */ + protected $bottom_pixels = 0; + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + */ + protected $left_pixels = 0; + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + */ + protected $right_pixels = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $top_pixels + * The number of pixels to crop from the top. The default is 0. + * @type int $bottom_pixels + * The number of pixels to crop from the bottom. The default is 0. + * @type int $left_pixels + * The number of pixels to crop from the left. The default is 0. + * @type int $right_pixels + * The number of pixels to crop from the right. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @return int + */ + public function getTopPixels() + { + return $this->top_pixels; + } + + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @param int $var + * @return $this + */ + public function setTopPixels($var) + { + GPBUtil::checkInt32($var); + $this->top_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @return int + */ + public function getBottomPixels() + { + return $this->bottom_pixels; + } + + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @param int $var + * @return $this + */ + public function setBottomPixels($var) + { + GPBUtil::checkInt32($var); + $this->bottom_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @return int + */ + public function getLeftPixels() + { + return $this->left_pixels; + } + + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @param int $var + * @return $this + */ + public function setLeftPixels($var) + { + GPBUtil::checkInt32($var); + $this->left_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @return int + */ + public function getRightPixels() + { + return $this->right_pixels; + } + + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @param int $var + * @return $this + */ + public function setRightPixels($var) + { + GPBUtil::checkInt32($var); + $this->right_pixels = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Crop::class, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig_Crop::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Pad.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Pad.php new file mode 100644 index 00000000000..ee40c165846 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/PreprocessingConfig/Pad.php @@ -0,0 +1,173 @@ +google.cloud.video.livestream.v1.PreprocessingConfig.Pad + */ +class Pad extends \Google\Protobuf\Internal\Message +{ + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + */ + protected $top_pixels = 0; + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + */ + protected $bottom_pixels = 0; + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + */ + protected $left_pixels = 0; + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + */ + protected $right_pixels = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $top_pixels + * The number of pixels to add to the top. The default is 0. + * @type int $bottom_pixels + * The number of pixels to add to the bottom. The default is 0. + * @type int $left_pixels + * The number of pixels to add to the left. The default is 0. + * @type int $right_pixels + * The number of pixels to add to the right. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @return int + */ + public function getTopPixels() + { + return $this->top_pixels; + } + + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @param int $var + * @return $this + */ + public function setTopPixels($var) + { + GPBUtil::checkInt32($var); + $this->top_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @return int + */ + public function getBottomPixels() + { + return $this->bottom_pixels; + } + + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @param int $var + * @return $this + */ + public function setBottomPixels($var) + { + GPBUtil::checkInt32($var); + $this->bottom_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @return int + */ + public function getLeftPixels() + { + return $this->left_pixels; + } + + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @param int $var + * @return $this + */ + public function setLeftPixels($var) + { + GPBUtil::checkInt32($var); + $this->left_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @return int + */ + public function getRightPixels() + { + return $this->right_pixels; + } + + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @param int $var + * @return $this + */ + public function setRightPixels($var) + { + GPBUtil::checkInt32($var); + $this->right_pixels = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Pad::class, \Google\Cloud\Video\LiveStream\V1\PreprocessingConfig_Pad::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SegmentSettings.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SegmentSettings.php new file mode 100644 index 00000000000..6778ece42f4 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SegmentSettings.php @@ -0,0 +1,105 @@ +google.cloud.video.livestream.v1.SegmentSettings + */ +class SegmentSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Duration of the segments in seconds. The default is `6s`. Note that + * `segmentDuration` must be greater than or equal to + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration], + * and `segmentDuration` must be divisible by + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration]. + * Valid range is [2s, 20s]. + * All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in + * the same manifest must have the same segment duration. + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + */ + protected $segment_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $segment_duration + * Duration of the segments in seconds. The default is `6s`. Note that + * `segmentDuration` must be greater than or equal to + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration], + * and `segmentDuration` must be divisible by + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration]. + * Valid range is [2s, 20s]. + * All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in + * the same manifest must have the same segment duration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Duration of the segments in seconds. The default is `6s`. Note that + * `segmentDuration` must be greater than or equal to + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration], + * and `segmentDuration` must be divisible by + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration]. + * Valid range is [2s, 20s]. + * All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in + * the same manifest must have the same segment duration. + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getSegmentDuration() + { + return $this->segment_duration; + } + + public function hasSegmentDuration() + { + return isset($this->segment_duration); + } + + public function clearSegmentDuration() + { + unset($this->segment_duration); + } + + /** + * Duration of the segments in seconds. The default is `6s`. Note that + * `segmentDuration` must be greater than or equal to + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration], + * and `segmentDuration` must be divisible by + * [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration]. + * Valid range is [2s, 20s]. + * All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in + * the same manifest must have the same segment duration. + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSegmentDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->segment_duration = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SpriteSheet.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SpriteSheet.php new file mode 100644 index 00000000000..719cf70bff5 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/SpriteSheet.php @@ -0,0 +1,367 @@ +google.cloud.video.livestream.v1.SpriteSheet + */ +class SpriteSheet extends \Google\Protobuf\Internal\Message +{ + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + */ + protected $format = ''; + /** + * Required. File name prefix for the generated sprite sheets. If multiple + * sprite sheets are added to the channel, each must have a unique file + * prefix. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $file_prefix = ''; + /** + * Required. The width of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sprite_width_pixels = 0; + /** + * Required. The height of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sprite_height_pixels = 0; + /** + * The maximum number of sprites per row in a sprite sheet. Valid range is + * [1, 10] and the default value is 1. + * + * Generated from protobuf field int32 column_count = 5; + */ + protected $column_count = 0; + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. Valid range is [1, 10] and the default value + * is 1. + * + * Generated from protobuf field int32 row_count = 6; + */ + protected $row_count = 0; + /** + * Create sprites at regular intervals. Valid range is [1 second, 1 hour] and + * the default value is `10s`. + * + * Generated from protobuf field .google.protobuf.Duration interval = 7; + */ + protected $interval = null; + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 8; + */ + protected $quality = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $format + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * @type string $file_prefix + * Required. File name prefix for the generated sprite sheets. If multiple + * sprite sheets are added to the channel, each must have a unique file + * prefix. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * @type int $sprite_width_pixels + * Required. The width of the sprite in pixels. Must be an even integer. + * @type int $sprite_height_pixels + * Required. The height of the sprite in pixels. Must be an even integer. + * @type int $column_count + * The maximum number of sprites per row in a sprite sheet. Valid range is + * [1, 10] and the default value is 1. + * @type int $row_count + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. Valid range is [1, 10] and the default value + * is 1. + * @type \Google\Protobuf\Duration $interval + * Create sprites at regular intervals. Valid range is [1 second, 1 hour] and + * the default value is `10s`. + * @type int $quality + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + * @param string $var + * @return $this + */ + public function setFormat($var) + { + GPBUtil::checkString($var, True); + $this->format = $var; + + return $this; + } + + /** + * Required. File name prefix for the generated sprite sheets. If multiple + * sprite sheets are added to the channel, each must have a unique file + * prefix. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilePrefix() + { + return $this->file_prefix; + } + + /** + * Required. File name prefix for the generated sprite sheets. If multiple + * sprite sheets are added to the channel, each must have a unique file + * prefix. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilePrefix($var) + { + GPBUtil::checkString($var, True); + $this->file_prefix = $var; + + return $this; + } + + /** + * Required. The width of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSpriteWidthPixels() + { + return $this->sprite_width_pixels; + } + + /** + * Required. The width of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSpriteWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->sprite_width_pixels = $var; + + return $this; + } + + /** + * Required. The height of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSpriteHeightPixels() + { + return $this->sprite_height_pixels; + } + + /** + * Required. The height of the sprite in pixels. Must be an even integer. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSpriteHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->sprite_height_pixels = $var; + + return $this; + } + + /** + * The maximum number of sprites per row in a sprite sheet. Valid range is + * [1, 10] and the default value is 1. + * + * Generated from protobuf field int32 column_count = 5; + * @return int + */ + public function getColumnCount() + { + return $this->column_count; + } + + /** + * The maximum number of sprites per row in a sprite sheet. Valid range is + * [1, 10] and the default value is 1. + * + * Generated from protobuf field int32 column_count = 5; + * @param int $var + * @return $this + */ + public function setColumnCount($var) + { + GPBUtil::checkInt32($var); + $this->column_count = $var; + + return $this; + } + + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. Valid range is [1, 10] and the default value + * is 1. + * + * Generated from protobuf field int32 row_count = 6; + * @return int + */ + public function getRowCount() + { + return $this->row_count; + } + + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. Valid range is [1, 10] and the default value + * is 1. + * + * Generated from protobuf field int32 row_count = 6; + * @param int $var + * @return $this + */ + public function setRowCount($var) + { + GPBUtil::checkInt32($var); + $this->row_count = $var; + + return $this; + } + + /** + * Create sprites at regular intervals. Valid range is [1 second, 1 hour] and + * the default value is `10s`. + * + * Generated from protobuf field .google.protobuf.Duration interval = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getInterval() + { + return $this->interval; + } + + public function hasInterval() + { + return isset($this->interval); + } + + public function clearInterval() + { + unset($this->interval); + } + + /** + * Create sprites at regular intervals. Valid range is [1 second, 1 hour] and + * the default value is `10s`. + * + * Generated from protobuf field .google.protobuf.Duration interval = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->interval = $var; + + return $this; + } + + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 8; + * @return int + */ + public function getQuality() + { + return $this->quality; + } + + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 8; + * @param int $var + * @return $this + */ + public function setQuality($var) + { + GPBUtil::checkInt32($var); + $this->quality = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StartChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StartChannelRequest.php new file mode 100644 index 00000000000..d70e8707a2a --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StartChannelRequest.php @@ -0,0 +1,160 @@ +google.cloud.video.livestream.v1.StartChannelRequest + */ +class StartChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\StartChannelRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StopChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StopChannelRequest.php new file mode 100644 index 00000000000..59ed1b5512c --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/StopChannelRequest.php @@ -0,0 +1,160 @@ +google.cloud.video.livestream.v1.StopChannelRequest + */ +class StopChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. Please see + * {@see LivestreamServiceClient::channelName()} for help formatting this field. + * + * @return \Google\Cloud\Video\LiveStream\V1\StopChannelRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TextStream.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TextStream.php new file mode 100644 index 00000000000..65259f395c0 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TextStream.php @@ -0,0 +1,79 @@ +google.cloud.video.livestream.v1.TextStream + */ +class TextStream extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The codec for this text stream. + * Supported text codecs: + * - `cea608` + * - `cea708` + * + * Generated from protobuf field string codec = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $codec = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $codec + * Required. The codec for this text stream. + * Supported text codecs: + * - `cea608` + * - `cea708` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The codec for this text stream. + * Supported text codecs: + * - `cea608` + * - `cea708` + * + * Generated from protobuf field string codec = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * Required. The codec for this text stream. + * Supported text codecs: + * - `cea608` + * - `cea708` + * + * Generated from protobuf field string codec = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig.php new file mode 100644 index 00000000000..0bfb38e5aa0 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig.php @@ -0,0 +1,150 @@ +google.cloud.video.livestream.v1.TimecodeConfig + */ +class TimecodeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The source of the timecode that will later be used in outputs/manifests. + * It determines the initial timecode/timestamp (first frame) of output + * streams. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig.TimecodeSource source = 1; + */ + protected $source = 0; + protected $time_offset; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $source + * The source of the timecode that will later be used in outputs/manifests. + * It determines the initial timecode/timestamp (first frame) of output + * streams. + * @type \Google\Protobuf\Duration $utc_offset + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * @type \Google\Type\TimeZone $time_zone + * Time zone e.g. "America/Los_Angeles". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * The source of the timecode that will later be used in outputs/manifests. + * It determines the initial timecode/timestamp (first frame) of output + * streams. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig.TimecodeSource source = 1; + * @return int + */ + public function getSource() + { + return $this->source; + } + + /** + * The source of the timecode that will later be used in outputs/manifests. + * It determines the initial timecode/timestamp (first frame) of output + * streams. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.TimecodeConfig.TimecodeSource source = 1; + * @param int $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\LiveStream\V1\TimecodeConfig\TimecodeSource::class); + $this->source = $var; + + return $this; + } + + /** + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * + * Generated from protobuf field .google.protobuf.Duration utc_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getUtcOffset() + { + return $this->readOneof(2); + } + + public function hasUtcOffset() + { + return $this->hasOneof(2); + } + + /** + * UTC offset. Must be whole seconds, between -18 hours and +18 hours. + * + * Generated from protobuf field .google.protobuf.Duration utc_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setUtcOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Time zone e.g. "America/Los_Angeles". + * + * Generated from protobuf field .google.type.TimeZone time_zone = 3; + * @return \Google\Type\TimeZone|null + */ + public function getTimeZone() + { + return $this->readOneof(3); + } + + public function hasTimeZone() + { + return $this->hasOneof(3); + } + + /** + * Time zone e.g. "America/Los_Angeles". + * + * Generated from protobuf field .google.type.TimeZone time_zone = 3; + * @param \Google\Type\TimeZone $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkMessage($var, \Google\Type\TimeZone::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getTimeOffset() + { + return $this->whichOneof("time_offset"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig/TimecodeSource.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig/TimecodeSource.php new file mode 100644 index 00000000000..143ed3952b6 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/TimecodeConfig/TimecodeSource.php @@ -0,0 +1,64 @@ +google.cloud.video.livestream.v1.TimecodeConfig.TimecodeSource + */ +class TimecodeSource +{ + /** + * The timecode source is not specified. + * + * Generated from protobuf enum TIMECODE_SOURCE_UNSPECIFIED = 0; + */ + const TIMECODE_SOURCE_UNSPECIFIED = 0; + /** + * Use input media timestamp. + * + * Generated from protobuf enum MEDIA_TIMESTAMP = 1; + */ + const MEDIA_TIMESTAMP = 1; + /** + * Use input embedded timecode e.g. picture timing SEI message. + * + * Generated from protobuf enum EMBEDDED_TIMECODE = 2; + */ + const EMBEDDED_TIMECODE = 2; + + private static $valueToName = [ + self::TIMECODE_SOURCE_UNSPECIFIED => 'TIMECODE_SOURCE_UNSPECIFIED', + self::MEDIA_TIMESTAMP => 'MEDIA_TIMESTAMP', + self::EMBEDDED_TIMECODE => 'EMBEDDED_TIMECODE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TimecodeSource::class, \Google\Cloud\Video\LiveStream\V1\TimecodeConfig_TimecodeSource::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateChannelRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateChannelRequest.php new file mode 100644 index 00000000000..0d41cb29e8b --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateChannelRequest.php @@ -0,0 +1,293 @@ +google.cloud.video.livestream.v1.UpdateChannelRequest + */ +class UpdateChannelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The channel resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $channel = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Video\LiveStream\V1\Channel $channel Required. The channel resource to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * @return \Google\Cloud\Video\LiveStream\V1\UpdateChannelRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Video\LiveStream\V1\Channel $channel, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setChannel($channel) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * @type \Google\Cloud\Video\LiveStream\V1\Channel $channel + * Required. The channel resource to be updated. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The channel resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Channel|null + */ + public function getChannel() + { + return $this->channel; + } + + public function hasChannel() + { + return isset($this->channel); + } + + public function clearChannel() + { + unset($this->channel); + } + + /** + * Required. The channel resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Channel channel = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Channel $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Channel::class); + $this->channel = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateInputRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateInputRequest.php new file mode 100644 index 00000000000..c68b33c975c --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdateInputRequest.php @@ -0,0 +1,253 @@ +google.cloud.video.livestream.v1.UpdateInputRequest + */ +class UpdateInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The input resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Video\LiveStream\V1\Input $input Required. The input resource to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * @return \Google\Cloud\Video\LiveStream\V1\UpdateInputRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Video\LiveStream\V1\Input $input, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setInput($input) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * @type \Google\Cloud\Video\LiveStream\V1\Input $input + * Required. The input resource to be updated. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The input resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Input|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Required. The input resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Input input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Input $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Input::class); + $this->input = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdatePoolRequest.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdatePoolRequest.php new file mode 100644 index 00000000000..55b139eecc2 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/UpdatePoolRequest.php @@ -0,0 +1,232 @@ +google.cloud.video.livestream.v1.UpdatePoolRequest + */ +class UpdatePoolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * * `networkConfig` + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The pool resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool pool = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $pool = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\Video\LiveStream\V1\Pool $pool Required. The pool resource to be updated. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * + * * `networkConfig` + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * @return \Google\Cloud\Video\LiveStream\V1\UpdatePoolRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Video\LiveStream\V1\Pool $pool, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setPool($pool) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * * `networkConfig` + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @type \Google\Cloud\Video\LiveStream\V1\Pool $pool + * Required. The pool resource to be updated. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * * `networkConfig` + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * * `networkConfig` + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The pool resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\LiveStream\V1\Pool|null + */ + public function getPool() + { + return $this->pool; + } + + public function hasPool() + { + return isset($this->pool); + } + + public function clearPool() + { + unset($this->pool); + } + + /** + * Required. The pool resource to be updated. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.Pool pool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\LiveStream\V1\Pool $var + * @return $this + */ + public function setPool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\Pool::class); + $this->pool = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoFormat.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoFormat.php new file mode 100644 index 00000000000..605d4d41bf8 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoFormat.php @@ -0,0 +1,169 @@ +google.cloud.video.livestream.v1.VideoFormat + */ +class VideoFormat extends \Google\Protobuf\Internal\Message +{ + /** + * Video codec used in this video stream. + * + * Generated from protobuf field string codec = 1; + */ + protected $codec = ''; + /** + * The width of the video stream in pixels. + * + * Generated from protobuf field int32 width_pixels = 2; + */ + protected $width_pixels = 0; + /** + * The height of the video stream in pixels. + * + * Generated from protobuf field int32 height_pixels = 3; + */ + protected $height_pixels = 0; + /** + * The frame rate of the input video stream. + * + * Generated from protobuf field double frame_rate = 4; + */ + protected $frame_rate = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $codec + * Video codec used in this video stream. + * @type int $width_pixels + * The width of the video stream in pixels. + * @type int $height_pixels + * The height of the video stream in pixels. + * @type float $frame_rate + * The frame rate of the input video stream. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Video codec used in this video stream. + * + * Generated from protobuf field string codec = 1; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * Video codec used in this video stream. + * + * Generated from protobuf field string codec = 1; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + + /** + * The width of the video stream in pixels. + * + * Generated from protobuf field int32 width_pixels = 2; + * @return int + */ + public function getWidthPixels() + { + return $this->width_pixels; + } + + /** + * The width of the video stream in pixels. + * + * Generated from protobuf field int32 width_pixels = 2; + * @param int $var + * @return $this + */ + public function setWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->width_pixels = $var; + + return $this; + } + + /** + * The height of the video stream in pixels. + * + * Generated from protobuf field int32 height_pixels = 3; + * @return int + */ + public function getHeightPixels() + { + return $this->height_pixels; + } + + /** + * The height of the video stream in pixels. + * + * Generated from protobuf field int32 height_pixels = 3; + * @param int $var + * @return $this + */ + public function setHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->height_pixels = $var; + + return $this; + } + + /** + * The frame rate of the input video stream. + * + * Generated from protobuf field double frame_rate = 4; + * @return float + */ + public function getFrameRate() + { + return $this->frame_rate; + } + + /** + * The frame rate of the input video stream. + * + * Generated from protobuf field double frame_rate = 4; + * @param float $var + * @return $this + */ + public function setFrameRate($var) + { + GPBUtil::checkDouble($var); + $this->frame_rate = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream.php new file mode 100644 index 00000000000..6213a93235f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream.php @@ -0,0 +1,75 @@ +google.cloud.video.livestream.v1.VideoStream + */ +class VideoStream extends \Google\Protobuf\Internal\Message +{ + protected $codec_settings; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\LiveStream\V1\VideoStream\H264CodecSettings $h264 + * H264 codec settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * H264 codec settings. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoStream.H264CodecSettings h264 = 20; + * @return \Google\Cloud\Video\LiveStream\V1\VideoStream\H264CodecSettings|null + */ + public function getH264() + { + return $this->readOneof(20); + } + + public function hasH264() + { + return $this->hasOneof(20); + } + + /** + * H264 codec settings. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoStream.H264CodecSettings h264 = 20; + * @param \Google\Cloud\Video\LiveStream\V1\VideoStream\H264CodecSettings $var + * @return $this + */ + public function setH264($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\VideoStream\H264CodecSettings::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * @return string + */ + public function getCodecSettings() + { + return $this->whichOneof("codec_settings"); + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream/H264CodecSettings.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream/H264CodecSettings.php new file mode 100644 index 00000000000..e6953375134 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStream/H264CodecSettings.php @@ -0,0 +1,743 @@ +google.cloud.video.livestream.v1.VideoStream.H264CodecSettings + */ +class H264CodecSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The width of the video in pixels. Must be an even integer. + * Valid range is [320, 1920]. + * + * Generated from protobuf field int32 width_pixels = 1; + */ + protected $width_pixels = 0; + /** + * Required. The height of the video in pixels. Must be an even integer. + * Valid range is [180, 1080]. + * + * Generated from protobuf field int32 height_pixels = 2; + */ + protected $height_pixels = 0; + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 60. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $frame_rate = 0.0; + /** + * Required. The video bitrate in bits per second. Minimum value is 10,000. + * - For SD resolution (< 720p), must be <= 3,000,000 (3 Mbps). + * - For HD resolution (<= 1080p), must be <= 15,000,000 (15 Mbps). + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 6; + */ + protected $allow_open_gop = false; + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to + * [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps]. + * + * Generated from protobuf field int32 vbv_size_bits = 9; + */ + protected $vbv_size_bits = 0; + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * [vbv_size_bits][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.vbv_size_bits]. + * + * Generated from protobuf field int32 vbv_fullness_bits = 10; + */ + protected $vbv_fullness_bits = 0; + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 11; + */ + protected $entropy_coder = ''; + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 12; + */ + protected $b_pyramid = false; + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than + * [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count] + * if set. The default is 0. + * + * Generated from protobuf field int32 b_frame_count = 13; + */ + protected $b_frame_count = 0; + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 14; + */ + protected $aq_strength = 0.0; + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` (default) + * * `high` + * The available options are [FFmpeg-compatible Profile + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string profile = 15; + */ + protected $profile = ''; + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible Encode + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune) + * Note that certain values for this field may cause the transcoder to + * override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string tune = 16; + */ + protected $tune = ''; + protected $gop_mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $width_pixels + * Required. The width of the video in pixels. Must be an even integer. + * Valid range is [320, 1920]. + * @type int $height_pixels + * Required. The height of the video in pixels. Must be an even integer. + * Valid range is [180, 1080]. + * @type float $frame_rate + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 60. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * @type int $bitrate_bps + * Required. The video bitrate in bits per second. Minimum value is 10,000. + * - For SD resolution (< 720p), must be <= 3,000,000 (3 Mbps). + * - For HD resolution (<= 1080p), must be <= 15,000,000 (15 Mbps). + * @type bool $allow_open_gop + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * @type int $gop_frame_count + * Select the GOP size based on the specified frame count. + * If GOP frame count is set instead of GOP duration, GOP duration will be + * calculated by `gopFrameCount`/`frameRate`. The calculated GOP duration + * must satisfy the limitations on `gopDuration` as well. + * Valid range is [60, 600]. + * @type \Google\Protobuf\Duration $gop_duration + * Select the GOP size based on the specified duration. The default is + * `2s`. Note that `gopDuration` must be less than or equal to + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration], + * and + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration] + * must be divisible by `gopDuration`. Valid range is [2s, 20s]. + * All video streams in the same channel must have the same GOP size. + * @type int $vbv_size_bits + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to + * [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps]. + * @type int $vbv_fullness_bits + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * [vbv_size_bits][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.vbv_size_bits]. + * @type string $entropy_coder + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * @type bool $b_pyramid + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * @type int $b_frame_count + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than + * [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count] + * if set. The default is 0. + * @type float $aq_strength + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * @type string $profile + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` (default) + * * `high` + * The available options are [FFmpeg-compatible Profile + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * @type string $tune + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible Encode + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune) + * Note that certain values for this field may cause the transcoder to + * override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Outputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The width of the video in pixels. Must be an even integer. + * Valid range is [320, 1920]. + * + * Generated from protobuf field int32 width_pixels = 1; + * @return int + */ + public function getWidthPixels() + { + return $this->width_pixels; + } + + /** + * Required. The width of the video in pixels. Must be an even integer. + * Valid range is [320, 1920]. + * + * Generated from protobuf field int32 width_pixels = 1; + * @param int $var + * @return $this + */ + public function setWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->width_pixels = $var; + + return $this; + } + + /** + * Required. The height of the video in pixels. Must be an even integer. + * Valid range is [180, 1080]. + * + * Generated from protobuf field int32 height_pixels = 2; + * @return int + */ + public function getHeightPixels() + { + return $this->height_pixels; + } + + /** + * Required. The height of the video in pixels. Must be an even integer. + * Valid range is [180, 1080]. + * + * Generated from protobuf field int32 height_pixels = 2; + * @param int $var + * @return $this + */ + public function setHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->height_pixels = $var; + + return $this; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 60. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getFrameRate() + { + return $this->frame_rate; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 60. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setFrameRate($var) + { + GPBUtil::checkDouble($var); + $this->frame_rate = $var; + + return $this; + } + + /** + * Required. The video bitrate in bits per second. Minimum value is 10,000. + * - For SD resolution (< 720p), must be <= 3,000,000 (3 Mbps). + * - For HD resolution (<= 1080p), must be <= 15,000,000 (15 Mbps). + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. The video bitrate in bits per second. Minimum value is 10,000. + * - For SD resolution (< 720p), must be <= 3,000,000 (3 Mbps). + * - For HD resolution (<= 1080p), must be <= 15,000,000 (15 Mbps). + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 6; + * @return bool + */ + public function getAllowOpenGop() + { + return $this->allow_open_gop; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 6; + * @param bool $var + * @return $this + */ + public function setAllowOpenGop($var) + { + GPBUtil::checkBool($var); + $this->allow_open_gop = $var; + + return $this; + } + + /** + * Select the GOP size based on the specified frame count. + * If GOP frame count is set instead of GOP duration, GOP duration will be + * calculated by `gopFrameCount`/`frameRate`. The calculated GOP duration + * must satisfy the limitations on `gopDuration` as well. + * Valid range is [60, 600]. + * + * Generated from protobuf field int32 gop_frame_count = 7; + * @return int + */ + public function getGopFrameCount() + { + return $this->readOneof(7); + } + + public function hasGopFrameCount() + { + return $this->hasOneof(7); + } + + /** + * Select the GOP size based on the specified frame count. + * If GOP frame count is set instead of GOP duration, GOP duration will be + * calculated by `gopFrameCount`/`frameRate`. The calculated GOP duration + * must satisfy the limitations on `gopDuration` as well. + * Valid range is [60, 600]. + * + * Generated from protobuf field int32 gop_frame_count = 7; + * @param int $var + * @return $this + */ + public function setGopFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Select the GOP size based on the specified duration. The default is + * `2s`. Note that `gopDuration` must be less than or equal to + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration], + * and + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration] + * must be divisible by `gopDuration`. Valid range is [2s, 20s]. + * All video streams in the same channel must have the same GOP size. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getGopDuration() + { + return $this->readOneof(8); + } + + public function hasGopDuration() + { + return $this->hasOneof(8); + } + + /** + * Select the GOP size based on the specified duration. The default is + * `2s`. Note that `gopDuration` must be less than or equal to + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration], + * and + * [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration] + * must be divisible by `gopDuration`. Valid range is [2s, 20s]. + * All video streams in the same channel must have the same GOP size. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setGopDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to + * [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps]. + * + * Generated from protobuf field int32 vbv_size_bits = 9; + * @return int + */ + public function getVbvSizeBits() + { + return $this->vbv_size_bits; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to + * [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps]. + * + * Generated from protobuf field int32 vbv_size_bits = 9; + * @param int $var + * @return $this + */ + public function setVbvSizeBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_size_bits = $var; + + return $this; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * [vbv_size_bits][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.vbv_size_bits]. + * + * Generated from protobuf field int32 vbv_fullness_bits = 10; + * @return int + */ + public function getVbvFullnessBits() + { + return $this->vbv_fullness_bits; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * [vbv_size_bits][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.vbv_size_bits]. + * + * Generated from protobuf field int32 vbv_fullness_bits = 10; + * @param int $var + * @return $this + */ + public function setVbvFullnessBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_fullness_bits = $var; + + return $this; + } + + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 11; + * @return string + */ + public function getEntropyCoder() + { + return $this->entropy_coder; + } + + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 11; + * @param string $var + * @return $this + */ + public function setEntropyCoder($var) + { + GPBUtil::checkString($var, True); + $this->entropy_coder = $var; + + return $this; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 12; + * @return bool + */ + public function getBPyramid() + { + return $this->b_pyramid; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 12; + * @param bool $var + * @return $this + */ + public function setBPyramid($var) + { + GPBUtil::checkBool($var); + $this->b_pyramid = $var; + + return $this; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than + * [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count] + * if set. The default is 0. + * + * Generated from protobuf field int32 b_frame_count = 13; + * @return int + */ + public function getBFrameCount() + { + return $this->b_frame_count; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than + * [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count] + * if set. The default is 0. + * + * Generated from protobuf field int32 b_frame_count = 13; + * @param int $var + * @return $this + */ + public function setBFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->b_frame_count = $var; + + return $this; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 14; + * @return float + */ + public function getAqStrength() + { + return $this->aq_strength; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 14; + * @param float $var + * @return $this + */ + public function setAqStrength($var) + { + GPBUtil::checkDouble($var); + $this->aq_strength = $var; + + return $this; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` (default) + * * `high` + * The available options are [FFmpeg-compatible Profile + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string profile = 15; + * @return string + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` (default) + * * `high` + * The available options are [FFmpeg-compatible Profile + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string profile = 15; + * @param string $var + * @return $this + */ + public function setProfile($var) + { + GPBUtil::checkString($var, True); + $this->profile = $var; + + return $this; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible Encode + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune) + * Note that certain values for this field may cause the transcoder to + * override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string tune = 16; + * @return string + */ + public function getTune() + { + return $this->tune; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible Encode + * Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune) + * Note that certain values for this field may cause the transcoder to + * override other fields you set in the + * [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] + * message. + * + * Generated from protobuf field string tune = 16; + * @param string $var + * @return $this + */ + public function setTune($var) + { + GPBUtil::checkString($var, True); + $this->tune = $var; + + return $this; + } + + /** + * @return string + */ + public function getGopMode() + { + return $this->whichOneof("gop_mode"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(H264CodecSettings::class, \Google\Cloud\Video\LiveStream\V1\VideoStream_H264CodecSettings::class); + diff --git a/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStreamProperty.php b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStreamProperty.php new file mode 100644 index 00000000000..ffda21dceb4 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/proto/src/Google/Cloud/Video/LiveStream/V1/VideoStreamProperty.php @@ -0,0 +1,111 @@ +google.cloud.video.livestream.v1.VideoStreamProperty + */ +class VideoStreamProperty extends \Google\Protobuf\Internal\Message +{ + /** + * Index of this video stream. + * + * Generated from protobuf field int32 index = 1; + */ + protected $index = 0; + /** + * Properties of the video format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoFormat video_format = 2; + */ + protected $video_format = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $index + * Index of this video stream. + * @type \Google\Cloud\Video\LiveStream\V1\VideoFormat $video_format + * Properties of the video format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Livestream\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Index of this video stream. + * + * Generated from protobuf field int32 index = 1; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * Index of this video stream. + * + * Generated from protobuf field int32 index = 1; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * Properties of the video format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoFormat video_format = 2; + * @return \Google\Cloud\Video\LiveStream\V1\VideoFormat|null + */ + public function getVideoFormat() + { + return $this->video_format; + } + + public function hasVideoFormat() + { + return isset($this->video_format); + } + + public function clearVideoFormat() + { + unset($this->video_format); + } + + /** + * Properties of the video format. + * + * Generated from protobuf field .google.cloud.video.livestream.v1.VideoFormat video_format = 2; + * @param \Google\Cloud\Video\LiveStream\V1\VideoFormat $var + * @return $this + */ + public function setVideoFormat($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\LiveStream\V1\VideoFormat::class); + $this->video_format = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_asset.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_asset.php new file mode 100644 index 00000000000..d78b185c9aa --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_asset.php @@ -0,0 +1,92 @@ +setParent($formattedParent) + ->setAsset($asset) + ->setAssetId($assetId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->createAsset($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Asset $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $assetId = '[ASSET_ID]'; + + create_asset_sample($formattedParent, $assetId); +} +// [END livestream_v1_generated_LivestreamService_CreateAsset_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_channel.php new file mode 100644 index 00000000000..87c456a7450 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_channel.php @@ -0,0 +1,95 @@ +setOutput($channelOutput); + $request = (new CreateChannelRequest()) + ->setParent($formattedParent) + ->setChannel($channel) + ->setChannelId($channelId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->createChannel($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Channel $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $channelId = '[CHANNEL_ID]'; + + create_channel_sample($formattedParent, $channelId); +} +// [END livestream_v1_generated_LivestreamService_CreateChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_event.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_event.php new file mode 100644 index 00000000000..9a71176eefb --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_event.php @@ -0,0 +1,79 @@ +setParent($formattedParent) + ->setEvent($event) + ->setEventId($eventId); + + // Call the API and handle any network failures. + try { + /** @var Event $response */ + $response = $livestreamServiceClient->createEvent($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $eventId = '[EVENT_ID]'; + + create_event_sample($formattedParent, $eventId); +} +// [END livestream_v1_generated_LivestreamService_CreateEvent_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_input.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_input.php new file mode 100644 index 00000000000..cab250d8915 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/create_input.php @@ -0,0 +1,91 @@ +setParent($formattedParent) + ->setInput($input) + ->setInputId($inputId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->createInput($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Input $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $inputId = '[INPUT_ID]'; + + create_input_sample($formattedParent, $inputId); +} +// [END livestream_v1_generated_LivestreamService_CreateInput_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_asset.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_asset.php new file mode 100644 index 00000000000..101273b1066 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_asset.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->deleteAsset($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + + delete_asset_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_DeleteAsset_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_channel.php new file mode 100644 index 00000000000..9e248f5e7f9 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_channel.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->deleteChannel($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + + delete_channel_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_DeleteChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_event.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_event.php new file mode 100644 index 00000000000..1d889cf7cf8 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_event.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $livestreamServiceClient->deleteEvent($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::eventName( + '[PROJECT]', + '[LOCATION]', + '[CHANNEL]', + '[EVENT]' + ); + + delete_event_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_DeleteEvent_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_input.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_input.php new file mode 100644 index 00000000000..90ae3ffb911 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/delete_input.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->deleteInput($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + + delete_input_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_DeleteInput_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_asset.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_asset.php new file mode 100644 index 00000000000..c23945c2c66 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_asset.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Asset $response */ + $response = $livestreamServiceClient->getAsset($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + + get_asset_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_GetAsset_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_channel.php new file mode 100644 index 00000000000..bc5923b29e2 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_channel.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Channel $response */ + $response = $livestreamServiceClient->getChannel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + + get_channel_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_GetChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_event.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_event.php new file mode 100644 index 00000000000..96941dc49a2 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_event.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Event $response */ + $response = $livestreamServiceClient->getEvent($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::eventName( + '[PROJECT]', + '[LOCATION]', + '[CHANNEL]', + '[EVENT]' + ); + + get_event_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_GetEvent_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_input.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_input.php new file mode 100644 index 00000000000..d4050c30f4f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_input.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Input $response */ + $response = $livestreamServiceClient->getInput($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + + get_input_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_GetInput_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_location.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_location.php new file mode 100644 index 00000000000..74f1b89dcff --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END livestream_v1_generated_LivestreamService_GetLocation_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_pool.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_pool.php new file mode 100644 index 00000000000..2ae26bfe61f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/get_pool.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Pool $response */ + $response = $livestreamServiceClient->getPool($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + + get_pool_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_GetPool_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_assets.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_assets.php new file mode 100644 index 00000000000..6cadc6e7278 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_assets.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $livestreamServiceClient->listAssets($request); + + /** @var Asset $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_assets_sample($formattedParent); +} +// [END livestream_v1_generated_LivestreamService_ListAssets_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_channels.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_channels.php new file mode 100644 index 00000000000..a09d21fad91 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_channels.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $livestreamServiceClient->listChannels($request); + + /** @var Channel $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_channels_sample($formattedParent); +} +// [END livestream_v1_generated_LivestreamService_ListChannels_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_events.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_events.php new file mode 100644 index 00000000000..cdddc296a24 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_events.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $livestreamServiceClient->listEvents($request); + + /** @var Event $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + + list_events_sample($formattedParent); +} +// [END livestream_v1_generated_LivestreamService_ListEvents_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_inputs.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_inputs.php new file mode 100644 index 00000000000..b10a4e8637b --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_inputs.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $livestreamServiceClient->listInputs($request); + + /** @var Input $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_inputs_sample($formattedParent); +} +// [END livestream_v1_generated_LivestreamService_ListInputs_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_locations.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_locations.php new file mode 100644 index 00000000000..44a01d3dfb7 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END livestream_v1_generated_LivestreamService_ListLocations_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/start_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/start_channel.php new file mode 100644 index 00000000000..764f07e0689 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/start_channel.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->startChannel($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ChannelOperationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + + start_channel_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_StartChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/stop_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/stop_channel.php new file mode 100644 index 00000000000..e475b45492b --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/stop_channel.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->stopChannel($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ChannelOperationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + + stop_channel_sample($formattedName); +} +// [END livestream_v1_generated_LivestreamService_StopChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_channel.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_channel.php new file mode 100644 index 00000000000..984af23ee27 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_channel.php @@ -0,0 +1,74 @@ +setOutput($channelOutput); + $request = (new UpdateChannelRequest()) + ->setChannel($channel); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->updateChannel($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Channel $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END livestream_v1_generated_LivestreamService_UpdateChannel_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_input.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_input.php new file mode 100644 index 00000000000..679fc2197cd --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_input.php @@ -0,0 +1,71 @@ +setInput($input); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->updateInput($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Input $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END livestream_v1_generated_LivestreamService_UpdateInput_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_pool.php b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_pool.php new file mode 100644 index 00000000000..6a271f6dbbd --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/samples/V1/LivestreamServiceClient/update_pool.php @@ -0,0 +1,71 @@ +setPool($pool); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $livestreamServiceClient->updatePool($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Pool $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END livestream_v1_generated_LivestreamService_UpdatePool_sync] diff --git a/owl-bot-staging/VideoLiveStream/v1/src/V1/Client/LivestreamServiceClient.php b/owl-bot-staging/VideoLiveStream/v1/src/V1/Client/LivestreamServiceClient.php new file mode 100644 index 00000000000..e5de174cd0d --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/src/V1/Client/LivestreamServiceClient.php @@ -0,0 +1,1068 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/livestream_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/livestream_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/livestream_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/livestream_service_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a asset + * resource. + * + * @param string $project + * @param string $location + * @param string $asset + * + * @return string The formatted asset resource. + */ + public static function assetName(string $project, string $location, string $asset): string + { + return self::getPathTemplate('asset')->render([ + 'project' => $project, + 'location' => $location, + 'asset' => $asset, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName(string $project, string $location, string $channel): string + { + return self::getPathTemplate('channel')->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a event + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * @param string $event + * + * @return string The formatted event resource. + */ + public static function eventName(string $project, string $location, string $channel, string $event): string + { + return self::getPathTemplate('event')->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + 'event' => $event, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a input + * resource. + * + * @param string $project + * @param string $location + * @param string $input + * + * @return string The formatted input resource. + */ + public static function inputName(string $project, string $location, string $input): string + { + return self::getPathTemplate('input')->render([ + 'project' => $project, + 'location' => $location, + 'input' => $input, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName(string $project, string $network): string + { + return self::getPathTemplate('network')->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a pool + * resource. + * + * @param string $project + * @param string $location + * @param string $pool + * + * @return string The formatted pool resource. + */ + public static function poolName(string $project, string $location, string $pool): string + { + return self::getPathTemplate('pool')->render([ + 'project' => $project, + 'location' => $location, + 'pool' => $pool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + */ + public static function secretVersionName(string $project, string $secret, string $version): string + { + return self::getPathTemplate('secretVersion')->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - asset: projects/{project}/locations/{location}/assets/{asset} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - event: projects/{project}/locations/{location}/channels/{channel}/events/{event} + * - input: projects/{project}/locations/{location}/inputs/{input} + * - location: projects/{project}/locations/{location} + * - network: projects/{project}/global/networks/{network} + * - pool: projects/{project}/locations/{location}/pools/{pool} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'livestream.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a Asset with the provided unique ID in the specified + * region. + * + * The async variant is {@see LivestreamServiceClient::createAssetAsync()} . + * + * @example samples/V1/LivestreamServiceClient/create_asset.php + * + * @param CreateAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAsset(CreateAssetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAsset', $request, $callOptions)->wait(); + } + + /** + * Creates a channel with the provided unique ID in the specified + * region. + * + * The async variant is {@see LivestreamServiceClient::createChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/create_channel.php + * + * @param CreateChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createChannel(CreateChannelRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateChannel', $request, $callOptions)->wait(); + } + + /** + * Creates an event with the provided unique ID in the specified channel. + * + * The async variant is {@see LivestreamServiceClient::createEventAsync()} . + * + * @example samples/V1/LivestreamServiceClient/create_event.php + * + * @param CreateEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Event + * + * @throws ApiException Thrown if the API call fails. + */ + public function createEvent(CreateEventRequest $request, array $callOptions = []): Event + { + return $this->startApiCall('CreateEvent', $request, $callOptions)->wait(); + } + + /** + * Creates an input with the provided unique ID in the specified region. + * + * The async variant is {@see LivestreamServiceClient::createInputAsync()} . + * + * @example samples/V1/LivestreamServiceClient/create_input.php + * + * @param CreateInputRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createInput(CreateInputRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateInput', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified asset if it is not used. + * + * The async variant is {@see LivestreamServiceClient::deleteAssetAsync()} . + * + * @example samples/V1/LivestreamServiceClient/delete_asset.php + * + * @param DeleteAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteAsset(DeleteAssetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteAsset', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified channel. + * + * The async variant is {@see LivestreamServiceClient::deleteChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/delete_channel.php + * + * @param DeleteChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteChannel(DeleteChannelRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteChannel', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified event. + * + * The async variant is {@see LivestreamServiceClient::deleteEventAsync()} . + * + * @example samples/V1/LivestreamServiceClient/delete_event.php + * + * @param DeleteEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteEvent(DeleteEventRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteEvent', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified input. + * + * The async variant is {@see LivestreamServiceClient::deleteInputAsync()} . + * + * @example samples/V1/LivestreamServiceClient/delete_input.php + * + * @param DeleteInputRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteInput(DeleteInputRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteInput', $request, $callOptions)->wait(); + } + + /** + * Returns the specified asset. + * + * The async variant is {@see LivestreamServiceClient::getAssetAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_asset.php + * + * @param GetAssetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Asset + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAsset(GetAssetRequest $request, array $callOptions = []): Asset + { + return $this->startApiCall('GetAsset', $request, $callOptions)->wait(); + } + + /** + * Returns the specified channel. + * + * The async variant is {@see LivestreamServiceClient::getChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_channel.php + * + * @param GetChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Channel + * + * @throws ApiException Thrown if the API call fails. + */ + public function getChannel(GetChannelRequest $request, array $callOptions = []): Channel + { + return $this->startApiCall('GetChannel', $request, $callOptions)->wait(); + } + + /** + * Returns the specified event. + * + * The async variant is {@see LivestreamServiceClient::getEventAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_event.php + * + * @param GetEventRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Event + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEvent(GetEventRequest $request, array $callOptions = []): Event + { + return $this->startApiCall('GetEvent', $request, $callOptions)->wait(); + } + + /** + * Returns the specified input. + * + * The async variant is {@see LivestreamServiceClient::getInputAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_input.php + * + * @param GetInputRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Input + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInput(GetInputRequest $request, array $callOptions = []): Input + { + return $this->startApiCall('GetInput', $request, $callOptions)->wait(); + } + + /** + * Returns the specified pool. + * + * The async variant is {@see LivestreamServiceClient::getPoolAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_pool.php + * + * @param GetPoolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Pool + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPool(GetPoolRequest $request, array $callOptions = []): Pool + { + return $this->startApiCall('GetPool', $request, $callOptions)->wait(); + } + + /** + * Returns a list of all assets in the specified region. + * + * The async variant is {@see LivestreamServiceClient::listAssetsAsync()} . + * + * @example samples/V1/LivestreamServiceClient/list_assets.php + * + * @param ListAssetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listAssets(ListAssetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAssets', $request, $callOptions); + } + + /** + * Returns a list of all channels in the specified region. + * + * The async variant is {@see LivestreamServiceClient::listChannelsAsync()} . + * + * @example samples/V1/LivestreamServiceClient/list_channels.php + * + * @param ListChannelsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listChannels(ListChannelsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListChannels', $request, $callOptions); + } + + /** + * Returns a list of all events in the specified channel. + * + * The async variant is {@see LivestreamServiceClient::listEventsAsync()} . + * + * @example samples/V1/LivestreamServiceClient/list_events.php + * + * @param ListEventsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEvents(ListEventsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEvents', $request, $callOptions); + } + + /** + * Returns a list of all inputs in the specified region. + * + * The async variant is {@see LivestreamServiceClient::listInputsAsync()} . + * + * @example samples/V1/LivestreamServiceClient/list_inputs.php + * + * @param ListInputsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInputs(ListInputsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInputs', $request, $callOptions); + } + + /** + * Starts the specified channel. Part of the video pipeline will be created + * only when the StartChannel request is received by the server. + * + * The async variant is {@see LivestreamServiceClient::startChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/start_channel.php + * + * @param StartChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function startChannel(StartChannelRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('StartChannel', $request, $callOptions)->wait(); + } + + /** + * Stops the specified channel. Part of the video pipeline will be released + * when the StopChannel request is received by the server. + * + * The async variant is {@see LivestreamServiceClient::stopChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/stop_channel.php + * + * @param StopChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function stopChannel(StopChannelRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('StopChannel', $request, $callOptions)->wait(); + } + + /** + * Updates the specified channel. + * + * The async variant is {@see LivestreamServiceClient::updateChannelAsync()} . + * + * @example samples/V1/LivestreamServiceClient/update_channel.php + * + * @param UpdateChannelRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateChannel(UpdateChannelRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateChannel', $request, $callOptions)->wait(); + } + + /** + * Updates the specified input. + * + * The async variant is {@see LivestreamServiceClient::updateInputAsync()} . + * + * @example samples/V1/LivestreamServiceClient/update_input.php + * + * @param UpdateInputRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInput(UpdateInputRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateInput', $request, $callOptions)->wait(); + } + + /** + * Updates the specified pool. + * + * The async variant is {@see LivestreamServiceClient::updatePoolAsync()} . + * + * @example samples/V1/LivestreamServiceClient/update_pool.php + * + * @param UpdatePoolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updatePool(UpdatePoolRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdatePool', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see LivestreamServiceClient::getLocationAsync()} . + * + * @example samples/V1/LivestreamServiceClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see LivestreamServiceClient::listLocationsAsync()} . + * + * @example samples/V1/LivestreamServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/VideoLiveStream/v1/src/V1/Gapic/LivestreamServiceGapicClient.php b/owl-bot-staging/VideoLiveStream/v1/src/V1/Gapic/LivestreamServiceGapicClient.php new file mode 100644 index 00000000000..630cdb1c29f --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/src/V1/Gapic/LivestreamServiceGapicClient.php @@ -0,0 +1,2339 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $asset = new Asset(); + * $assetId = 'asset_id'; + * $operationResponse = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); + * $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 = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createAsset'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient}. + */ +class LivestreamServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.video.livestream.v1.LivestreamService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'livestream.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'livestream.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 static $assetNameTemplate; + + private static $channelNameTemplate; + + private static $eventNameTemplate; + + private static $inputNameTemplate; + + private static $locationNameTemplate; + + private static $networkNameTemplate; + + private static $poolNameTemplate; + + private static $secretVersionNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/livestream_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/livestream_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/livestream_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/livestream_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getAssetNameTemplate() + { + if (self::$assetNameTemplate == null) { + self::$assetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/assets/{asset}'); + } + + return self::$assetNameTemplate; + } + + private static function getChannelNameTemplate() + { + if (self::$channelNameTemplate == null) { + self::$channelNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}'); + } + + return self::$channelNameTemplate; + } + + private static function getEventNameTemplate() + { + if (self::$eventNameTemplate == null) { + self::$eventNameTemplate = new PathTemplate('projects/{project}/locations/{location}/channels/{channel}/events/{event}'); + } + + return self::$eventNameTemplate; + } + + private static function getInputNameTemplate() + { + if (self::$inputNameTemplate == null) { + self::$inputNameTemplate = new PathTemplate('projects/{project}/locations/{location}/inputs/{input}'); + } + + return self::$inputNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate('projects/{project}/global/networks/{network}'); + } + + return self::$networkNameTemplate; + } + + private static function getPoolNameTemplate() + { + if (self::$poolNameTemplate == null) { + self::$poolNameTemplate = new PathTemplate('projects/{project}/locations/{location}/pools/{pool}'); + } + + return self::$poolNameTemplate; + } + + private static function getSecretVersionNameTemplate() + { + if (self::$secretVersionNameTemplate == null) { + self::$secretVersionNameTemplate = new PathTemplate('projects/{project}/secrets/{secret}/versions/{version}'); + } + + return self::$secretVersionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'asset' => self::getAssetNameTemplate(), + 'channel' => self::getChannelNameTemplate(), + 'event' => self::getEventNameTemplate(), + 'input' => self::getInputNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + 'pool' => self::getPoolNameTemplate(), + 'secretVersion' => self::getSecretVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a asset + * resource. + * + * @param string $project + * @param string $location + * @param string $asset + * + * @return string The formatted asset resource. + */ + public static function assetName($project, $location, $asset) + { + return self::getAssetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'asset' => $asset, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a channel + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * + * @return string The formatted channel resource. + */ + public static function channelName($project, $location, $channel) + { + return self::getChannelNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a event + * resource. + * + * @param string $project + * @param string $location + * @param string $channel + * @param string $event + * + * @return string The formatted event resource. + */ + public static function eventName($project, $location, $channel, $event) + { + return self::getEventNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'channel' => $channel, + 'event' => $event, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a input + * resource. + * + * @param string $project + * @param string $location + * @param string $input + * + * @return string The formatted input resource. + */ + public static function inputName($project, $location, $input) + { + return self::getInputNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'input' => $input, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a pool + * resource. + * + * @param string $project + * @param string $location + * @param string $pool + * + * @return string The formatted pool resource. + */ + public static function poolName($project, $location, $pool) + { + return self::getPoolNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'pool' => $pool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + */ + public static function secretVersionName($project, $secret, $version) + { + return self::getSecretVersionNameTemplate()->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - asset: projects/{project}/locations/{location}/assets/{asset} + * - channel: projects/{project}/locations/{location}/channels/{channel} + * - event: projects/{project}/locations/{location}/channels/{channel}/events/{event} + * - input: projects/{project}/locations/{location}/inputs/{input} + * - location: projects/{project}/locations/{location} + * - network: projects/{project}/global/networks/{network} + * - pool: projects/{project}/locations/{location}/pools/{pool} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'livestream.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); + } + + /** + * Creates a Asset with the provided unique ID in the specified + * region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $asset = new Asset(); + * $assetId = 'asset_id'; + * $operationResponse = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); + * $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 = $livestreamServiceClient->createAsset($formattedParent, $asset, $assetId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createAsset'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param Asset $asset Required. The asset resource to be created. + * @param string $assetId Required. The ID of the asset resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 createAsset($parent, $asset, $assetId, array $optionalArgs = []) + { + $request = new CreateAssetRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAsset($asset); + $request->setAssetId($assetId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAsset', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a channel with the provided unique ID in the specified + * region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $channel = new Channel(); + * $channelId = 'channel_id'; + * $operationResponse = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId); + * $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 = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createChannel'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param Channel $channel Required. The channel resource to be created. + * @param string $channelId Required. The ID of the channel resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 createChannel($parent, $channel, $channelId, array $optionalArgs = []) + { + $request = new CreateChannelRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setChannel($channel); + $request->setChannelId($channelId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateChannel', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an event with the provided unique ID in the specified channel. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * $event = new Event(); + * $eventId = 'event_id'; + * $response = $livestreamServiceClient->createEvent($formattedParent, $event, $eventId); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @param Event $event Required. The event resource to be created. + * @param string $eventId Required. The ID of the event resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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\Video\LiveStream\V1\Event + * + * @throws ApiException if the remote call fails + */ + public function createEvent($parent, $event, $eventId, array $optionalArgs = []) + { + $request = new CreateEventRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setEvent($event); + $request->setEventId($eventId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateEvent', Event::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates an input with the provided unique ID in the specified region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $input = new Input(); + * $inputId = 'input_id'; + * $operationResponse = $livestreamServiceClient->createInput($formattedParent, $input, $inputId); + * $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 = $livestreamServiceClient->createInput($formattedParent, $input, $inputId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createInput'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param Input $input Required. The input resource to be created. + * @param string $inputId Required. The ID of the input resource to be created. + * This value must be 1-63 characters, begin and end with `[a-z0-9]`, + * could contain dashes (-) in between. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 createInput($parent, $input, $inputId, array $optionalArgs = []) + { + $request = new CreateInputRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInput($input); + $request->setInputId($inputId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInput', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified asset if it is not used. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + * $operationResponse = $livestreamServiceClient->deleteAsset($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $livestreamServiceClient->deleteAsset($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteAsset'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the asset resource, in the form of: + * `projects/{project}/locations/{location}/assets/{assetId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 deleteAsset($name, array $optionalArgs = []) + { + $request = new DeleteAssetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteAsset', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified channel. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * $operationResponse = $livestreamServiceClient->deleteChannel($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $livestreamServiceClient->deleteChannel($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteChannel'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @type bool $force + * If the `force` field is set to the default value of `false`, you must + * delete all of a channel's events before you can delete the channel itself. + * If the field is set to `true`, requests to delete a channel also delete + * associated channel events. + * @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 deleteChannel($name, array $optionalArgs = []) + { + $request = new DeleteChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteChannel', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified event. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + * $livestreamServiceClient->deleteEvent($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteEvent($name, array $optionalArgs = []) + { + $request = new DeleteEventRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteEvent', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified input. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + * $operationResponse = $livestreamServiceClient->deleteInput($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $livestreamServiceClient->deleteInput($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'deleteInput'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 deleteInput($name, array $optionalArgs = []) + { + $request = new DeleteInputRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteInput', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns the specified asset. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + * $response = $livestreamServiceClient->getAsset($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource, in the following form: + * `projects/{project}/locations/{location}/assets/{asset}`. + * @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\Cloud\Video\LiveStream\V1\Asset + * + * @throws ApiException if the remote call fails + */ + public function getAsset($name, array $optionalArgs = []) + { + $request = new GetAssetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAsset', Asset::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified channel. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * $response = $livestreamServiceClient->getChannel($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @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\Cloud\Video\LiveStream\V1\Channel + * + * @throws ApiException if the remote call fails + */ + public function getChannel($name, array $optionalArgs = []) + { + $request = new GetChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetChannel', Channel::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified event. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + * $response = $livestreamServiceClient->getEvent($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the event resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. + * @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\Cloud\Video\LiveStream\V1\Event + * + * @throws ApiException if the remote call fails + */ + public function getEvent($name, array $optionalArgs = []) + { + $request = new GetEventRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEvent', Event::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified input. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + * $response = $livestreamServiceClient->getInput($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the input resource, in the form of: + * `projects/{project}/locations/{location}/inputs/{inputId}`. + * @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\Cloud\Video\LiveStream\V1\Input + * + * @throws ApiException if the remote call fails + */ + public function getInput($name, array $optionalArgs = []) + { + $request = new GetInputRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInput', Input::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified pool. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + * $response = $livestreamServiceClient->getPool($formattedName); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the pool resource, in the form of: + * `projects/{project}/locations/{location}/pools/{poolId}`. + * @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\Cloud\Video\LiveStream\V1\Pool + * + * @throws ApiException if the remote call fails + */ + public function getPool($name, array $optionalArgs = []) + { + $request = new GetPoolRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPool', Pool::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of all assets in the specified region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $livestreamServiceClient->listAssets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $livestreamServiceClient->listAssets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAssets($parent, array $optionalArgs = []) + { + $request = new ListAssetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAssets', $optionalArgs, ListAssetsResponse::class, $request); + } + + /** + * Returns a list of all channels in the specified region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $livestreamServiceClient->listChannels($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $livestreamServiceClient->listChannels($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter to apply to list results. + * @type string $orderBy + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listChannels($parent, array $optionalArgs = []) + { + $request = new ListChannelsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListChannels', $optionalArgs, ListChannelsResponse::class, $request); + } + + /** + * Returns a list of all events in the specified channel. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * // Iterate over pages of elements + * $pagedResponse = $livestreamServiceClient->listEvents($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $livestreamServiceClient->listEvents($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent channel for the resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter to apply to list results. + * @type string $orderBy + * Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEvents($parent, array $optionalArgs = []) + { + $request = new ListEventsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEvents', $optionalArgs, ListEventsResponse::class, $request); + } + + /** + * Returns a list of all inputs in the specified region. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $livestreamServiceClient->listInputs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $livestreamServiceClient->listInputs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location for the resource, in the form of: + * `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter to apply to list results. + * @type string $orderBy + * Specifies the ordering of results following syntax at [Sorting + * Order](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInputs($parent, array $optionalArgs = []) + { + $request = new ListInputsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInputs', $optionalArgs, ListInputsResponse::class, $request); + } + + /** + * Starts the specified channel. Part of the video pipeline will be created + * only when the StartChannel request is received by the server. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * $operationResponse = $livestreamServiceClient->startChannel($formattedName); + * $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 = $livestreamServiceClient->startChannel($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'startChannel'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 startChannel($name, array $optionalArgs = []) + { + $request = new StartChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('StartChannel', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Stops the specified channel. Part of the video pipeline will be released + * when the StopChannel request is received by the server. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $formattedName = $livestreamServiceClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + * $operationResponse = $livestreamServiceClient->stopChannel($formattedName); + * $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 = $livestreamServiceClient->stopChannel($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'stopChannel'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the channel resource, in the form of: + * `projects/{project}/locations/{location}/channels/{channelId}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 stopChannel($name, array $optionalArgs = []) + { + $request = new StopChannelRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('StopChannel', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified channel. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $channel = new Channel(); + * $operationResponse = $livestreamServiceClient->updateChannel($channel); + * $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 = $livestreamServiceClient->updateChannel($channel); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updateChannel'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param Channel $channel Required. The channel resource to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the Channel + * resource by the update. You can only update the following fields: + * + * * [`inputAttachments`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputattachment) + * * [`inputConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#inputconfig) + * * [`output`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#output) + * * [`elementaryStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#elementarystream) + * * [`muxStreams`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#muxstream) + * * [`manifests`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#manifest) + * * [`spriteSheets`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#spritesheet) + * * [`logConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#logconfig) + * * [`timecodeConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#timecodeconfig) + * * [`encryptions`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#encryption) + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 updateChannel($channel, array $optionalArgs = []) + { + $request = new UpdateChannelRequest(); + $requestParamHeaders = []; + $request->setChannel($channel); + $requestParamHeaders['channel.name'] = $channel->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateChannel', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified input. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $input = new Input(); + * $operationResponse = $livestreamServiceClient->updateInput($input); + * $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 = $livestreamServiceClient->updateInput($input); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updateInput'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param Input $input Required. The input resource to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the Input + * resource by the update. You can only update the following fields: + * + * * [`preprocessingConfig`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#PreprocessingConfig) + * * [`securityRules`](https://cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.inputs#SecurityRule) + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * + * If the mask is not present, then each field from the list above is updated + * if the field appears in the request payload. To unset a field, add the + * field to the update mask and remove it from the request payload. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 updateInput($input, array $optionalArgs = []) + { + $request = new UpdateInputRequest(); + $requestParamHeaders = []; + $request->setInput($input); + $requestParamHeaders['input.name'] = $input->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInput', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified pool. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $pool = new Pool(); + * $operationResponse = $livestreamServiceClient->updatePool($pool); + * $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 = $livestreamServiceClient->updatePool($pool); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'updatePool'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param Pool $pool Required. The pool resource to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the Pool + * resource by the update. You can only update the following fields: + * + * * `networkConfig` + * + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 updatePool($pool, array $optionalArgs = []) + { + $request = new UpdatePoolRequest(); + $requestParamHeaders = []; + $request->setPool($pool); + $requestParamHeaders['pool.name'] = $pool->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdatePool', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * $response = $livestreamServiceClient->getLocation(); + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $livestreamServiceClient = new LivestreamServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $livestreamServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $livestreamServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $livestreamServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/VideoLiveStream/v1/src/V1/LivestreamServiceClient.php b/owl-bot-staging/VideoLiveStream/v1/src/V1/LivestreamServiceClient.php new file mode 100644 index 00000000000..dbb9bf87cea --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/src/V1/LivestreamServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.video.livestream.v1.LivestreamService' => [ + 'CreateAsset' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Asset', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateChannel' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Channel', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateInput' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Input', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAsset' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteChannel' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInput' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'StartChannel' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\ChannelOperationResponse', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'StopChannel' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\ChannelOperationResponse', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateChannel' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Channel', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'channel.name', + 'fieldAccessors' => [ + 'getChannel', + 'getName', + ], + ], + ], + ], + 'UpdateInput' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Input', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'input.name', + 'fieldAccessors' => [ + 'getInput', + 'getName', + ], + ], + ], + ], + 'UpdatePool' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\LiveStream\V1\Pool', + 'metadataReturnType' => '\Google\Cloud\Video\LiveStream\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'pool.name', + 'fieldAccessors' => [ + 'getPool', + 'getName', + ], + ], + ], + ], + 'CreateEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Event', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAsset' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Asset', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetChannel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Channel', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetEvent' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Event', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetInput' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Input', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\Pool', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAssets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAssets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\ListAssetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListChannels' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getChannels', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\ListChannelsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListEvents' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getEvents', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\ListEventsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListInputs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInputs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\LiveStream\V1\ListInputsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'asset' => 'projects/{project}/locations/{location}/assets/{asset}', + 'channel' => 'projects/{project}/locations/{location}/channels/{channel}', + 'event' => 'projects/{project}/locations/{location}/channels/{channel}/events/{event}', + 'input' => 'projects/{project}/locations/{location}/inputs/{input}', + 'location' => 'projects/{project}/locations/{location}', + 'network' => 'projects/{project}/global/networks/{network}', + 'pool' => 'projects/{project}/locations/{location}/pools/{pool}', + 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VideoLiveStream/v1/src/V1/resources/livestream_service_rest_client_config.php b/owl-bot-staging/VideoLiveStream/v1/src/V1/resources/livestream_service_rest_client_config.php new file mode 100644 index 00000000000..b5a5cb6bdf5 --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/src/V1/resources/livestream_service_rest_client_config.php @@ -0,0 +1,346 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.video.livestream.v1.LivestreamService' => [ + 'CreateAsset' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/assets', + 'body' => 'asset', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'asset_id', + ], + ], + 'CreateChannel' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/channels', + 'body' => 'channel', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'channel_id', + ], + ], + 'CreateEvent' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/channels/*}/events', + 'body' => 'event', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'event_id', + ], + ], + 'CreateInput' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/inputs', + 'body' => 'input', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'input_id', + ], + ], + 'DeleteAsset' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/assets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteChannel' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteEvent' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*/events/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInput' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/inputs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAsset' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/assets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetChannel' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetEvent' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*/events/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInput' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/inputs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPool' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/pools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAssets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/assets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListChannels' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/channels', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListEvents' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/channels/*}/events', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInputs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/inputs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'StartChannel' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*}:start', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StopChannel' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/channels/*}:stop', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateChannel' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{channel.name=projects/*/locations/*/channels/*}', + 'body' => 'channel', + 'placeholders' => [ + 'channel.name' => [ + 'getters' => [ + 'getChannel', + 'getName', + ], + ], + ], + ], + 'UpdateInput' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{input.name=projects/*/locations/*/inputs/*}', + 'body' => 'input', + 'placeholders' => [ + 'input.name' => [ + 'getters' => [ + 'getInput', + 'getName', + ], + ], + ], + ], + 'UpdatePool' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{pool.name=projects/*/locations/*/pools/*}', + 'body' => 'pool', + 'placeholders' => [ + 'pool.name' => [ + 'getters' => [ + 'getPool', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/Client/LivestreamServiceClientTest.php b/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/Client/LivestreamServiceClientTest.php new file mode 100644 index 00000000000..3540d462e8c --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/Client/LivestreamServiceClientTest.php @@ -0,0 +1,2454 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return LivestreamServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new LivestreamServiceClient($options); + } + + /** @test */ + public function createAssetTest() + { + $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/createAssetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $crc32c = 'crc32c-1352399984'; + $expectedResponse = new Asset(); + $expectedResponse->setName($name); + $expectedResponse->setCrc32c($crc32c); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAssetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $asset = new Asset(); + $assetId = 'assetId-373202742'; + $request = (new CreateAssetRequest()) + ->setParent($formattedParent) + ->setAsset($asset) + ->setAssetId($assetId); + $response = $gapicClient->createAsset($request); + $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.video.livestream.v1.LivestreamService/CreateAsset', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAsset(); + $this->assertProtobufEquals($asset, $actualValue); + $actualValue = $actualApiRequestObject->getAssetId(); + $this->assertProtobufEquals($assetId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAssetTest'); + $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 createAssetExceptionTest() + { + $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/createAssetTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $asset = new Asset(); + $assetId = 'assetId-373202742'; + $request = (new CreateAssetRequest()) + ->setParent($formattedParent) + ->setAsset($asset) + ->setAssetId($assetId); + $response = $gapicClient->createAsset($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAssetTest'); + 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 createChannelTest() + { + $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/createChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name); + $expectedResponse->setActiveInput($activeInput); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $channelId = 'channelId-1930808873'; + $request = (new CreateChannelRequest()) + ->setParent($formattedParent) + ->setChannel($channel) + ->setChannelId($channelId); + $response = $gapicClient->createChannel($request); + $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.video.livestream.v1.LivestreamService/CreateChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getChannel(); + $this->assertProtobufEquals($channel, $actualValue); + $actualValue = $actualApiRequestObject->getChannelId(); + $this->assertProtobufEquals($channelId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createChannelTest'); + $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 createChannelExceptionTest() + { + $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/createChannelTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $channelId = 'channelId-1930808873'; + $request = (new CreateChannelRequest()) + ->setParent($formattedParent) + ->setChannel($channel) + ->setChannelId($channelId); + $response = $gapicClient->createChannel($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createChannelTest'); + 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 createEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $executeNow = true; + $expectedResponse = new Event(); + $expectedResponse->setName($name); + $expectedResponse->setExecuteNow($executeNow); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $event = new Event(); + $eventId = 'eventId278118624'; + $request = (new CreateEventRequest()) + ->setParent($formattedParent) + ->setEvent($event) + ->setEventId($eventId); + $response = $gapicClient->createEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/CreateEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getEvent(); + $this->assertProtobufEquals($event, $actualValue); + $actualValue = $actualRequestObject->getEventId(); + $this->assertProtobufEquals($eventId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createEventExceptionTest() + { + $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 + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $event = new Event(); + $eventId = 'eventId278118624'; + $request = (new CreateEventRequest()) + ->setParent($formattedParent) + ->setEvent($event) + ->setEventId($eventId); + try { + $gapicClient->createEvent($request); + // 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()); + } + + /** @test */ + public function createInputTest() + { + $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/createInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $input = new Input(); + $inputId = 'inputId470715824'; + $request = (new CreateInputRequest()) + ->setParent($formattedParent) + ->setInput($input) + ->setInputId($inputId); + $response = $gapicClient->createInput($request); + $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.video.livestream.v1.LivestreamService/CreateInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getInputId(); + $this->assertProtobufEquals($inputId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInputTest'); + $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 createInputExceptionTest() + { + $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/createInputTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $input = new Input(); + $inputId = 'inputId470715824'; + $request = (new CreateInputRequest()) + ->setParent($formattedParent) + ->setInput($input) + ->setInputId($inputId); + $response = $gapicClient->createInput($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInputTest'); + 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 deleteAssetTest() + { + $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/deleteAssetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAssetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $request = (new DeleteAssetRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAsset($request); + $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.video.livestream.v1.LivestreamService/DeleteAsset', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); + $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 deleteAssetExceptionTest() + { + $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/deleteAssetTest'); + $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 + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $request = (new DeleteAssetRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteAsset($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); + 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 deleteChannelTest() + { + $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/deleteChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new DeleteChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteChannel($request); + $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.video.livestream.v1.LivestreamService/DeleteChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); + $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 deleteChannelExceptionTest() + { + $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/deleteChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new DeleteChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteChannel($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); + 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 deleteEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $request = (new DeleteEventRequest()) + ->setName($formattedName); + $gapicClient->deleteEvent($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/DeleteEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteEventExceptionTest() + { + $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 + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $request = (new DeleteEventRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteEvent($request); + // 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()); + } + + /** @test */ + public function deleteInputTest() + { + $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/deleteInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $request = (new DeleteInputRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteInput($request); + $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.video.livestream.v1.LivestreamService/DeleteInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInputTest'); + $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 deleteInputExceptionTest() + { + $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/deleteInputTest'); + $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 + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $request = (new DeleteInputRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteInput($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInputTest'); + 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 getAssetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $crc32c = 'crc32c-1352399984'; + $expectedResponse = new Asset(); + $expectedResponse->setName($name2); + $expectedResponse->setCrc32c($crc32c); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $request = (new GetAssetRequest()) + ->setName($formattedName); + $response = $gapicClient->getAsset($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetAsset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAssetExceptionTest() + { + $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 + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $request = (new GetAssetRequest()) + ->setName($formattedName); + try { + $gapicClient->getAsset($request); + // 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()); + } + + /** @test */ + public function getChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name2); + $expectedResponse->setActiveInput($activeInput); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new GetChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->getChannel($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getChannelExceptionTest() + { + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new GetChannelRequest()) + ->setName($formattedName); + try { + $gapicClient->getChannel($request); + // 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()); + } + + /** @test */ + public function getEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $executeNow = true; + $expectedResponse = new Event(); + $expectedResponse->setName($name2); + $expectedResponse->setExecuteNow($executeNow); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $request = (new GetEventRequest()) + ->setName($formattedName); + $response = $gapicClient->getEvent($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEventExceptionTest() + { + $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 + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $request = (new GetEventRequest()) + ->setName($formattedName); + try { + $gapicClient->getEvent($request); + // 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()); + } + + /** @test */ + public function getInputTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $request = (new GetInputRequest()) + ->setName($formattedName); + $response = $gapicClient->getInput($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetInput', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInputExceptionTest() + { + $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 + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $request = (new GetInputRequest()) + ->setName($formattedName); + try { + $gapicClient->getInput($request); + // 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()); + } + + /** @test */ + public function getPoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Pool(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + $request = (new GetPoolRequest()) + ->setName($formattedName); + $response = $gapicClient->getPool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetPool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPoolExceptionTest() + { + $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 + $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + $request = (new GetPoolRequest()) + ->setName($formattedName); + try { + $gapicClient->getPool($request); + // 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()); + } + + /** @test */ + public function listAssetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $assetsElement = new Asset(); + $assets = [ + $assetsElement, + ]; + $expectedResponse = new ListAssetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAssets($assets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAssetsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAssets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAssets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListAssets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAssetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListAssetsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAssets($request); + // 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()); + } + + /** @test */ + public function listChannelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $channelsElement = new Channel(); + $channels = [ + $channelsElement, + ]; + $expectedResponse = new ListChannelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setChannels($channels); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListChannelsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listChannels($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getChannels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListChannels', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listChannelsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListChannelsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listChannels($request); + // 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()); + } + + /** @test */ + public function listEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $eventsElement = new Event(); + $events = [ + $eventsElement, + ]; + $expectedResponse = new ListEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEvents($events); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new ListEventsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listEvents($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEventsExceptionTest() + { + $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 + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new ListEventsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listEvents($request); + // 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()); + } + + /** @test */ + public function listInputsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $inputsElement = new Input(); + $inputs = [ + $inputsElement, + ]; + $expectedResponse = new ListInputsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInputs($inputs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListInputsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInputs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInputs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListInputs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInputsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListInputsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInputs($request); + // 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()); + } + + /** @test */ + public function startChannelTest() + { + $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/startChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ChannelOperationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new StartChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->startChannel($request); + $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.video.livestream.v1.LivestreamService/StartChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startChannelTest'); + $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 startChannelExceptionTest() + { + $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/startChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new StartChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->startChannel($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startChannelTest'); + 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 stopChannelTest() + { + $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/stopChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ChannelOperationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/stopChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new StopChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->stopChannel($request); + $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.video.livestream.v1.LivestreamService/StopChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopChannelTest'); + $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 stopChannelExceptionTest() + { + $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/stopChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $request = (new StopChannelRequest()) + ->setName($formattedName); + $response = $gapicClient->stopChannel($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopChannelTest'); + 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 updateChannelTest() + { + $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/updateChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name); + $expectedResponse->setActiveInput($activeInput); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $request = (new UpdateChannelRequest()) + ->setChannel($channel); + $response = $gapicClient->updateChannel($request); + $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.video.livestream.v1.LivestreamService/UpdateChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getChannel(); + $this->assertProtobufEquals($channel, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateChannelTest'); + $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 updateChannelExceptionTest() + { + $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/updateChannelTest'); + $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 + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $request = (new UpdateChannelRequest()) + ->setChannel($channel); + $response = $gapicClient->updateChannel($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateChannelTest'); + 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 updateInputTest() + { + $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/updateInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new Input(); + $request = (new UpdateInputRequest()) + ->setInput($input); + $response = $gapicClient->updateInput($request); + $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.video.livestream.v1.LivestreamService/UpdateInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInputTest'); + $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 updateInputExceptionTest() + { + $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/updateInputTest'); + $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 + $input = new Input(); + $request = (new UpdateInputRequest()) + ->setInput($input); + $response = $gapicClient->updateInput($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInputTest'); + 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 updatePoolTest() + { + $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/updatePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new Pool(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $pool = new Pool(); + $request = (new UpdatePoolRequest()) + ->setPool($pool); + $response = $gapicClient->updatePool($request); + $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.video.livestream.v1.LivestreamService/UpdatePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPool(); + $this->assertProtobufEquals($pool, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePoolTest'); + $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 updatePoolExceptionTest() + { + $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/updatePoolTest'); + $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 + $pool = new Pool(); + $request = (new UpdatePoolRequest()) + ->setPool($pool); + $response = $gapicClient->updatePool($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePoolTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function createAssetAsyncTest() + { + $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/createAssetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $crc32c = 'crc32c-1352399984'; + $expectedResponse = new Asset(); + $expectedResponse->setName($name); + $expectedResponse->setCrc32c($crc32c); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAssetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $asset = new Asset(); + $assetId = 'assetId-373202742'; + $request = (new CreateAssetRequest()) + ->setParent($formattedParent) + ->setAsset($asset) + ->setAssetId($assetId); + $response = $gapicClient->createAssetAsync($request)->wait(); + $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.video.livestream.v1.LivestreamService/CreateAsset', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAsset(); + $this->assertProtobufEquals($asset, $actualValue); + $actualValue = $actualApiRequestObject->getAssetId(); + $this->assertProtobufEquals($assetId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAssetTest'); + $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()); + } +} diff --git a/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/LivestreamServiceClientTest.php b/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/LivestreamServiceClientTest.php new file mode 100644 index 00000000000..1813db775df --- /dev/null +++ b/owl-bot-staging/VideoLiveStream/v1/tests/Unit/V1/LivestreamServiceClientTest.php @@ -0,0 +1,2246 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return LivestreamServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new LivestreamServiceClient($options); + } + + /** @test */ + public function createAssetTest() + { + $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/createAssetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $crc32c = 'crc32c-1352399984'; + $expectedResponse = new Asset(); + $expectedResponse->setName($name); + $expectedResponse->setCrc32c($crc32c); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAssetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $asset = new Asset(); + $assetId = 'assetId-373202742'; + $response = $gapicClient->createAsset($formattedParent, $asset, $assetId); + $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.video.livestream.v1.LivestreamService/CreateAsset', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAsset(); + $this->assertProtobufEquals($asset, $actualValue); + $actualValue = $actualApiRequestObject->getAssetId(); + $this->assertProtobufEquals($assetId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAssetTest'); + $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 createAssetExceptionTest() + { + $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/createAssetTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $asset = new Asset(); + $assetId = 'assetId-373202742'; + $response = $gapicClient->createAsset($formattedParent, $asset, $assetId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAssetTest'); + 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 createChannelTest() + { + $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/createChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name); + $expectedResponse->setActiveInput($activeInput); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $channelId = 'channelId-1930808873'; + $response = $gapicClient->createChannel($formattedParent, $channel, $channelId); + $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.video.livestream.v1.LivestreamService/CreateChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getChannel(); + $this->assertProtobufEquals($channel, $actualValue); + $actualValue = $actualApiRequestObject->getChannelId(); + $this->assertProtobufEquals($channelId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createChannelTest'); + $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 createChannelExceptionTest() + { + $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/createChannelTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $channelId = 'channelId-1930808873'; + $response = $gapicClient->createChannel($formattedParent, $channel, $channelId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createChannelTest'); + 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 createEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $executeNow = true; + $expectedResponse = new Event(); + $expectedResponse->setName($name); + $expectedResponse->setExecuteNow($executeNow); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $event = new Event(); + $eventId = 'eventId278118624'; + $response = $gapicClient->createEvent($formattedParent, $event, $eventId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/CreateEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getEvent(); + $this->assertProtobufEquals($event, $actualValue); + $actualValue = $actualRequestObject->getEventId(); + $this->assertProtobufEquals($eventId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createEventExceptionTest() + { + $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 + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $event = new Event(); + $eventId = 'eventId278118624'; + try { + $gapicClient->createEvent($formattedParent, $event, $eventId); + // 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()); + } + + /** @test */ + public function createInputTest() + { + $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/createInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $input = new Input(); + $inputId = 'inputId470715824'; + $response = $gapicClient->createInput($formattedParent, $input, $inputId); + $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.video.livestream.v1.LivestreamService/CreateInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $actualValue = $actualApiRequestObject->getInputId(); + $this->assertProtobufEquals($inputId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInputTest'); + $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 createInputExceptionTest() + { + $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/createInputTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $input = new Input(); + $inputId = 'inputId470715824'; + $response = $gapicClient->createInput($formattedParent, $input, $inputId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInputTest'); + 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 deleteAssetTest() + { + $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/deleteAssetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteAssetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $response = $gapicClient->deleteAsset($formattedName); + $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.video.livestream.v1.LivestreamService/DeleteAsset', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); + $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 deleteAssetExceptionTest() + { + $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/deleteAssetTest'); + $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 + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $response = $gapicClient->deleteAsset($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteAssetTest'); + 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 deleteChannelTest() + { + $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/deleteChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->deleteChannel($formattedName); + $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.video.livestream.v1.LivestreamService/DeleteChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); + $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 deleteChannelExceptionTest() + { + $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/deleteChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->deleteChannel($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteChannelTest'); + 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 deleteEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $gapicClient->deleteEvent($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/DeleteEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteEventExceptionTest() + { + $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 + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + try { + $gapicClient->deleteEvent($formattedName); + // 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()); + } + + /** @test */ + public function deleteInputTest() + { + $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/deleteInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $response = $gapicClient->deleteInput($formattedName); + $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.video.livestream.v1.LivestreamService/DeleteInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInputTest'); + $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 deleteInputExceptionTest() + { + $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/deleteInputTest'); + $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 + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $response = $gapicClient->deleteInput($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInputTest'); + 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 getAssetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $crc32c = 'crc32c-1352399984'; + $expectedResponse = new Asset(); + $expectedResponse->setName($name2); + $expectedResponse->setCrc32c($crc32c); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + $response = $gapicClient->getAsset($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetAsset', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAssetExceptionTest() + { + $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 + $formattedName = $gapicClient->assetName('[PROJECT]', '[LOCATION]', '[ASSET]'); + try { + $gapicClient->getAsset($formattedName); + // 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()); + } + + /** @test */ + public function getChannelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name2); + $expectedResponse->setActiveInput($activeInput); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->getChannel($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetChannel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getChannelExceptionTest() + { + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + try { + $gapicClient->getChannel($formattedName); + // 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()); + } + + /** @test */ + public function getEventTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $executeNow = true; + $expectedResponse = new Event(); + $expectedResponse->setName($name2); + $expectedResponse->setExecuteNow($executeNow); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + $response = $gapicClient->getEvent($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetEvent', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEventExceptionTest() + { + $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 + $formattedName = $gapicClient->eventName('[PROJECT]', '[LOCATION]', '[CHANNEL]', '[EVENT]'); + try { + $gapicClient->getEvent($formattedName); + // 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()); + } + + /** @test */ + public function getInputTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + $response = $gapicClient->getInput($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetInput', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInputExceptionTest() + { + $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 + $formattedName = $gapicClient->inputName('[PROJECT]', '[LOCATION]', '[INPUT]'); + try { + $gapicClient->getInput($formattedName); + // 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()); + } + + /** @test */ + public function getPoolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Pool(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + $response = $gapicClient->getPool($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/GetPool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPoolExceptionTest() + { + $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 + $formattedName = $gapicClient->poolName('[PROJECT]', '[LOCATION]', '[POOL]'); + try { + $gapicClient->getPool($formattedName); + // 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()); + } + + /** @test */ + public function listAssetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $assetsElement = new Asset(); + $assets = [ + $assetsElement, + ]; + $expectedResponse = new ListAssetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAssets($assets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listAssets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAssets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListAssets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAssetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listAssets($formattedParent); + // 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()); + } + + /** @test */ + public function listChannelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $channelsElement = new Channel(); + $channels = [ + $channelsElement, + ]; + $expectedResponse = new ListChannelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setChannels($channels); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listChannels($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getChannels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListChannels', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listChannelsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listChannels($formattedParent); + // 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()); + } + + /** @test */ + public function listEventsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $eventsElement = new Event(); + $events = [ + $eventsElement, + ]; + $expectedResponse = new ListEventsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEvents($events); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->listEvents($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEvents()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListEvents', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEventsExceptionTest() + { + $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 + $formattedParent = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + try { + $gapicClient->listEvents($formattedParent); + // 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()); + } + + /** @test */ + public function listInputsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $inputsElement = new Input(); + $inputs = [ + $inputsElement, + ]; + $expectedResponse = new ListInputsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInputs($inputs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listInputs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInputs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.livestream.v1.LivestreamService/ListInputs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInputsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listInputs($formattedParent); + // 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()); + } + + /** @test */ + public function startChannelTest() + { + $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/startChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ChannelOperationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->startChannel($formattedName); + $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.video.livestream.v1.LivestreamService/StartChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startChannelTest'); + $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 startChannelExceptionTest() + { + $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/startChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->startChannel($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startChannelTest'); + 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 stopChannelTest() + { + $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/stopChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ChannelOperationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/stopChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->stopChannel($formattedName); + $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.video.livestream.v1.LivestreamService/StopChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopChannelTest'); + $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 stopChannelExceptionTest() + { + $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/stopChannelTest'); + $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 + $formattedName = $gapicClient->channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]'); + $response = $gapicClient->stopChannel($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/stopChannelTest'); + 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 updateChannelTest() + { + $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/updateChannelTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activeInput = 'activeInput1758551377'; + $expectedResponse = new Channel(); + $expectedResponse->setName($name); + $expectedResponse->setActiveInput($activeInput); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateChannelTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $response = $gapicClient->updateChannel($channel); + $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.video.livestream.v1.LivestreamService/UpdateChannel', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getChannel(); + $this->assertProtobufEquals($channel, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateChannelTest'); + $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 updateChannelExceptionTest() + { + $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/updateChannelTest'); + $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 + $channel = new Channel(); + $channelOutput = new Output(); + $channel->setOutput($channelOutput); + $response = $gapicClient->updateChannel($channel); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateChannelTest'); + 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 updateInputTest() + { + $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/updateInputTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Input(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInputTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $input = new Input(); + $response = $gapicClient->updateInput($input); + $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.video.livestream.v1.LivestreamService/UpdateInput', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInput(); + $this->assertProtobufEquals($input, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInputTest'); + $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 updateInputExceptionTest() + { + $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/updateInputTest'); + $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 + $input = new Input(); + $response = $gapicClient->updateInput($input); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInputTest'); + 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 updatePoolTest() + { + $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/updatePoolTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new Pool(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePoolTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $pool = new Pool(); + $response = $gapicClient->updatePool($pool); + $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.video.livestream.v1.LivestreamService/UpdatePool', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPool(); + $this->assertProtobufEquals($pool, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePoolTest'); + $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 updatePoolExceptionTest() + { + $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/updatePoolTest'); + $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 + $pool = new Pool(); + $response = $gapicClient->updatePool($pool); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePoolTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/AdTagDetails.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/AdTagDetails.php new file mode 100644 index 00000000000..c8f68cb7b75 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/AdTagDetails.php @@ -0,0 +1,52 @@ +internalAddGeneratedFile( + ' + +3google/cloud/video/stitcher/v1/ad_tag_details.protogoogle.cloud.video.stitcher.v1google/protobuf/duration.protogoogle/protobuf/struct.proto" +LiveAdTagDetail +name ( > + ad_requests ( 2).google.cloud.video.stitcher.v1.AdRequest:A +,videostitcher.googleapis.com/LiveAdTagDetailiprojects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}" +VodAdTagDetail +name ( > + ad_requests ( 2).google.cloud.video.stitcher.v1.AdRequest:A ++videostitcher.googleapis.com/VodAdTagDetaileprojects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail}" + AdRequest +uri ( I +request_metadata ( 2/.google.cloud.video.stitcher.v1.RequestMetadataK +response_metadata ( 20.google.cloud.video.stitcher.v1.ResponseMetadata"; +RequestMetadata( +headers ( 2.google.protobuf.Struct" +ResponseMetadata +error ( ( +headers ( 2.google.protobuf.Struct + status_code (  + +size_bytes (+ +duration ( 2.google.protobuf.Duration +body ( By +"com.google.cloud.video.stitcher.v1BAdTagDetailsProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/CdnKeys.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/CdnKeys.php new file mode 100644 index 00000000000..7da4b85eafa Binary files /dev/null and b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/CdnKeys.php differ diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Companions.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Companions.php new file mode 100644 index 00000000000..8295feed69c Binary files /dev/null and b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Companions.php differ diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Events.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Events.php new file mode 100644 index 00000000000..03acc1702d6 Binary files /dev/null and b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Events.php differ diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/LiveConfigs.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/LiveConfigs.php new file mode 100644 index 00000000000..5521f68d8b3 Binary files /dev/null and b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/LiveConfigs.php differ diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Sessions.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Sessions.php new file mode 100644 index 00000000000..dff4bef8862 Binary files /dev/null and b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Sessions.php differ diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Slates.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Slates.php new file mode 100644 index 00000000000..b64766ec351 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/Slates.php @@ -0,0 +1,37 @@ +internalAddGeneratedFile( + ' + ++google/cloud/video/stitcher/v1/slates.protogoogle.cloud.video.stitcher.v1google/api/resource.proto" +Slate +name ( BA +uri ( A + gam_slate ( 2..google.cloud.video.stitcher.v1.Slate.GamSlate@ +GamSlate + network_code ( BA + gam_slate_id (BA:_A\\ +"videostitcher.googleapis.com/Slate6projects/{project}/locations/{location}/slates/{slate}Bs +"com.google.cloud.video.stitcher.v1B SlatesProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/StitchDetails.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/StitchDetails.php new file mode 100644 index 00000000000..27b7f5f709f --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/StitchDetails.php @@ -0,0 +1,45 @@ +internalAddGeneratedFile( + ' + +3google/cloud/video/stitcher/v1/stitch_details.protogoogle.cloud.video.stitcher.v1google/api/resource.protogoogle/protobuf/duration.protogoogle/protobuf/struct.proto" +VodStitchDetail +name ( I +ad_stitch_details ( 2..google.cloud.video.stitcher.v1.AdStitchDetail:A +,videostitcher.googleapis.com/VodStitchDetailfprojects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail}" +AdStitchDetail + ad_break_id ( BA +ad_id ( BA6 +ad_time_offset ( 2.google.protobuf.DurationBA + skip_reason ( BAM +media ( 29.google.cloud.video.stitcher.v1.AdStitchDetail.MediaEntryBAD + +MediaEntry +key ( % +value ( 2.google.protobuf.Value:8Bz +"com.google.cloud.video.stitcher.v1BStitchDetailsProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/VideoStitcherService.php b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/VideoStitcherService.php new file mode 100644 index 00000000000..cd0a93d3172 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/GPBMetadata/Google/Cloud/Video/Stitcher/V1/VideoStitcherService.php @@ -0,0 +1,199 @@ +internalAddGeneratedFile( + ' +O +;google/cloud/video/stitcher/v1/video_stitcher_service.protogoogle.cloud.video.stitcher.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto3google/cloud/video/stitcher/v1/ad_tag_details.proto-google/cloud/video/stitcher/v1/cdn_keys.proto1google/cloud/video/stitcher/v1/live_configs.proto-google/cloud/video/stitcher/v1/sessions.proto+google/cloud/video/stitcher/v1/slates.proto3google/cloud/video/stitcher/v1/stitch_details.proto#google/longrunning/operations.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto" +CreateCdnKeyRequest; +parent ( B+AA%#videostitcher.googleapis.com/CdnKey< +cdn_key ( 2&.google.cloud.video.stitcher.v1.CdnKeyBA + +cdn_key_id ( BA" +ListCdnKeysRequest; +parent ( B+AA%#videostitcher.googleapis.com/CdnKey + page_size ( + +page_token (  +filter (  +order_by ( "} +ListCdnKeysResponse8 +cdn_keys ( 2&.google.cloud.video.stitcher.v1.CdnKey +next_page_token (  + unreachable ( "M +GetCdnKeyRequest9 +name ( B+AA% +#videostitcher.googleapis.com/CdnKey"P +DeleteCdnKeyRequest9 +name ( B+AA% +#videostitcher.googleapis.com/CdnKey" +UpdateCdnKeyRequest< +cdn_key ( 2&.google.cloud.video.stitcher.v1.CdnKeyBA4 + update_mask ( 2.google.protobuf.FieldMaskBA" +CreateVodSessionRequest? +parent ( B/AA)\'videostitcher.googleapis.com/VodSessionD + vod_session ( 2*.google.cloud.video.stitcher.v1.VodSessionBA"U +GetVodSessionRequest= +name ( B/AA) +\'videostitcher.googleapis.com/VodSession" +ListVodStitchDetailsRequestD +parent ( B4AA.,videostitcher.googleapis.com/VodStitchDetail + page_size ( + +page_token ( " +ListVodStitchDetailsResponseK +vod_stitch_details ( 2/.google.cloud.video.stitcher.v1.VodStitchDetail +next_page_token ( "_ +GetVodStitchDetailRequestB +name ( B4AA. +,videostitcher.googleapis.com/VodStitchDetail" +ListVodAdTagDetailsRequestC +parent ( B3AA-+videostitcher.googleapis.com/VodAdTagDetail + page_size ( + +page_token ( " +ListVodAdTagDetailsResponseJ +vod_ad_tag_details ( 2..google.cloud.video.stitcher.v1.VodAdTagDetail +next_page_token ( "] +GetVodAdTagDetailRequestA +name ( B3AA- ++videostitcher.googleapis.com/VodAdTagDetail" +ListLiveAdTagDetailsRequestD +parent ( B4AA.,videostitcher.googleapis.com/LiveAdTagDetail + page_size ( + +page_token ( " +ListLiveAdTagDetailsResponseL +live_ad_tag_details ( 2/.google.cloud.video.stitcher.v1.LiveAdTagDetail +next_page_token ( "_ +GetLiveAdTagDetailRequestB +name ( B4AA. +,videostitcher.googleapis.com/LiveAdTagDetail" +CreateSlateRequest: +parent ( B*AA$"videostitcher.googleapis.com/Slate +slate_id ( BA9 +slate ( 2%.google.cloud.video.stitcher.v1.SlateBA + +request_id ( "K +GetSlateRequest8 +name ( B*AA$ +"videostitcher.googleapis.com/Slate" +ListSlatesRequest: +parent ( B*AA$"videostitcher.googleapis.com/Slate + page_size ( + +page_token (  +filter (  +order_by ( "y +ListSlatesResponse5 +slates ( 2%.google.cloud.video.stitcher.v1.Slate +next_page_token (  + unreachable ( " +UpdateSlateRequest9 +slate ( 2%.google.cloud.video.stitcher.v1.SlateBA4 + update_mask ( 2.google.protobuf.FieldMaskBA"N +DeleteSlateRequest8 +name ( B*AA$ +"videostitcher.googleapis.com/Slate" +CreateLiveSessionRequest@ +parent ( B0AA*(videostitcher.googleapis.com/LiveSessionF + live_session ( 2+.google.cloud.video.stitcher.v1.LiveSessionBA"W +GetLiveSessionRequest> +name ( B0AA* +(videostitcher.googleapis.com/LiveSession" +CreateLiveConfigRequest? +parent ( B/AA)\'videostitcher.googleapis.com/LiveConfig +live_config_id ( BAD + live_config ( 2*.google.cloud.video.stitcher.v1.LiveConfigBA + +request_id ( " +ListLiveConfigsRequest? +parent ( B/AA)\'videostitcher.googleapis.com/LiveConfig + page_size ( + +page_token (  +filter ( BA +order_by ( BA" +ListLiveConfigsResponse@ + live_configs ( 2*.google.cloud.video.stitcher.v1.LiveConfig +next_page_token (  + unreachable ( "U +GetLiveConfigRequest= +name ( B/AA) +\'videostitcher.googleapis.com/LiveConfig"X +DeleteLiveConfigRequest= +name ( B/AA) +\'videostitcher.googleapis.com/LiveConfig" +OperationMetadata/ + create_time ( 2.google.protobuf.Timestamp, +end_time ( 2.google.protobuf.Timestamp +target (  +verb ( 2* +VideoStitcherService + CreateCdnKey3.google.cloud.video.stitcher.v1.CreateCdnKeyRequest.google.longrunning.Operation"AY +%google.cloud.video.stitcher.v1.CdnKey0google.cloud.video.stitcher.v1.OperationMetadataAparent,cdn_key,cdn_key_id6"+/v1/{parent=projects/*/locations/*}/cdnKeys:cdn_key + ListCdnKeys2.google.cloud.video.stitcher.v1.ListCdnKeysRequest3.google.cloud.video.stitcher.v1.ListCdnKeysResponse"23/v1/{cdn_key.name=projects/*/locations/*/cdnKeys/*}:cdn_key +CreateVodSession7.google.cloud.video.stitcher.v1.CreateVodSessionRequest*.google.cloud.video.stitcher.v1.VodSession"YAparent,vod_session>"//v1/{parent=projects/*/locations/*}/vodSessions: vod_session + GetVodSession4.google.cloud.video.stitcher.v1.GetVodSessionRequest*.google.cloud.video.stitcher.v1.VodSession">Aname1//v1/{name=projects/*/locations/*/vodSessions/*} +ListVodStitchDetails;.google.cloud.video.stitcher.v1.ListVodStitchDetailsRequest<.google.cloud.video.stitcher.v1.ListVodStitchDetailsResponse"SAparentDB/v1/{parent=projects/*/locations/*/vodSessions/*}/vodStitchDetails +GetVodStitchDetail9.google.cloud.video.stitcher.v1.GetVodStitchDetailRequest/.google.cloud.video.stitcher.v1.VodStitchDetail"QAnameDB/v1/{name=projects/*/locations/*/vodSessions/*/vodStitchDetails/*} +ListVodAdTagDetails:.google.cloud.video.stitcher.v1.ListVodAdTagDetailsRequest;.google.cloud.video.stitcher.v1.ListVodAdTagDetailsResponse"RAparentCA/v1/{parent=projects/*/locations/*/vodSessions/*}/vodAdTagDetails +GetVodAdTagDetail8.google.cloud.video.stitcher.v1.GetVodAdTagDetailRequest..google.cloud.video.stitcher.v1.VodAdTagDetail"PAnameCA/v1/{name=projects/*/locations/*/vodSessions/*/vodAdTagDetails/*} +ListLiveAdTagDetails;.google.cloud.video.stitcher.v1.ListLiveAdTagDetailsRequest<.google.cloud.video.stitcher.v1.ListLiveAdTagDetailsResponse"TAparentEC/v1/{parent=projects/*/locations/*/liveSessions/*}/liveAdTagDetails +GetLiveAdTagDetail9.google.cloud.video.stitcher.v1.GetLiveAdTagDetailRequest/.google.cloud.video.stitcher.v1.LiveAdTagDetail"RAnameEC/v1/{name=projects/*/locations/*/liveSessions/*/liveAdTagDetails/*} + CreateSlate2.google.cloud.video.stitcher.v1.CreateSlateRequest.google.longrunning.Operation"AX +$google.cloud.video.stitcher.v1.Slate0google.cloud.video.stitcher.v1.OperationMetadataAparent,slate,slate_id3"*/v1/{parent=projects/*/locations/*}/slates:slate + +ListSlates1.google.cloud.video.stitcher.v1.ListSlatesRequest2.google.cloud.video.stitcher.v1.ListSlatesResponse";Aparent,*/v1/{parent=projects/*/locations/*}/slates +GetSlate/.google.cloud.video.stitcher.v1.GetSlateRequest%.google.cloud.video.stitcher.v1.Slate"9Aname,*/v1/{name=projects/*/locations/*/slates/*} + UpdateSlate2.google.cloud.video.stitcher.v1.UpdateSlateRequest.google.longrunning.Operation"AX +$google.cloud.video.stitcher.v1.Slate0google.cloud.video.stitcher.v1.OperationMetadataAslate,update_mask920/v1/{slate.name=projects/*/locations/*/slates/*}:slate + DeleteSlate2.google.cloud.video.stitcher.v1.DeleteSlateRequest.google.longrunning.Operation"AI +google.protobuf.Empty0google.cloud.video.stitcher.v1.OperationMetadataAname,**/v1/{name=projects/*/locations/*/slates/*} +CreateLiveSession8.google.cloud.video.stitcher.v1.CreateLiveSessionRequest+.google.cloud.video.stitcher.v1.LiveSession"\\Aparent,live_session@"0/v1/{parent=projects/*/locations/*}/liveSessions: live_session +GetLiveSession5.google.cloud.video.stitcher.v1.GetLiveSessionRequest+.google.cloud.video.stitcher.v1.LiveSession"?Aname20/v1/{name=projects/*/locations/*/liveSessions/*} +CreateLiveConfig7.google.cloud.video.stitcher.v1.CreateLiveConfigRequest.google.longrunning.Operation"A] +)google.cloud.video.stitcher.v1.LiveConfig0google.cloud.video.stitcher.v1.OperationMetadataA!parent,live_config,live_config_id>"//v1/{parent=projects/*/locations/*}/liveConfigs: live_config +ListLiveConfigs6.google.cloud.video.stitcher.v1.ListLiveConfigsRequest7.google.cloud.video.stitcher.v1.ListLiveConfigsResponse"@Aparent1//v1/{parent=projects/*/locations/*}/liveConfigs + GetLiveConfig4.google.cloud.video.stitcher.v1.GetLiveConfigRequest*.google.cloud.video.stitcher.v1.LiveConfig">Aname1//v1/{name=projects/*/locations/*/liveConfigs/*} +DeleteLiveConfig7.google.cloud.video.stitcher.v1.DeleteLiveConfigRequest.google.longrunning.Operation"AI +google.protobuf.Empty0google.cloud.video.stitcher.v1.OperationMetadataAname1*//v1/{name=projects/*/locations/*/liveConfigs/*}PAvideostitcher.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +"com.google.cloud.video.stitcher.v1BVideoStitcherServiceProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdRequest.php new file mode 100644 index 00000000000..37e899db9a1 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdRequest.php @@ -0,0 +1,155 @@ +google.cloud.video.stitcher.v1.AdRequest + */ +class AdRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The ad tag URI processed with integrated macros. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * The request metadata used to make the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.RequestMetadata request_metadata = 2; + */ + protected $request_metadata = null; + /** + * The response metadata received from the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ResponseMetadata response_metadata = 3; + */ + protected $response_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * The ad tag URI processed with integrated macros. + * @type \Google\Cloud\Video\Stitcher\V1\RequestMetadata $request_metadata + * The request metadata used to make the ad request. + * @type \Google\Cloud\Video\Stitcher\V1\ResponseMetadata $response_metadata + * The response metadata received from the ad request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); + parent::__construct($data); + } + + /** + * The ad tag URI processed with integrated macros. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The ad tag URI processed with integrated macros. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * The request metadata used to make the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.RequestMetadata request_metadata = 2; + * @return \Google\Cloud\Video\Stitcher\V1\RequestMetadata|null + */ + public function getRequestMetadata() + { + return $this->request_metadata; + } + + public function hasRequestMetadata() + { + return isset($this->request_metadata); + } + + public function clearRequestMetadata() + { + unset($this->request_metadata); + } + + /** + * The request metadata used to make the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.RequestMetadata request_metadata = 2; + * @param \Google\Cloud\Video\Stitcher\V1\RequestMetadata $var + * @return $this + */ + public function setRequestMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\RequestMetadata::class); + $this->request_metadata = $var; + + return $this; + } + + /** + * The response metadata received from the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ResponseMetadata response_metadata = 3; + * @return \Google\Cloud\Video\Stitcher\V1\ResponseMetadata|null + */ + public function getResponseMetadata() + { + return $this->response_metadata; + } + + public function hasResponseMetadata() + { + return isset($this->response_metadata); + } + + public function clearResponseMetadata() + { + unset($this->response_metadata); + } + + /** + * The response metadata received from the ad request. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ResponseMetadata response_metadata = 3; + * @param \Google\Cloud\Video\Stitcher\V1\ResponseMetadata $var + * @return $this + */ + public function setResponseMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\ResponseMetadata::class); + $this->response_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdStitchDetail.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdStitchDetail.php new file mode 100644 index 00000000000..33dc179495c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdStitchDetail.php @@ -0,0 +1,213 @@ +google.cloud.video.stitcher.v1.AdStitchDetail + */ +class AdStitchDetail extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ad break ID of the processed ad. + * + * Generated from protobuf field string ad_break_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_break_id = ''; + /** + * Required. The ad ID of the processed ad. + * + * Generated from protobuf field string ad_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_id = ''; + /** + * Required. The time offset of the processed ad. + * + * Generated from protobuf field .google.protobuf.Duration ad_time_offset = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_time_offset = null; + /** + * Optional. Indicates the reason why the ad has been skipped. + * + * Generated from protobuf field string skip_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $skip_reason = ''; + /** + * Optional. The metadata of the chosen media file for the ad. + * + * Generated from protobuf field map media = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $media; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ad_break_id + * Required. The ad break ID of the processed ad. + * @type string $ad_id + * Required. The ad ID of the processed ad. + * @type \Google\Protobuf\Duration $ad_time_offset + * Required. The time offset of the processed ad. + * @type string $skip_reason + * Optional. Indicates the reason why the ad has been skipped. + * @type array|\Google\Protobuf\Internal\MapField $media + * Optional. The metadata of the chosen media file for the ad. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\StitchDetails::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ad break ID of the processed ad. + * + * Generated from protobuf field string ad_break_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAdBreakId() + { + return $this->ad_break_id; + } + + /** + * Required. The ad break ID of the processed ad. + * + * Generated from protobuf field string ad_break_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAdBreakId($var) + { + GPBUtil::checkString($var, True); + $this->ad_break_id = $var; + + return $this; + } + + /** + * Required. The ad ID of the processed ad. + * + * Generated from protobuf field string ad_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAdId() + { + return $this->ad_id; + } + + /** + * Required. The ad ID of the processed ad. + * + * Generated from protobuf field string ad_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAdId($var) + { + GPBUtil::checkString($var, True); + $this->ad_id = $var; + + return $this; + } + + /** + * Required. The time offset of the processed ad. + * + * Generated from protobuf field .google.protobuf.Duration ad_time_offset = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getAdTimeOffset() + { + return $this->ad_time_offset; + } + + public function hasAdTimeOffset() + { + return isset($this->ad_time_offset); + } + + public function clearAdTimeOffset() + { + unset($this->ad_time_offset); + } + + /** + * Required. The time offset of the processed ad. + * + * Generated from protobuf field .google.protobuf.Duration ad_time_offset = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setAdTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->ad_time_offset = $var; + + return $this; + } + + /** + * Optional. Indicates the reason why the ad has been skipped. + * + * Generated from protobuf field string skip_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSkipReason() + { + return $this->skip_reason; + } + + /** + * Optional. Indicates the reason why the ad has been skipped. + * + * Generated from protobuf field string skip_reason = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSkipReason($var) + { + GPBUtil::checkString($var, True); + $this->skip_reason = $var; + + return $this; + } + + /** + * Optional. The metadata of the chosen media file for the ad. + * + * Generated from protobuf field map media = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMedia() + { + return $this->media; + } + + /** + * Optional. The metadata of the chosen media file for the ad. + * + * Generated from protobuf field map media = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMedia($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->media = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdTracking.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdTracking.php new file mode 100644 index 00000000000..aa08c7d30db --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AdTracking.php @@ -0,0 +1,63 @@ +google.cloud.video.stitcher.v1.AdTracking + */ +class AdTracking +{ + /** + * The ad tracking policy is not specified. + * + * Generated from protobuf enum AD_TRACKING_UNSPECIFIED = 0; + */ + const AD_TRACKING_UNSPECIFIED = 0; + /** + * Client-side ad tracking is specified. The client player is expected to + * trigger playback and activity events itself. + * + * Generated from protobuf enum CLIENT = 1; + */ + const CLIENT = 1; + /** + * The Video Stitcher API will trigger playback events on behalf of + * the client player. + * + * Generated from protobuf enum SERVER = 2; + */ + const SERVER = 2; + + private static $valueToName = [ + self::AD_TRACKING_UNSPECIFIED => 'AD_TRACKING_UNSPECIFIED', + self::CLIENT => 'CLIENT', + self::SERVER => 'SERVER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AkamaiCdnKey.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AkamaiCdnKey.php new file mode 100644 index 00000000000..910d74fe086 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/AkamaiCdnKey.php @@ -0,0 +1,67 @@ +google.cloud.video.stitcher.v1.AkamaiCdnKey + */ +class AkamaiCdnKey extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. Token key for the Akamai CDN edge configuration. + * + * Generated from protobuf field bytes token_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $token_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $token_key + * Input only. Token key for the Akamai CDN edge configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\CdnKeys::initOnce(); + parent::__construct($data); + } + + /** + * Input only. Token key for the Akamai CDN edge configuration. + * + * Generated from protobuf field bytes token_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getTokenKey() + { + return $this->token_key; + } + + /** + * Input only. Token key for the Akamai CDN edge configuration. + * + * Generated from protobuf field bytes token_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTokenKey($var) + { + GPBUtil::checkString($var, False); + $this->token_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CdnKey.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CdnKey.php new file mode 100644 index 00000000000..c5c9fc8a703 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CdnKey.php @@ -0,0 +1,219 @@ +google.cloud.video.stitcher.v1.CdnKey + */ +class CdnKey extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the CDN key, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * The name is ignored when creating a CDN key. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The hostname this key applies to. + * + * Generated from protobuf field string hostname = 4; + */ + protected $hostname = ''; + protected $cdn_key_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Stitcher\V1\GoogleCdnKey $google_cdn_key + * The configuration for a Google Cloud CDN key. + * @type \Google\Cloud\Video\Stitcher\V1\AkamaiCdnKey $akamai_cdn_key + * The configuration for an Akamai CDN key. + * @type \Google\Cloud\Video\Stitcher\V1\MediaCdnKey $media_cdn_key + * The configuration for a Media CDN key. + * @type string $name + * The resource name of the CDN key, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * The name is ignored when creating a CDN key. + * @type string $hostname + * The hostname this key applies to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\CdnKeys::initOnce(); + parent::__construct($data); + } + + /** + * The configuration for a Google Cloud CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GoogleCdnKey google_cdn_key = 5; + * @return \Google\Cloud\Video\Stitcher\V1\GoogleCdnKey|null + */ + public function getGoogleCdnKey() + { + return $this->readOneof(5); + } + + public function hasGoogleCdnKey() + { + return $this->hasOneof(5); + } + + /** + * The configuration for a Google Cloud CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GoogleCdnKey google_cdn_key = 5; + * @param \Google\Cloud\Video\Stitcher\V1\GoogleCdnKey $var + * @return $this + */ + public function setGoogleCdnKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\GoogleCdnKey::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The configuration for an Akamai CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AkamaiCdnKey akamai_cdn_key = 6; + * @return \Google\Cloud\Video\Stitcher\V1\AkamaiCdnKey|null + */ + public function getAkamaiCdnKey() + { + return $this->readOneof(6); + } + + public function hasAkamaiCdnKey() + { + return $this->hasOneof(6); + } + + /** + * The configuration for an Akamai CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AkamaiCdnKey akamai_cdn_key = 6; + * @param \Google\Cloud\Video\Stitcher\V1\AkamaiCdnKey $var + * @return $this + */ + public function setAkamaiCdnKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\AkamaiCdnKey::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * The configuration for a Media CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.MediaCdnKey media_cdn_key = 8; + * @return \Google\Cloud\Video\Stitcher\V1\MediaCdnKey|null + */ + public function getMediaCdnKey() + { + return $this->readOneof(8); + } + + public function hasMediaCdnKey() + { + return $this->hasOneof(8); + } + + /** + * The configuration for a Media CDN key. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.MediaCdnKey media_cdn_key = 8; + * @param \Google\Cloud\Video\Stitcher\V1\MediaCdnKey $var + * @return $this + */ + public function setMediaCdnKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\MediaCdnKey::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The resource name of the CDN key, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * The name is ignored when creating a CDN key. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the CDN key, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * The name is ignored when creating a CDN key. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The hostname this key applies to. + * + * Generated from protobuf field string hostname = 4; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * The hostname this key applies to. + * + * Generated from protobuf field string hostname = 4; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + + /** + * @return string + */ + public function getCdnKeyConfig() + { + return $this->whichOneof("cdn_key_config"); + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Companion.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Companion.php new file mode 100644 index 00000000000..6acf2dce062 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Companion.php @@ -0,0 +1,455 @@ +google.cloud.video.stitcher.v1.Companion + */ +class Companion extends \Google\Protobuf\Internal\Message +{ + /** + * The API necessary to communicate with the creative if available. + * + * Generated from protobuf field string api_framework = 1; + */ + protected $api_framework = ''; + /** + * The pixel height of the placement slot for the intended creative. + * + * Generated from protobuf field int32 height_px = 2; + */ + protected $height_px = 0; + /** + * The pixel width of the placement slot for the intended creative. + * + * Generated from protobuf field int32 width_px = 3; + */ + protected $width_px = 0; + /** + * The pixel height of the creative. + * + * Generated from protobuf field int32 asset_height_px = 4; + */ + protected $asset_height_px = 0; + /** + * The maximum pixel height of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_height_px = 5; + */ + protected $expanded_height_px = 0; + /** + * The pixel width of the creative. + * + * Generated from protobuf field int32 asset_width_px = 6; + */ + protected $asset_width_px = 0; + /** + * The maximum pixel width of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_width_px = 7; + */ + protected $expanded_width_px = 0; + /** + * The ID used to identify the desired placement on a publisher's page. + * Values to be used should be discussed between publishers and + * advertisers. + * + * Generated from protobuf field string ad_slot_id = 8; + */ + protected $ad_slot_id = ''; + /** + * The list of tracking events for the companion. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 9; + */ + private $events; + protected $ad_resource; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Stitcher\V1\IframeAdResource $iframe_ad_resource + * The IFrame ad resource associated with the companion ad. + * @type \Google\Cloud\Video\Stitcher\V1\StaticAdResource $static_ad_resource + * The static ad resource associated with the companion ad. + * @type \Google\Cloud\Video\Stitcher\V1\HtmlAdResource $html_ad_resource + * The HTML ad resource associated with the companion ad. + * @type string $api_framework + * The API necessary to communicate with the creative if available. + * @type int $height_px + * The pixel height of the placement slot for the intended creative. + * @type int $width_px + * The pixel width of the placement slot for the intended creative. + * @type int $asset_height_px + * The pixel height of the creative. + * @type int $expanded_height_px + * The maximum pixel height of the creative in its expanded state. + * @type int $asset_width_px + * The pixel width of the creative. + * @type int $expanded_width_px + * The maximum pixel width of the creative in its expanded state. + * @type string $ad_slot_id + * The ID used to identify the desired placement on a publisher's page. + * Values to be used should be discussed between publishers and + * advertisers. + * @type array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $events + * The list of tracking events for the companion. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Companions::initOnce(); + parent::__construct($data); + } + + /** + * The IFrame ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.IframeAdResource iframe_ad_resource = 10; + * @return \Google\Cloud\Video\Stitcher\V1\IframeAdResource|null + */ + public function getIframeAdResource() + { + return $this->readOneof(10); + } + + public function hasIframeAdResource() + { + return $this->hasOneof(10); + } + + /** + * The IFrame ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.IframeAdResource iframe_ad_resource = 10; + * @param \Google\Cloud\Video\Stitcher\V1\IframeAdResource $var + * @return $this + */ + public function setIframeAdResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\IframeAdResource::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * The static ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.StaticAdResource static_ad_resource = 11; + * @return \Google\Cloud\Video\Stitcher\V1\StaticAdResource|null + */ + public function getStaticAdResource() + { + return $this->readOneof(11); + } + + public function hasStaticAdResource() + { + return $this->hasOneof(11); + } + + /** + * The static ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.StaticAdResource static_ad_resource = 11; + * @param \Google\Cloud\Video\Stitcher\V1\StaticAdResource $var + * @return $this + */ + public function setStaticAdResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\StaticAdResource::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * The HTML ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.HtmlAdResource html_ad_resource = 12; + * @return \Google\Cloud\Video\Stitcher\V1\HtmlAdResource|null + */ + public function getHtmlAdResource() + { + return $this->readOneof(12); + } + + public function hasHtmlAdResource() + { + return $this->hasOneof(12); + } + + /** + * The HTML ad resource associated with the companion ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.HtmlAdResource html_ad_resource = 12; + * @param \Google\Cloud\Video\Stitcher\V1\HtmlAdResource $var + * @return $this + */ + public function setHtmlAdResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\HtmlAdResource::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * The API necessary to communicate with the creative if available. + * + * Generated from protobuf field string api_framework = 1; + * @return string + */ + public function getApiFramework() + { + return $this->api_framework; + } + + /** + * The API necessary to communicate with the creative if available. + * + * Generated from protobuf field string api_framework = 1; + * @param string $var + * @return $this + */ + public function setApiFramework($var) + { + GPBUtil::checkString($var, True); + $this->api_framework = $var; + + return $this; + } + + /** + * The pixel height of the placement slot for the intended creative. + * + * Generated from protobuf field int32 height_px = 2; + * @return int + */ + public function getHeightPx() + { + return $this->height_px; + } + + /** + * The pixel height of the placement slot for the intended creative. + * + * Generated from protobuf field int32 height_px = 2; + * @param int $var + * @return $this + */ + public function setHeightPx($var) + { + GPBUtil::checkInt32($var); + $this->height_px = $var; + + return $this; + } + + /** + * The pixel width of the placement slot for the intended creative. + * + * Generated from protobuf field int32 width_px = 3; + * @return int + */ + public function getWidthPx() + { + return $this->width_px; + } + + /** + * The pixel width of the placement slot for the intended creative. + * + * Generated from protobuf field int32 width_px = 3; + * @param int $var + * @return $this + */ + public function setWidthPx($var) + { + GPBUtil::checkInt32($var); + $this->width_px = $var; + + return $this; + } + + /** + * The pixel height of the creative. + * + * Generated from protobuf field int32 asset_height_px = 4; + * @return int + */ + public function getAssetHeightPx() + { + return $this->asset_height_px; + } + + /** + * The pixel height of the creative. + * + * Generated from protobuf field int32 asset_height_px = 4; + * @param int $var + * @return $this + */ + public function setAssetHeightPx($var) + { + GPBUtil::checkInt32($var); + $this->asset_height_px = $var; + + return $this; + } + + /** + * The maximum pixel height of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_height_px = 5; + * @return int + */ + public function getExpandedHeightPx() + { + return $this->expanded_height_px; + } + + /** + * The maximum pixel height of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_height_px = 5; + * @param int $var + * @return $this + */ + public function setExpandedHeightPx($var) + { + GPBUtil::checkInt32($var); + $this->expanded_height_px = $var; + + return $this; + } + + /** + * The pixel width of the creative. + * + * Generated from protobuf field int32 asset_width_px = 6; + * @return int + */ + public function getAssetWidthPx() + { + return $this->asset_width_px; + } + + /** + * The pixel width of the creative. + * + * Generated from protobuf field int32 asset_width_px = 6; + * @param int $var + * @return $this + */ + public function setAssetWidthPx($var) + { + GPBUtil::checkInt32($var); + $this->asset_width_px = $var; + + return $this; + } + + /** + * The maximum pixel width of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_width_px = 7; + * @return int + */ + public function getExpandedWidthPx() + { + return $this->expanded_width_px; + } + + /** + * The maximum pixel width of the creative in its expanded state. + * + * Generated from protobuf field int32 expanded_width_px = 7; + * @param int $var + * @return $this + */ + public function setExpandedWidthPx($var) + { + GPBUtil::checkInt32($var); + $this->expanded_width_px = $var; + + return $this; + } + + /** + * The ID used to identify the desired placement on a publisher's page. + * Values to be used should be discussed between publishers and + * advertisers. + * + * Generated from protobuf field string ad_slot_id = 8; + * @return string + */ + public function getAdSlotId() + { + return $this->ad_slot_id; + } + + /** + * The ID used to identify the desired placement on a publisher's page. + * Values to be used should be discussed between publishers and + * advertisers. + * + * Generated from protobuf field string ad_slot_id = 8; + * @param string $var + * @return $this + */ + public function setAdSlotId($var) + { + GPBUtil::checkString($var, True); + $this->ad_slot_id = $var; + + return $this; + } + + /** + * The list of tracking events for the companion. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * The list of tracking events for the companion. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 9; + * @param array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\Event::class); + $this->events = $arr; + + return $this; + } + + /** + * @return string + */ + public function getAdResource() + { + return $this->whichOneof("ad_resource"); + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds.php new file mode 100644 index 00000000000..19875411f71 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.CompanionAds + */ +class CompanionAds extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates how many of the companions should be displayed with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds.DisplayRequirement display_requirement = 1; + */ + protected $display_requirement = 0; + /** + * List of companion ads. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Companion companions = 2; + */ + private $companions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $display_requirement + * Indicates how many of the companions should be displayed with the ad. + * @type array<\Google\Cloud\Video\Stitcher\V1\Companion>|\Google\Protobuf\Internal\RepeatedField $companions + * List of companion ads. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Companions::initOnce(); + parent::__construct($data); + } + + /** + * Indicates how many of the companions should be displayed with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds.DisplayRequirement display_requirement = 1; + * @return int + */ + public function getDisplayRequirement() + { + return $this->display_requirement; + } + + /** + * Indicates how many of the companions should be displayed with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds.DisplayRequirement display_requirement = 1; + * @param int $var + * @return $this + */ + public function setDisplayRequirement($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\CompanionAds\DisplayRequirement::class); + $this->display_requirement = $var; + + return $this; + } + + /** + * List of companion ads. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Companion companions = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCompanions() + { + return $this->companions; + } + + /** + * List of companion ads. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Companion companions = 2; + * @param array<\Google\Cloud\Video\Stitcher\V1\Companion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCompanions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\Companion::class); + $this->companions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds/DisplayRequirement.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds/DisplayRequirement.php new file mode 100644 index 00000000000..edcd46145e3 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CompanionAds/DisplayRequirement.php @@ -0,0 +1,71 @@ +google.cloud.video.stitcher.v1.CompanionAds.DisplayRequirement + */ +class DisplayRequirement +{ + /** + * Required companions are not specified. The default is ALL. + * + * Generated from protobuf enum DISPLAY_REQUIREMENT_UNSPECIFIED = 0; + */ + const DISPLAY_REQUIREMENT_UNSPECIFIED = 0; + /** + * All companions are required to be displayed. + * + * Generated from protobuf enum ALL = 1; + */ + const ALL = 1; + /** + * At least one of companions needs to be displayed. + * + * Generated from protobuf enum ANY = 2; + */ + const ANY = 2; + /** + * All companions are optional for display. + * + * Generated from protobuf enum NONE = 3; + */ + const NONE = 3; + + private static $valueToName = [ + self::DISPLAY_REQUIREMENT_UNSPECIFIED => 'DISPLAY_REQUIREMENT_UNSPECIFIED', + self::ALL => 'ALL', + self::ANY => 'ANY', + self::NONE => 'NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DisplayRequirement::class, \Google\Cloud\Video\Stitcher\V1\CompanionAds_DisplayRequirement::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateCdnKeyRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateCdnKeyRequest.php new file mode 100644 index 00000000000..86b5b6d6825 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateCdnKeyRequest.php @@ -0,0 +1,189 @@ +google.cloud.video.stitcher.v1.CreateCdnKeyRequest + */ +class CreateCdnKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The CDN key resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cdn_key = null; + /** + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string cdn_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cdn_key_id = ''; + + /** + * @param string $parent Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Stitcher\V1\CdnKey $cdnKey Required. The CDN key resource to create. + * @param string $cdnKeyId Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * @return \Google\Cloud\Video\Stitcher\V1\CreateCdnKeyRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Stitcher\V1\CdnKey $cdnKey, string $cdnKeyId): self + { + return (new self()) + ->setParent($parent) + ->setCdnKey($cdnKey) + ->setCdnKeyId($cdnKeyId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. + * @type \Google\Cloud\Video\Stitcher\V1\CdnKey $cdn_key + * Required. The CDN key resource to create. + * @type string $cdn_key_id + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The CDN key resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\CdnKey|null + */ + public function getCdnKey() + { + return $this->cdn_key; + } + + public function hasCdnKey() + { + return isset($this->cdn_key); + } + + public function clearCdnKey() + { + unset($this->cdn_key); + } + + /** + * Required. The CDN key resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\CdnKey $var + * @return $this + */ + public function setCdnKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\CdnKey::class); + $this->cdn_key = $var; + + return $this; + } + + /** + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string cdn_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCdnKeyId() + { + return $this->cdn_key_id; + } + + /** + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string cdn_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCdnKeyId($var) + { + GPBUtil::checkString($var, True); + $this->cdn_key_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveConfigRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveConfigRequest.php new file mode 100644 index 00000000000..2e55e807afd --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveConfigRequest.php @@ -0,0 +1,242 @@ +google.cloud.video.stitcher.v1.CreateLiveConfigRequest + */ +class CreateLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $live_config_id = ''; + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $live_config = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Stitcher\V1\LiveConfig $liveConfig Required. The live config resource to create. + * @param string $liveConfigId Required. The unique identifier ID to use for the live config. + * + * @return \Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Stitcher\V1\LiveConfig $liveConfig, string $liveConfigId): self + { + return (new self()) + ->setParent($parent) + ->setLiveConfig($liveConfig) + ->setLiveConfigId($liveConfigId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * @type string $live_config_id + * Required. The unique identifier ID to use for the live config. + * @type \Google\Cloud\Video\Stitcher\V1\LiveConfig $live_config + * Required. The live config resource to create. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLiveConfigId() + { + return $this->live_config_id; + } + + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLiveConfigId($var) + { + GPBUtil::checkString($var, True); + $this->live_config_id = $var; + + return $this; + } + + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\LiveConfig|null + */ + public function getLiveConfig() + { + return $this->live_config; + } + + public function hasLiveConfig() + { + return isset($this->live_config); + } + + public function clearLiveConfig() + { + unset($this->live_config); + } + + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\LiveConfig $var + * @return $this + */ + public function setLiveConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig::class); + $this->live_config = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveSessionRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveSessionRequest.php new file mode 100644 index 00000000000..76a9ea13ef7 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateLiveSessionRequest.php @@ -0,0 +1,132 @@ +google.cloud.video.stitcher.v1.CreateLiveSessionRequest + */ +class CreateLiveSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Parameters for creating a live session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession live_session = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $live_session = null; + + /** + * @param string $parent Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession $liveSession Required. Parameters for creating a live session. + * + * @return \Google\Cloud\Video\Stitcher\V1\CreateLiveSessionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Stitcher\V1\LiveSession $liveSession): self + { + return (new self()) + ->setParent($parent) + ->setLiveSession($liveSession); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * @type \Google\Cloud\Video\Stitcher\V1\LiveSession $live_session + * Required. Parameters for creating a live session. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Parameters for creating a live session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession live_session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\LiveSession|null + */ + public function getLiveSession() + { + return $this->live_session; + } + + public function hasLiveSession() + { + return isset($this->live_session); + } + + public function clearLiveSession() + { + unset($this->live_session); + } + + /** + * Required. Parameters for creating a live session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession live_session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession $var + * @return $this + */ + public function setLiveSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveSession::class); + $this->live_session = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateSlateRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateSlateRequest.php new file mode 100644 index 00000000000..f1cd04f9e2d --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateSlateRequest.php @@ -0,0 +1,257 @@ +google.cloud.video.stitcher.v1.CreateSlateRequest + */ +class CreateSlateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string slate_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $slate_id = ''; + /** + * Required. The slate to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $slate = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Stitcher\V1\Slate $slate Required. The slate to create. + * @param string $slateId Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * @return \Google\Cloud\Video\Stitcher\V1\CreateSlateRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Stitcher\V1\Slate $slate, string $slateId): self + { + return (new self()) + ->setParent($parent) + ->setSlate($slate) + ->setSlateId($slateId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. + * @type string $slate_id + * Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * @type \Google\Cloud\Video\Stitcher\V1\Slate $slate + * Required. The slate to create. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string slate_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSlateId() + { + return $this->slate_id; + } + + /** + * Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * + * Generated from protobuf field string slate_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSlateId($var) + { + GPBUtil::checkString($var, True); + $this->slate_id = $var; + + return $this; + } + + /** + * Required. The slate to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\Slate|null + */ + public function getSlate() + { + return $this->slate; + } + + public function hasSlate() + { + return isset($this->slate); + } + + public function clearSlate() + { + unset($this->slate); + } + + /** + * Required. The slate to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\Slate $var + * @return $this + */ + public function setSlate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\Slate::class); + $this->slate = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateVodSessionRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateVodSessionRequest.php new file mode 100644 index 00000000000..14e94a02e82 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/CreateVodSessionRequest.php @@ -0,0 +1,132 @@ +google.cloud.video.stitcher.v1.CreateVodSessionRequest + */ +class CreateVodSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Parameters for creating a session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession vod_session = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $vod_session = null; + + /** + * @param string $parent Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Stitcher\V1\VodSession $vodSession Required. Parameters for creating a session. + * + * @return \Google\Cloud\Video\Stitcher\V1\CreateVodSessionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Stitcher\V1\VodSession $vodSession): self + { + return (new self()) + ->setParent($parent) + ->setVodSession($vodSession); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * @type \Google\Cloud\Video\Stitcher\V1\VodSession $vod_session + * Required. Parameters for creating a session. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Parameters for creating a session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession vod_session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\VodSession|null + */ + public function getVodSession() + { + return $this->vod_session; + } + + public function hasVodSession() + { + return isset($this->vod_session); + } + + public function clearVodSession() + { + unset($this->vod_session); + } + + /** + * Required. Parameters for creating a session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession vod_session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\VodSession $var + * @return $this + */ + public function setVodSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\VodSession::class); + $this->vod_session = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteCdnKeyRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteCdnKeyRequest.php new file mode 100644 index 00000000000..7e1f8d4d0f9 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteCdnKeyRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.DeleteCdnKeyRequest + */ +class DeleteCdnKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. Please see + * {@see VideoStitcherServiceClient::cdnKeyName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteLiveConfigRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteLiveConfigRequest.php new file mode 100644 index 00000000000..c0b9429e537 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteLiveConfigRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.DeleteLiveConfigRequest + */ +class DeleteLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. Please see + * {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteSlateRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteSlateRequest.php new file mode 100644 index 00000000000..6cdc43bb27e --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/DeleteSlateRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.DeleteSlateRequest + */ +class DeleteSlateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. Please see + * {@see VideoStitcherServiceClient::slateName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event.php new file mode 100644 index 00000000000..c9ea208c2db --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event.php @@ -0,0 +1,179 @@ +google.cloud.video.stitcher.v1.Event + */ +class Event extends \Google\Protobuf\Internal\Message +{ + /** + * Describes the event that occurred. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Event.EventType type = 1; + */ + protected $type = 0; + /** + * The URI to trigger for this event. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * The ID of the event. + * + * Generated from protobuf field string id = 3; + */ + protected $id = ''; + /** + * The offset in seconds if the event type is `PROGRESS`. + * + * Generated from protobuf field .google.protobuf.Duration offset = 4; + */ + protected $offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Describes the event that occurred. + * @type string $uri + * The URI to trigger for this event. + * @type string $id + * The ID of the event. + * @type \Google\Protobuf\Duration $offset + * The offset in seconds if the event type is `PROGRESS`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Events::initOnce(); + parent::__construct($data); + } + + /** + * Describes the event that occurred. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Event.EventType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Describes the event that occurred. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Event.EventType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\Event\EventType::class); + $this->type = $var; + + return $this; + } + + /** + * The URI to trigger for this event. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The URI to trigger for this event. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * The ID of the event. + * + * Generated from protobuf field string id = 3; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The ID of the event. + * + * Generated from protobuf field string id = 3; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The offset in seconds if the event type is `PROGRESS`. + * + * Generated from protobuf field .google.protobuf.Duration offset = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getOffset() + { + return $this->offset; + } + + public function hasOffset() + { + return isset($this->offset); + } + + public function clearOffset() + { + unset($this->offset); + } + + /** + * The offset in seconds if the event type is `PROGRESS`. + * + * Generated from protobuf field .google.protobuf.Duration offset = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event/EventType.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event/EventType.php new file mode 100644 index 00000000000..5d323e3ef36 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Event/EventType.php @@ -0,0 +1,218 @@ +google.cloud.video.stitcher.v1.Event.EventType + */ +class EventType +{ + /** + * The event type is unspecified. + * + * Generated from protobuf enum EVENT_TYPE_UNSPECIFIED = 0; + */ + const EVENT_TYPE_UNSPECIFIED = 0; + /** + * First frame of creative ad viewed. + * + * Generated from protobuf enum CREATIVE_VIEW = 1; + */ + const CREATIVE_VIEW = 1; + /** + * Creative ad started. + * + * Generated from protobuf enum START = 2; + */ + const START = 2; + /** + * Start of an ad break. + * + * Generated from protobuf enum BREAK_START = 3; + */ + const BREAK_START = 3; + /** + * End of an ad break. + * + * Generated from protobuf enum BREAK_END = 4; + */ + const BREAK_END = 4; + /** + * Impression. + * + * Generated from protobuf enum IMPRESSION = 5; + */ + const IMPRESSION = 5; + /** + * First quartile progress. + * + * Generated from protobuf enum FIRST_QUARTILE = 6; + */ + const FIRST_QUARTILE = 6; + /** + * Midpoint progress. + * + * Generated from protobuf enum MIDPOINT = 7; + */ + const MIDPOINT = 7; + /** + * Third quartile progress. + * + * Generated from protobuf enum THIRD_QUARTILE = 8; + */ + const THIRD_QUARTILE = 8; + /** + * Ad progress completed. + * + * Generated from protobuf enum COMPLETE = 9; + */ + const COMPLETE = 9; + /** + * Specific progress event with an offset. + * + * Generated from protobuf enum PROGRESS = 10; + */ + const PROGRESS = 10; + /** + * Player muted. + * + * Generated from protobuf enum MUTE = 11; + */ + const MUTE = 11; + /** + * Player unmuted. + * + * Generated from protobuf enum UNMUTE = 12; + */ + const UNMUTE = 12; + /** + * Player paused. + * + * Generated from protobuf enum PAUSE = 13; + */ + const PAUSE = 13; + /** + * Click event. + * + * Generated from protobuf enum CLICK = 14; + */ + const CLICK = 14; + /** + * Click-through event. + * + * Generated from protobuf enum CLICK_THROUGH = 15; + */ + const CLICK_THROUGH = 15; + /** + * Player rewinding. + * + * Generated from protobuf enum REWIND = 16; + */ + const REWIND = 16; + /** + * Player resumed. + * + * Generated from protobuf enum RESUME = 17; + */ + const RESUME = 17; + /** + * Error event. + * + * Generated from protobuf enum ERROR = 18; + */ + const ERROR = 18; + /** + * Ad expanded to a larger size. + * + * Generated from protobuf enum EXPAND = 21; + */ + const EXPAND = 21; + /** + * Ad collapsed to a smaller size. + * + * Generated from protobuf enum COLLAPSE = 22; + */ + const COLLAPSE = 22; + /** + * Non-linear ad closed. + * + * Generated from protobuf enum CLOSE = 24; + */ + const CLOSE = 24; + /** + * Linear ad closed. + * + * Generated from protobuf enum CLOSE_LINEAR = 25; + */ + const CLOSE_LINEAR = 25; + /** + * Ad skipped. + * + * Generated from protobuf enum SKIP = 26; + */ + const SKIP = 26; + /** + * Accept invitation event. + * + * Generated from protobuf enum ACCEPT_INVITATION = 27; + */ + const ACCEPT_INVITATION = 27; + + private static $valueToName = [ + self::EVENT_TYPE_UNSPECIFIED => 'EVENT_TYPE_UNSPECIFIED', + self::CREATIVE_VIEW => 'CREATIVE_VIEW', + self::START => 'START', + self::BREAK_START => 'BREAK_START', + self::BREAK_END => 'BREAK_END', + self::IMPRESSION => 'IMPRESSION', + self::FIRST_QUARTILE => 'FIRST_QUARTILE', + self::MIDPOINT => 'MIDPOINT', + self::THIRD_QUARTILE => 'THIRD_QUARTILE', + self::COMPLETE => 'COMPLETE', + self::PROGRESS => 'PROGRESS', + self::MUTE => 'MUTE', + self::UNMUTE => 'UNMUTE', + self::PAUSE => 'PAUSE', + self::CLICK => 'CLICK', + self::CLICK_THROUGH => 'CLICK_THROUGH', + self::REWIND => 'REWIND', + self::RESUME => 'RESUME', + self::ERROR => 'ERROR', + self::EXPAND => 'EXPAND', + self::COLLAPSE => 'COLLAPSE', + self::CLOSE => 'CLOSE', + self::CLOSE_LINEAR => 'CLOSE_LINEAR', + self::SKIP => 'SKIP', + self::ACCEPT_INVITATION => 'ACCEPT_INVITATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EventType::class, \Google\Cloud\Video\Stitcher\V1\Event_EventType::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GamLiveConfig.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GamLiveConfig.php new file mode 100644 index 00000000000..74a1dd80906 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GamLiveConfig.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.GamLiveConfig + */ +class GamLiveConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_code = ''; + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $asset_key = ''; + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $custom_asset_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code to associate with the live config. + * @type string $asset_key + * Output only. The asset key identifier generated for the live config. + * @type string $custom_asset_key + * Output only. The custom asset key identifier generated for the live config. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAssetKey() + { + return $this->asset_key; + } + + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAssetKey($var) + { + GPBUtil::checkString($var, True); + $this->asset_key = $var; + + return $this; + } + + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCustomAssetKey() + { + return $this->custom_asset_key; + } + + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCustomAssetKey($var) + { + GPBUtil::checkString($var, True); + $this->custom_asset_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetCdnKeyRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetCdnKeyRequest.php new file mode 100644 index 00000000000..60883c4c2bc --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetCdnKeyRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.GetCdnKeyRequest + */ +class GetCdnKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. Please see + * {@see VideoStitcherServiceClient::cdnKeyName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetCdnKeyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveAdTagDetailRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveAdTagDetailRequest.php new file mode 100644 index 00000000000..0bb9510c90d --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveAdTagDetailRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.GetLiveAdTagDetailRequest + */ +class GetLiveAdTagDetailRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. Please see + * {@see VideoStitcherServiceClient::liveAdTagDetailName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetLiveAdTagDetailRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveConfigRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveConfigRequest.php new file mode 100644 index 00000000000..90307785694 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveConfigRequest.php @@ -0,0 +1,91 @@ +google.cloud.video.stitcher.v1.GetLiveConfigRequest + */ +class GetLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. Please see + * {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveSessionRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveSessionRequest.php new file mode 100644 index 00000000000..a3ba9f66b9a --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetLiveSessionRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.GetLiveSessionRequest + */ +class GetLiveSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. Please see + * {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetLiveSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetSlateRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetSlateRequest.php new file mode 100644 index 00000000000..220a34dfa77 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetSlateRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.GetSlateRequest + */ +class GetSlateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. Please see + * {@see VideoStitcherServiceClient::slateName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetSlateRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodAdTagDetailRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodAdTagDetailRequest.php new file mode 100644 index 00000000000..b3f841410af --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodAdTagDetailRequest.php @@ -0,0 +1,91 @@ +google.cloud.video.stitcher.v1.GetVodAdTagDetailRequest + */ +class GetVodAdTagDetailRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. Please see + * {@see VideoStitcherServiceClient::vodAdTagDetailName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetVodAdTagDetailRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodSessionRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodSessionRequest.php new file mode 100644 index 00000000000..523db81a33c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodSessionRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.stitcher.v1.GetVodSessionRequest + */ +class GetVodSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. Please see + * {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetVodSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodStitchDetailRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodStitchDetailRequest.php new file mode 100644 index 00000000000..019ccfb7cd9 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GetVodStitchDetailRequest.php @@ -0,0 +1,91 @@ +google.cloud.video.stitcher.v1.GetVodStitchDetailRequest + */ +class GetVodStitchDetailRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. Please see + * {@see VideoStitcherServiceClient::vodStitchDetailName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\GetVodStitchDetailRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GoogleCdnKey.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GoogleCdnKey.php new file mode 100644 index 00000000000..afa7b822bf1 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/GoogleCdnKey.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.GoogleCdnKey + */ +class GoogleCdnKey extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. Secret for this Google Cloud CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $private_key = ''; + /** + * The public name of the Google Cloud CDN key. + * + * Generated from protobuf field string key_name = 2; + */ + protected $key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_key + * Input only. Secret for this Google Cloud CDN key. + * @type string $key_name + * The public name of the Google Cloud CDN key. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\CdnKeys::initOnce(); + parent::__construct($data); + } + + /** + * Input only. Secret for this Google Cloud CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getPrivateKey() + { + return $this->private_key; + } + + /** + * Input only. Secret for this Google Cloud CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPrivateKey($var) + { + GPBUtil::checkString($var, False); + $this->private_key = $var; + + return $this; + } + + /** + * The public name of the Google Cloud CDN key. + * + * Generated from protobuf field string key_name = 2; + * @return string + */ + public function getKeyName() + { + return $this->key_name; + } + + /** + * The public name of the Google Cloud CDN key. + * + * Generated from protobuf field string key_name = 2; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/HtmlAdResource.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/HtmlAdResource.php new file mode 100644 index 00000000000..3e45e33af96 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/HtmlAdResource.php @@ -0,0 +1,67 @@ +google.cloud.video.stitcher.v1.HtmlAdResource + */ +class HtmlAdResource extends \Google\Protobuf\Internal\Message +{ + /** + * The HTML to display for the ad resource. + * + * Generated from protobuf field string html_source = 1; + */ + protected $html_source = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $html_source + * The HTML to display for the ad resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Companions::initOnce(); + parent::__construct($data); + } + + /** + * The HTML to display for the ad resource. + * + * Generated from protobuf field string html_source = 1; + * @return string + */ + public function getHtmlSource() + { + return $this->html_source; + } + + /** + * The HTML to display for the ad resource. + * + * Generated from protobuf field string html_source = 1; + * @param string $var + * @return $this + */ + public function setHtmlSource($var) + { + GPBUtil::checkString($var, True); + $this->html_source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/IframeAdResource.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/IframeAdResource.php new file mode 100644 index 00000000000..3251ce7c39b --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/IframeAdResource.php @@ -0,0 +1,67 @@ +google.cloud.video.stitcher.v1.IframeAdResource + */ +class IframeAdResource extends \Google\Protobuf\Internal\Message +{ + /** + * URI source for an IFrame to display for the ad resource. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * URI source for an IFrame to display for the ad resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Companions::initOnce(); + parent::__construct($data); + } + + /** + * URI source for an IFrame to display for the ad resource. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI source for an IFrame to display for the ad resource. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Interstitials.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Interstitials.php new file mode 100644 index 00000000000..11acfce74a2 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Interstitials.php @@ -0,0 +1,111 @@ +google.cloud.video.stitcher.v1.Interstitials + */ +class Interstitials extends \Google\Protobuf\Internal\Message +{ + /** + * List of ad breaks ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAdBreak ad_breaks = 1; + */ + private $ad_breaks; + /** + * Information related to the content of the VOD session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSessionContent session_content = 2; + */ + protected $session_content = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\VodSessionAdBreak>|\Google\Protobuf\Internal\RepeatedField $ad_breaks + * List of ad breaks ordered by time. + * @type \Google\Cloud\Video\Stitcher\V1\VodSessionContent $session_content + * Information related to the content of the VOD session. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * List of ad breaks ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAdBreak ad_breaks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdBreaks() + { + return $this->ad_breaks; + } + + /** + * List of ad breaks ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAdBreak ad_breaks = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\VodSessionAdBreak>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdBreaks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\VodSessionAdBreak::class); + $this->ad_breaks = $arr; + + return $this; + } + + /** + * Information related to the content of the VOD session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSessionContent session_content = 2; + * @return \Google\Cloud\Video\Stitcher\V1\VodSessionContent|null + */ + public function getSessionContent() + { + return $this->session_content; + } + + public function hasSessionContent() + { + return isset($this->session_content); + } + + public function clearSessionContent() + { + unset($this->session_content); + } + + /** + * Information related to the content of the VOD session. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSessionContent session_content = 2; + * @param \Google\Cloud\Video\Stitcher\V1\VodSessionContent $var + * @return $this + */ + public function setSessionContent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\VodSessionContent::class); + $this->session_content = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysRequest.php new file mode 100644 index 00000000000..18c76416ec3 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysRequest.php @@ -0,0 +1,226 @@ +google.cloud.video.stitcher.v1.ListCdnKeysRequest + */ +class ListCdnKeysRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListCdnKeysRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysResponse.php new file mode 100644 index 00000000000..fdb7d35e26a --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListCdnKeysResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.ListCdnKeysResponse + */ +class ListCdnKeysResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of CDN keys. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.CdnKey cdn_keys = 1; + */ + private $cdn_keys; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\CdnKey>|\Google\Protobuf\Internal\RepeatedField $cdn_keys + * List of CDN keys. + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * List of CDN keys. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.CdnKey cdn_keys = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCdnKeys() + { + return $this->cdn_keys; + } + + /** + * List of CDN keys. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.CdnKey cdn_keys = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\CdnKey>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCdnKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\CdnKey::class); + $this->cdn_keys = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsRequest.php new file mode 100644 index 00000000000..d14bea8f5f7 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsRequest.php @@ -0,0 +1,154 @@ +google.cloud.video.stitcher.v1.ListLiveAdTagDetailsRequest + */ +class ListLiveAdTagDetailsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The pagination token returned from a previous List request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. Please see + * {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The pagination token returned from a previous List request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The pagination token returned from a previous List request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The pagination token returned from a previous List request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsResponse.php new file mode 100644 index 00000000000..934491dee65 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveAdTagDetailsResponse.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.ListLiveAdTagDetailsResponse + */ +class ListLiveAdTagDetailsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of live session ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveAdTagDetail live_ad_tag_details = 1; + */ + private $live_ad_tag_details; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail>|\Google\Protobuf\Internal\RepeatedField $live_ad_tag_details + * A list of live session ad tag details. + * @type string $next_page_token + * The pagination token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * A list of live session ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveAdTagDetail live_ad_tag_details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLiveAdTagDetails() + { + return $this->live_ad_tag_details; + } + + /** + * A list of live session ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveAdTagDetail live_ad_tag_details = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLiveAdTagDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail::class); + $this->live_ad_tag_details = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsRequest.php new file mode 100644 index 00000000000..d45ae42d9d2 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsRequest.php @@ -0,0 +1,234 @@ +google.cloud.video.stitcher.v1.ListLiveConfigsRequest + */ +class ListLiveConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * @type string $order_by + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsResponse.php new file mode 100644 index 00000000000..1eae2969f2b --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListLiveConfigsResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.ListLiveConfigsResponse + */ +class ListLiveConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + */ + private $live_configs; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\LiveConfig>|\Google\Protobuf\Internal\RepeatedField $live_configs + * List of live configs. + * @type string $next_page_token + * The pagination token. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLiveConfigs() + { + return $this->live_configs; + } + + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\LiveConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLiveConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\LiveConfig::class); + $this->live_configs = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesRequest.php new file mode 100644 index 00000000000..7c24832d2b8 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesRequest.php @@ -0,0 +1,226 @@ +google.cloud.video.stitcher.v1.ListSlatesRequest + */ +class ListSlatesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListSlatesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesResponse.php new file mode 100644 index 00000000000..d66e458e161 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListSlatesResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.ListSlatesResponse + */ +class ListSlatesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of slates + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Slate slates = 1; + */ + private $slates; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\Slate>|\Google\Protobuf\Internal\RepeatedField $slates + * The list of slates + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * The list of slates + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Slate slates = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSlates() + { + return $this->slates; + } + + /** + * The list of slates + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Slate slates = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\Slate>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSlates($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\Slate::class); + $this->slates = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsRequest.php new file mode 100644 index 00000000000..a2f4d620fe3 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsRequest.php @@ -0,0 +1,154 @@ +google.cloud.video.stitcher.v1.ListVodAdTagDetailsRequest + */ +class ListVodAdTagDetailsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. Please see + * {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsResponse.php new file mode 100644 index 00000000000..47ccb4edacc --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodAdTagDetailsResponse.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.ListVodAdTagDetailsResponse + */ +class ListVodAdTagDetailsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A List of ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodAdTagDetail vod_ad_tag_details = 1; + */ + private $vod_ad_tag_details; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\VodAdTagDetail>|\Google\Protobuf\Internal\RepeatedField $vod_ad_tag_details + * A List of ad tag details. + * @type string $next_page_token + * The pagination token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * A List of ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodAdTagDetail vod_ad_tag_details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVodAdTagDetails() + { + return $this->vod_ad_tag_details; + } + + /** + * A List of ad tag details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodAdTagDetail vod_ad_tag_details = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\VodAdTagDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVodAdTagDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\VodAdTagDetail::class); + $this->vod_ad_tag_details = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsRequest.php new file mode 100644 index 00000000000..03a33b3b21d --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsRequest.php @@ -0,0 +1,154 @@ +google.cloud.video.stitcher.v1.ListVodStitchDetailsRequest + */ +class ListVodStitchDetailsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. Please see + * {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsResponse.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsResponse.php new file mode 100644 index 00000000000..202317ab560 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ListVodStitchDetailsResponse.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.ListVodStitchDetailsResponse + */ +class ListVodStitchDetailsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A List of stitch Details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodStitchDetail vod_stitch_details = 1; + */ + private $vod_stitch_details; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\VodStitchDetail>|\Google\Protobuf\Internal\RepeatedField $vod_stitch_details + * A List of stitch Details. + * @type string $next_page_token + * The pagination token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * A List of stitch Details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodStitchDetail vod_stitch_details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVodStitchDetails() + { + return $this->vod_stitch_details; + } + + /** + * A List of stitch Details. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodStitchDetail vod_stitch_details = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\VodStitchDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVodStitchDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\VodStitchDetail::class); + $this->vod_stitch_details = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveAdTagDetail.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveAdTagDetail.php new file mode 100644 index 00000000000..b594a4e0305 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveAdTagDetail.php @@ -0,0 +1,105 @@ +google.cloud.video.stitcher.v1.LiveAdTagDetail + */ +class LiveAdTagDetail extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A list of ad requests. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + */ + private $ad_requests; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{id}`. + * @type array<\Google\Cloud\Video\Stitcher\V1\AdRequest>|\Google\Protobuf\Internal\RepeatedField $ad_requests + * A list of ad requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); + parent::__construct($data); + } + + /** + * The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A list of ad requests. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdRequests() + { + return $this->ad_requests; + } + + /** + * A list of ad requests. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + * @param array<\Google\Cloud\Video\Stitcher\V1\AdRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\AdRequest::class); + $this->ad_requests = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig.php new file mode 100644 index 00000000000..9a8c8479448 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig.php @@ -0,0 +1,391 @@ +google.cloud.video.stitcher.v1.LiveConfig + */ +class LiveConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_uri = ''; + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + */ + protected $ad_tag_uri = ''; + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + */ + protected $gam_live_config = null; + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. Determines how the ads are tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_tracking = 0; + /** + * This must refer to a slate in the same + * project. If Google Ad Manager (GAM) is used for ads, this string sets the + * value of `slateCreativeId` in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + */ + protected $default_slate = ''; + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + */ + protected $stitching_policy = 0; + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + */ + protected $prefetch_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * @type string $source_uri + * Required. Source URI for the live stream manifest. + * @type string $ad_tag_uri + * The default ad tag associated with this live stream config. + * @type \Google\Cloud\Video\Stitcher\V1\GamLiveConfig $gam_live_config + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * @type int $state + * Output only. State of the live config. + * @type int $ad_tracking + * Required. Determines how the ads are tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * @type string $default_slate + * This must refer to a slate in the same + * project. If Google Ad Manager (GAM) is used for ads, this string sets the + * value of `slateCreativeId` in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * @type int $stitching_policy + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * @type \Google\Cloud\Video\Stitcher\V1\PrefetchConfig $prefetch_config + * The configuration for prefetching ads. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceUri() + { + return $this->source_uri; + } + + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceUri($var) + { + GPBUtil::checkString($var, True); + $this->source_uri = $var; + + return $this; + } + + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + * @return string + */ + public function getAdTagUri() + { + return $this->ad_tag_uri; + } + + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + * @param string $var + * @return $this + */ + public function setAdTagUri($var) + { + GPBUtil::checkString($var, True); + $this->ad_tag_uri = $var; + + return $this; + } + + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + * @return \Google\Cloud\Video\Stitcher\V1\GamLiveConfig|null + */ + public function getGamLiveConfig() + { + return $this->gam_live_config; + } + + public function hasGamLiveConfig() + { + return isset($this->gam_live_config); + } + + public function clearGamLiveConfig() + { + unset($this->gam_live_config); + } + + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + * @param \Google\Cloud\Video\Stitcher\V1\GamLiveConfig $var + * @return $this + */ + public function setGamLiveConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\GamLiveConfig::class); + $this->gam_live_config = $var; + + return $this; + } + + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. Determines how the ads are tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAdTracking() + { + return $this->ad_tracking; + } + + /** + * Required. Determines how the ads are tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAdTracking($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\AdTracking::class); + $this->ad_tracking = $var; + + return $this; + } + + /** + * This must refer to a slate in the same + * project. If Google Ad Manager (GAM) is used for ads, this string sets the + * value of `slateCreativeId` in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getDefaultSlate() + { + return $this->default_slate; + } + + /** + * This must refer to a slate in the same + * project. If Google Ad Manager (GAM) is used for ads, this string sets the + * value of `slateCreativeId` in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDefaultSlate($var) + { + GPBUtil::checkString($var, True); + $this->default_slate = $var; + + return $this; + } + + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + * @return int + */ + public function getStitchingPolicy() + { + return $this->stitching_policy; + } + + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + * @param int $var + * @return $this + */ + public function setStitchingPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig\StitchingPolicy::class); + $this->stitching_policy = $var; + + return $this; + } + + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + * @return \Google\Cloud\Video\Stitcher\V1\PrefetchConfig|null + */ + public function getPrefetchConfig() + { + return $this->prefetch_config; + } + + public function hasPrefetchConfig() + { + return isset($this->prefetch_config); + } + + public function clearPrefetchConfig() + { + unset($this->prefetch_config); + } + + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + * @param \Google\Cloud\Video\Stitcher\V1\PrefetchConfig $var + * @return $this + */ + public function setPrefetchConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\PrefetchConfig::class); + $this->prefetch_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/State.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/State.php new file mode 100644 index 00000000000..3defb74d973 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/State.php @@ -0,0 +1,71 @@ +google.cloud.video.stitcher.v1.LiveConfig.State + */ +class State +{ + /** + * State is not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Live config is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * Live config is ready for use. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * Live config is queued up for deletion. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Video\Stitcher\V1\LiveConfig_State::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/StitchingPolicy.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/StitchingPolicy.php new file mode 100644 index 00000000000..02f98376c11 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveConfig/StitchingPolicy.php @@ -0,0 +1,66 @@ +google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy + */ +class StitchingPolicy +{ + /** + * Stitching policy is not specified. + * + * Generated from protobuf enum STITCHING_POLICY_UNSPECIFIED = 0; + */ + const STITCHING_POLICY_UNSPECIFIED = 0; + /** + * Cuts an ad short and returns to content in the middle of the ad. + * + * Generated from protobuf enum CUT_CURRENT = 1; + */ + const CUT_CURRENT = 1; + /** + * Finishes stitching the current ad before returning to content. + * + * Generated from protobuf enum COMPLETE_AD = 2; + */ + const COMPLETE_AD = 2; + + private static $valueToName = [ + self::STITCHING_POLICY_UNSPECIFIED => 'STITCHING_POLICY_UNSPECIFIED', + self::CUT_CURRENT => 'CUT_CURRENT', + self::COMPLETE_AD => 'COMPLETE_AD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StitchingPolicy::class, \Google\Cloud\Video\Stitcher\V1\LiveConfig_StitchingPolicy::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession.php new file mode 100644 index 00000000000..f5a498fc5b6 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession.php @@ -0,0 +1,302 @@ +google.cloud.video.stitcher.v1.LiveSession + */ +class LiveSession extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the live session, in the form of + * `projects/{project}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The URI to play the live session's ad-stitched stream. + * + * Generated from protobuf field string play_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $play_uri = ''; + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: "https://doubleclick.google.com/ad/1?geo_id=[geoId]" + * Ad tag macros: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macros = 6; + */ + private $ad_tag_macros; + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; + */ + protected $manifest_options = null; + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + */ + protected $gam_settings = null; + /** + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $live_config = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the live session, in the form of + * `projects/{project}/locations/{location}/liveSessions/{id}`. + * @type string $play_uri + * Output only. The URI to play the live session's ad-stitched stream. + * @type array|\Google\Protobuf\Internal\MapField $ad_tag_macros + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: "https://doubleclick.google.com/ad/1?geo_id=[geoId]" + * Ad tag macros: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"https://doubleclick.google.com/ad/1?geo_id=123"` + * @type \Google\Cloud\Video\Stitcher\V1\ManifestOptions $manifest_options + * Additional options that affect the output of the manifest. + * @type \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings $gam_settings + * This field should be set with appropriate values if GAM is being used for + * ads. + * @type string $live_config + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the live session, in the form of + * `projects/{project}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the live session, in the form of + * `projects/{project}/locations/{location}/liveSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The URI to play the live session's ad-stitched stream. + * + * Generated from protobuf field string play_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPlayUri() + { + return $this->play_uri; + } + + /** + * Output only. The URI to play the live session's ad-stitched stream. + * + * Generated from protobuf field string play_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPlayUri($var) + { + GPBUtil::checkString($var, True); + $this->play_uri = $var; + + return $this; + } + + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: "https://doubleclick.google.com/ad/1?geo_id=[geoId]" + * Ad tag macros: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macros = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAdTagMacros() + { + return $this->ad_tag_macros; + } + + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: "https://doubleclick.google.com/ad/1?geo_id=[geoId]" + * Ad tag macros: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macros = 6; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAdTagMacros($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->ad_tag_macros = $arr; + + return $this; + } + + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; + * @return \Google\Cloud\Video\Stitcher\V1\ManifestOptions|null + */ + public function getManifestOptions() + { + return $this->manifest_options; + } + + public function hasManifestOptions() + { + return isset($this->manifest_options); + } + + public function clearManifestOptions() + { + unset($this->manifest_options); + } + + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; + * @param \Google\Cloud\Video\Stitcher\V1\ManifestOptions $var + * @return $this + */ + public function setManifestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\ManifestOptions::class); + $this->manifest_options = $var; + + return $this; + } + + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + * @return \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings|null + */ + public function getGamSettings() + { + return $this->gam_settings; + } + + public function hasGamSettings() + { + return isset($this->gam_settings); + } + + public function clearGamSettings() + { + unset($this->gam_settings); + } + + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings $var + * @return $this + */ + public function setGamSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings::class); + $this->gam_settings = $var; + + return $this; + } + + /** + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getLiveConfig() + { + return $this->live_config; + } + + /** + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setLiveConfig($var) + { + GPBUtil::checkString($var, True); + $this->live_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession/GamSettings.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession/GamSettings.php new file mode 100644 index 00000000000..e073a733325 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/LiveSession/GamSettings.php @@ -0,0 +1,71 @@ +google.cloud.video.stitcher.v1.LiveSession.GamSettings + */ +class GamSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $stream_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $stream_id + * Required. The stream ID generated by Ad Manager. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getStreamId() + { + return $this->stream_id; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setStreamId($var) + { + GPBUtil::checkString($var, True); + $this->stream_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GamSettings::class, \Google\Cloud\Video\Stitcher\V1\LiveSession_GamSettings::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions.php new file mode 100644 index 00000000000..27590ff366b --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions.php @@ -0,0 +1,109 @@ +google.cloud.video.stitcher.v1.ManifestOptions + */ +class ManifestOptions extends \Google\Protobuf\Internal\Message +{ + /** + * If specified, the output manifest will only return renditions matching the + * specified filters. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.RenditionFilter include_renditions = 1; + */ + private $include_renditions; + /** + * If specified, the output manifest will orders the video and muxed + * renditions by bitrate according to the ordering policy. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions.OrderPolicy bitrate_order = 2; + */ + protected $bitrate_order = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\RenditionFilter>|\Google\Protobuf\Internal\RepeatedField $include_renditions + * If specified, the output manifest will only return renditions matching the + * specified filters. + * @type int $bitrate_order + * If specified, the output manifest will orders the video and muxed + * renditions by bitrate according to the ordering policy. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * If specified, the output manifest will only return renditions matching the + * specified filters. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.RenditionFilter include_renditions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncludeRenditions() + { + return $this->include_renditions; + } + + /** + * If specified, the output manifest will only return renditions matching the + * specified filters. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.RenditionFilter include_renditions = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\RenditionFilter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncludeRenditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\RenditionFilter::class); + $this->include_renditions = $arr; + + return $this; + } + + /** + * If specified, the output manifest will orders the video and muxed + * renditions by bitrate according to the ordering policy. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions.OrderPolicy bitrate_order = 2; + * @return int + */ + public function getBitrateOrder() + { + return $this->bitrate_order; + } + + /** + * If specified, the output manifest will orders the video and muxed + * renditions by bitrate according to the ordering policy. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions.OrderPolicy bitrate_order = 2; + * @param int $var + * @return $this + */ + public function setBitrateOrder($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\ManifestOptions\OrderPolicy::class); + $this->bitrate_order = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions/OrderPolicy.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions/OrderPolicy.php new file mode 100644 index 00000000000..5808fe871d5 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ManifestOptions/OrderPolicy.php @@ -0,0 +1,64 @@ +google.cloud.video.stitcher.v1.ManifestOptions.OrderPolicy + */ +class OrderPolicy +{ + /** + * Ordering policy is not specified. + * + * Generated from protobuf enum ORDER_POLICY_UNSPECIFIED = 0; + */ + const ORDER_POLICY_UNSPECIFIED = 0; + /** + * Order by ascending. + * + * Generated from protobuf enum ASCENDING = 1; + */ + const ASCENDING = 1; + /** + * Order by descending. + * + * Generated from protobuf enum DESCENDING = 2; + */ + const DESCENDING = 2; + + private static $valueToName = [ + self::ORDER_POLICY_UNSPECIFIED => 'ORDER_POLICY_UNSPECIFIED', + self::ASCENDING => 'ASCENDING', + self::DESCENDING => 'DESCENDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OrderPolicy::class, \Google\Cloud\Video\Stitcher\V1\ManifestOptions_OrderPolicy::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/MediaCdnKey.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/MediaCdnKey.php new file mode 100644 index 00000000000..cd8cfd6dff7 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/MediaCdnKey.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.MediaCdnKey + */ +class MediaCdnKey extends \Google\Protobuf\Internal\Message +{ + /** + * Input only. 64-byte ed25519 private key for this Media CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $private_key = ''; + /** + * The keyset name of the Media CDN key. + * + * Generated from protobuf field string key_name = 2; + */ + protected $key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_key + * Input only. 64-byte ed25519 private key for this Media CDN key. + * @type string $key_name + * The keyset name of the Media CDN key. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\CdnKeys::initOnce(); + parent::__construct($data); + } + + /** + * Input only. 64-byte ed25519 private key for this Media CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getPrivateKey() + { + return $this->private_key; + } + + /** + * Input only. 64-byte ed25519 private key for this Media CDN key. + * + * Generated from protobuf field bytes private_key = 1 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPrivateKey($var) + { + GPBUtil::checkString($var, False); + $this->private_key = $var; + + return $this; + } + + /** + * The keyset name of the Media CDN key. + * + * Generated from protobuf field string key_name = 2; + * @return string + */ + public function getKeyName() + { + return $this->key_name; + } + + /** + * The keyset name of the Media CDN key. + * + * Generated from protobuf field string key_name = 2; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/OperationMetadata.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/OperationMetadata.php new file mode 100644 index 00000000000..59afa335e40 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/OperationMetadata.php @@ -0,0 +1,189 @@ +google.cloud.video.stitcher.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/PrefetchConfig.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/PrefetchConfig.php new file mode 100644 index 00000000000..5a3e14be908 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/PrefetchConfig.php @@ -0,0 +1,131 @@ +google.cloud.video.stitcher.v1.PrefetchConfig + */ +class PrefetchConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $enabled = false; + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + */ + protected $initial_ad_request_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Required. Indicates whether the option to prefetch ad requests is enabled. + * @type \Google\Protobuf\Duration $initial_ad_request_duration + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getInitialAdRequestDuration() + { + return $this->initial_ad_request_duration; + } + + public function hasInitialAdRequestDuration() + { + return isset($this->initial_ad_request_duration); + } + + public function clearInitialAdRequestDuration() + { + unset($this->initial_ad_request_duration); + } + + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setInitialAdRequestDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->initial_ad_request_duration = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ProgressEvent.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ProgressEvent.php new file mode 100644 index 00000000000..e1b9852ccb2 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ProgressEvent.php @@ -0,0 +1,128 @@ +google.cloud.video.stitcher.v1.ProgressEvent + */ +class ProgressEvent extends \Google\Protobuf\Internal\Message +{ + /** + * The time when the following tracking events occurs. The time is in + * seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + */ + protected $time_offset = null; + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `BREAK_START`, `BREAK_END`, `IMPRESSION`, + * `CREATIVE_VIEW`, `START`, `FIRST_QUARTILE`, `MIDPOINT`, `THIRD_QUARTILE`, + * `COMPLETE`, `PROGRESS`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 2; + */ + private $events; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $time_offset + * The time when the following tracking events occurs. The time is in + * seconds relative to the start of the VOD asset. + * @type array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $events + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `BREAK_START`, `BREAK_END`, `IMPRESSION`, + * `CREATIVE_VIEW`, `START`, `FIRST_QUARTILE`, `MIDPOINT`, `THIRD_QUARTILE`, + * `COMPLETE`, `PROGRESS`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Events::initOnce(); + parent::__construct($data); + } + + /** + * The time when the following tracking events occurs. The time is in + * seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getTimeOffset() + { + return $this->time_offset; + } + + public function hasTimeOffset() + { + return isset($this->time_offset); + } + + public function clearTimeOffset() + { + unset($this->time_offset); + } + + /** + * The time when the following tracking events occurs. The time is in + * seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->time_offset = $var; + + return $this; + } + + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `BREAK_START`, `BREAK_END`, `IMPRESSION`, + * `CREATIVE_VIEW`, `START`, `FIRST_QUARTILE`, `MIDPOINT`, `THIRD_QUARTILE`, + * `COMPLETE`, `PROGRESS`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvents() + { + return $this->events; + } + + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `BREAK_START`, `BREAK_END`, `IMPRESSION`, + * `CREATIVE_VIEW`, `START`, `FIRST_QUARTILE`, `MIDPOINT`, `THIRD_QUARTILE`, + * `COMPLETE`, `PROGRESS`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event events = 2; + * @param array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\Event::class); + $this->events = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RenditionFilter.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RenditionFilter.php new file mode 100644 index 00000000000..0d12d8ea104 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RenditionFilter.php @@ -0,0 +1,109 @@ +google.cloud.video.stitcher.v1.RenditionFilter + */ +class RenditionFilter extends \Google\Protobuf\Internal\Message +{ + /** + * Bitrate in bits per second for the rendition. If set, only renditions with + * the exact bitrate will match. + * + * Generated from protobuf field int32 bitrate_bps = 1; + */ + protected $bitrate_bps = 0; + /** + * Codecs for the rendition. If set, only renditions with the exact value + * will match. + * + * Generated from protobuf field string codecs = 2; + */ + protected $codecs = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $bitrate_bps + * Bitrate in bits per second for the rendition. If set, only renditions with + * the exact bitrate will match. + * @type string $codecs + * Codecs for the rendition. If set, only renditions with the exact value + * will match. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Bitrate in bits per second for the rendition. If set, only renditions with + * the exact bitrate will match. + * + * Generated from protobuf field int32 bitrate_bps = 1; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Bitrate in bits per second for the rendition. If set, only renditions with + * the exact bitrate will match. + * + * Generated from protobuf field int32 bitrate_bps = 1; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Codecs for the rendition. If set, only renditions with the exact value + * will match. + * + * Generated from protobuf field string codecs = 2; + * @return string + */ + public function getCodecs() + { + return $this->codecs; + } + + /** + * Codecs for the rendition. If set, only renditions with the exact value + * will match. + * + * Generated from protobuf field string codecs = 2; + * @param string $var + * @return $this + */ + public function setCodecs($var) + { + GPBUtil::checkString($var, True); + $this->codecs = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RequestMetadata.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RequestMetadata.php new file mode 100644 index 00000000000..cf958970e04 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/RequestMetadata.php @@ -0,0 +1,77 @@ +google.cloud.video.stitcher.v1.RequestMetadata + */ +class RequestMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The HTTP headers of the ad request. + * + * Generated from protobuf field .google.protobuf.Struct headers = 1; + */ + protected $headers = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $headers + * The HTTP headers of the ad request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); + parent::__construct($data); + } + + /** + * The HTTP headers of the ad request. + * + * Generated from protobuf field .google.protobuf.Struct headers = 1; + * @return \Google\Protobuf\Struct|null + */ + public function getHeaders() + { + return $this->headers; + } + + public function hasHeaders() + { + return isset($this->headers); + } + + public function clearHeaders() + { + unset($this->headers); + } + + /** + * The HTTP headers of the ad request. + * + * Generated from protobuf field .google.protobuf.Struct headers = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setHeaders($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->headers = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ResponseMetadata.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ResponseMetadata.php new file mode 100644 index 00000000000..9996433d98a --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/ResponseMetadata.php @@ -0,0 +1,257 @@ +google.cloud.video.stitcher.v1.ResponseMetadata + */ +class ResponseMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Error message received when making the ad request. + * + * Generated from protobuf field string error = 1; + */ + protected $error = ''; + /** + * Headers from the response. + * + * Generated from protobuf field .google.protobuf.Struct headers = 2; + */ + protected $headers = null; + /** + * Status code for the response. + * + * Generated from protobuf field string status_code = 3; + */ + protected $status_code = ''; + /** + * Size in bytes of the response. + * + * Generated from protobuf field int32 size_bytes = 4; + */ + protected $size_bytes = 0; + /** + * Total time elapsed for the response. + * + * Generated from protobuf field .google.protobuf.Duration duration = 5; + */ + protected $duration = null; + /** + * The body of the response. + * + * Generated from protobuf field string body = 6; + */ + protected $body = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $error + * Error message received when making the ad request. + * @type \Google\Protobuf\Struct $headers + * Headers from the response. + * @type string $status_code + * Status code for the response. + * @type int $size_bytes + * Size in bytes of the response. + * @type \Google\Protobuf\Duration $duration + * Total time elapsed for the response. + * @type string $body + * The body of the response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); + parent::__construct($data); + } + + /** + * Error message received when making the ad request. + * + * Generated from protobuf field string error = 1; + * @return string + */ + public function getError() + { + return $this->error; + } + + /** + * Error message received when making the ad request. + * + * Generated from protobuf field string error = 1; + * @param string $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkString($var, True); + $this->error = $var; + + return $this; + } + + /** + * Headers from the response. + * + * Generated from protobuf field .google.protobuf.Struct headers = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getHeaders() + { + return $this->headers; + } + + public function hasHeaders() + { + return isset($this->headers); + } + + public function clearHeaders() + { + unset($this->headers); + } + + /** + * Headers from the response. + * + * Generated from protobuf field .google.protobuf.Struct headers = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setHeaders($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->headers = $var; + + return $this; + } + + /** + * Status code for the response. + * + * Generated from protobuf field string status_code = 3; + * @return string + */ + public function getStatusCode() + { + return $this->status_code; + } + + /** + * Status code for the response. + * + * Generated from protobuf field string status_code = 3; + * @param string $var + * @return $this + */ + public function setStatusCode($var) + { + GPBUtil::checkString($var, True); + $this->status_code = $var; + + return $this; + } + + /** + * Size in bytes of the response. + * + * Generated from protobuf field int32 size_bytes = 4; + * @return int + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Size in bytes of the response. + * + * Generated from protobuf field int32 size_bytes = 4; + * @param int $var + * @return $this + */ + public function setSizeBytes($var) + { + GPBUtil::checkInt32($var); + $this->size_bytes = $var; + + return $this; + } + + /** + * Total time elapsed for the response. + * + * Generated from protobuf field .google.protobuf.Duration duration = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Total time elapsed for the response. + * + * Generated from protobuf field .google.protobuf.Duration duration = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * The body of the response. + * + * Generated from protobuf field string body = 6; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The body of the response. + * + * Generated from protobuf field string body = 6; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate.php new file mode 100644 index 00000000000..ffa5a67fc3f --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate.php @@ -0,0 +1,153 @@ +google.cloud.video.stitcher.v1.Slate + */ +class Slate extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the slate, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The URI to fetch the source content for the slate. This URI must return an + * MP4 video with at least one audio track. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * gam_slate has all the GAM-related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + */ + protected $gam_slate = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the slate, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * @type string $uri + * The URI to fetch the source content for the slate. This URI must return an + * MP4 video with at least one audio track. + * @type \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate $gam_slate + * gam_slate has all the GAM-related attributes of slates. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Slates::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the slate, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the slate, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The URI to fetch the source content for the slate. This URI must return an + * MP4 video with at least one audio track. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The URI to fetch the source content for the slate. This URI must return an + * MP4 video with at least one audio track. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * gam_slate has all the GAM-related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + * @return \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate|null + */ + public function getGamSlate() + { + return $this->gam_slate; + } + + public function hasGamSlate() + { + return isset($this->gam_slate); + } + + public function clearGamSlate() + { + unset($this->gam_slate); + } + + /** + * gam_slate has all the GAM-related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + * @param \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate $var + * @return $this + */ + public function setGamSlate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate::class); + $this->gam_slate = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate/GamSlate.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate/GamSlate.php new file mode 100644 index 00000000000..e4991ab6712 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/Slate/GamSlate.php @@ -0,0 +1,105 @@ +google.cloud.video.stitcher.v1.Slate.GamSlate + */ +class GamSlate extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_code = ''; + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $gam_slate_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code to associate with the live config. + * @type int|string $gam_slate_id + * Output only. The identifier generated for the slate by GAM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Slates::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getGamSlateId() + { + return $this->gam_slate_id; + } + + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setGamSlateId($var) + { + GPBUtil::checkInt64($var); + $this->gam_slate_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GamSlate::class, \Google\Cloud\Video\Stitcher\V1\Slate_GamSlate::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/StaticAdResource.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/StaticAdResource.php new file mode 100644 index 00000000000..c52ed06d37c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/StaticAdResource.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.StaticAdResource + */ +class StaticAdResource extends \Google\Protobuf\Internal\Message +{ + /** + * URI to the static file for the ad resource. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * Describes the MIME type of the ad resource. + * + * Generated from protobuf field string creative_type = 2; + */ + protected $creative_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * URI to the static file for the ad resource. + * @type string $creative_type + * Describes the MIME type of the ad resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Companions::initOnce(); + parent::__construct($data); + } + + /** + * URI to the static file for the ad resource. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI to the static file for the ad resource. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Describes the MIME type of the ad resource. + * + * Generated from protobuf field string creative_type = 2; + * @return string + */ + public function getCreativeType() + { + return $this->creative_type; + } + + /** + * Describes the MIME type of the ad resource. + * + * Generated from protobuf field string creative_type = 2; + * @param string $var + * @return $this + */ + public function setCreativeType($var) + { + GPBUtil::checkString($var, True); + $this->creative_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateCdnKeyRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateCdnKeyRequest.php new file mode 100644 index 00000000000..b3f90236908 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateCdnKeyRequest.php @@ -0,0 +1,146 @@ +google.cloud.video.stitcher.v1.UpdateCdnKeyRequest + */ +class UpdateCdnKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The CDN key resource which replaces the resource on the server. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cdn_key = null; + /** + * Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Video\Stitcher\V1\CdnKey $cdnKey Required. The CDN key resource which replaces the resource on the server. + * @param \Google\Protobuf\FieldMask $updateMask Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * @return \Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Video\Stitcher\V1\CdnKey $cdnKey, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setCdnKey($cdnKey) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Stitcher\V1\CdnKey $cdn_key + * Required. The CDN key resource which replaces the resource on the server. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The CDN key resource which replaces the resource on the server. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\CdnKey|null + */ + public function getCdnKey() + { + return $this->cdn_key; + } + + public function hasCdnKey() + { + return isset($this->cdn_key); + } + + public function clearCdnKey() + { + unset($this->cdn_key); + } + + /** + * Required. The CDN key resource which replaces the resource on the server. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CdnKey cdn_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\CdnKey $var + * @return $this + */ + public function setCdnKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\CdnKey::class); + $this->cdn_key = $var; + + return $this; + } + + /** + * Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateSlateRequest.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateSlateRequest.php new file mode 100644 index 00000000000..6e415aa29b8 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/UpdateSlateRequest.php @@ -0,0 +1,136 @@ +google.cloud.video.stitcher.v1.UpdateSlateRequest + */ +class UpdateSlateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource with updated fields. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $slate = null; + /** + * Required. The update mask which specifies fields which should be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Video\Stitcher\V1\Slate $slate Required. The resource with updated fields. + * @param \Google\Protobuf\FieldMask $updateMask Required. The update mask which specifies fields which should be updated. + * + * @return \Google\Cloud\Video\Stitcher\V1\UpdateSlateRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Video\Stitcher\V1\Slate $slate, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSlate($slate) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Stitcher\V1\Slate $slate + * Required. The resource with updated fields. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The update mask which specifies fields which should be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource with updated fields. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\Slate|null + */ + public function getSlate() + { + return $this->slate; + } + + public function hasSlate() + { + return isset($this->slate); + } + + public function clearSlate() + { + unset($this->slate); + } + + /** + * Required. The resource with updated fields. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\Slate $var + * @return $this + */ + public function setSlate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\Slate::class); + $this->slate = $var; + + return $this; + } + + /** + * Required. The update mask which specifies fields which should be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The update mask which specifies fields which should be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodAdTagDetail.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodAdTagDetail.php new file mode 100644 index 00000000000..bbeee022d36 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodAdTagDetail.php @@ -0,0 +1,107 @@ +google.cloud.video.stitcher.v1.VodAdTagDetail + */ +class VodAdTagDetail extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the ad tag detail for the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A list of ad requests for one ad tag. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + */ + private $ad_requests; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the ad tag detail for the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{id}`. + * @type array<\Google\Cloud\Video\Stitcher\V1\AdRequest>|\Google\Protobuf\Internal\RepeatedField $ad_requests + * A list of ad requests for one ad tag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); + parent::__construct($data); + } + + /** + * The name of the ad tag detail for the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the ad tag detail for the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A list of ad requests for one ad tag. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdRequests() + { + return $this->ad_requests; + } + + /** + * A list of ad requests for one ad tag. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdRequest ad_requests = 2; + * @param array<\Google\Cloud\Video\Stitcher\V1\AdRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\AdRequest::class); + $this->ad_requests = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession.php new file mode 100644 index 00000000000..fe00b94de89 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession.php @@ -0,0 +1,443 @@ +google.cloud.video.stitcher.v1.VodSession + */ +class VodSession extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the VOD session, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Metadata of what was stitched into the content. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Interstitials interstitials = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $interstitials = null; + /** + * Output only. The playback URI of the stitched content. + * + * Generated from protobuf field string play_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $play_uri = ''; + /** + * Required. URI of the media to stitch. + * + * Generated from protobuf field string source_uri = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_uri = ''; + /** + * Required. Ad tag URI. + * + * Generated from protobuf field string ad_tag_uri = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_tag_uri = ''; + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: `"https://doubleclick.google.com/ad/1?geo_id=[geoId]"` + * Ad tag macro map: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"`https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macro_map = 7; + */ + private $ad_tag_macro_map; + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 9; + */ + protected $manifest_options = null; + /** + * Output only. The generated ID of the VodSession's source media. + * + * Generated from protobuf field string asset_id = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $asset_id = ''; + /** + * Required. Determines how the ad should be tracked. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $ad_tracking = 0; + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession.GamSettings gam_settings = 13; + */ + protected $gam_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the VOD session, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * @type \Google\Cloud\Video\Stitcher\V1\Interstitials $interstitials + * Output only. Metadata of what was stitched into the content. + * @type string $play_uri + * Output only. The playback URI of the stitched content. + * @type string $source_uri + * Required. URI of the media to stitch. + * @type string $ad_tag_uri + * Required. Ad tag URI. + * @type array|\Google\Protobuf\Internal\MapField $ad_tag_macro_map + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: `"https://doubleclick.google.com/ad/1?geo_id=[geoId]"` + * Ad tag macro map: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"`https://doubleclick.google.com/ad/1?geo_id=123"` + * @type \Google\Cloud\Video\Stitcher\V1\ManifestOptions $manifest_options + * Additional options that affect the output of the manifest. + * @type string $asset_id + * Output only. The generated ID of the VodSession's source media. + * @type int $ad_tracking + * Required. Determines how the ad should be tracked. + * @type \Google\Cloud\Video\Stitcher\V1\VodSession\GamSettings $gam_settings + * This field should be set with appropriate values if GAM is being used for + * ads. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the VOD session, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the VOD session, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Metadata of what was stitched into the content. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Interstitials interstitials = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Video\Stitcher\V1\Interstitials|null + */ + public function getInterstitials() + { + return $this->interstitials; + } + + public function hasInterstitials() + { + return isset($this->interstitials); + } + + public function clearInterstitials() + { + unset($this->interstitials); + } + + /** + * Output only. Metadata of what was stitched into the content. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Interstitials interstitials = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Video\Stitcher\V1\Interstitials $var + * @return $this + */ + public function setInterstitials($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\Interstitials::class); + $this->interstitials = $var; + + return $this; + } + + /** + * Output only. The playback URI of the stitched content. + * + * Generated from protobuf field string play_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPlayUri() + { + return $this->play_uri; + } + + /** + * Output only. The playback URI of the stitched content. + * + * Generated from protobuf field string play_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPlayUri($var) + { + GPBUtil::checkString($var, True); + $this->play_uri = $var; + + return $this; + } + + /** + * Required. URI of the media to stitch. + * + * Generated from protobuf field string source_uri = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceUri() + { + return $this->source_uri; + } + + /** + * Required. URI of the media to stitch. + * + * Generated from protobuf field string source_uri = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceUri($var) + { + GPBUtil::checkString($var, True); + $this->source_uri = $var; + + return $this; + } + + /** + * Required. Ad tag URI. + * + * Generated from protobuf field string ad_tag_uri = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAdTagUri() + { + return $this->ad_tag_uri; + } + + /** + * Required. Ad tag URI. + * + * Generated from protobuf field string ad_tag_uri = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAdTagUri($var) + { + GPBUtil::checkString($var, True); + $this->ad_tag_uri = $var; + + return $this; + } + + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: `"https://doubleclick.google.com/ad/1?geo_id=[geoId]"` + * Ad tag macro map: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"`https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macro_map = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAdTagMacroMap() + { + return $this->ad_tag_macro_map; + } + + /** + * Key value pairs for ad tag macro replacement. If the + * specified ad tag URI has macros, this field provides the mapping + * to the value that will replace the macro in the ad tag URI. + * Macros are designated by square brackets. + * For example: + * Ad tag URI: `"https://doubleclick.google.com/ad/1?geo_id=[geoId]"` + * Ad tag macro map: `{"geoId": "123"}` + * Fully qualified ad tag: + * `"`https://doubleclick.google.com/ad/1?geo_id=123"` + * + * Generated from protobuf field map ad_tag_macro_map = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAdTagMacroMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->ad_tag_macro_map = $arr; + + return $this; + } + + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 9; + * @return \Google\Cloud\Video\Stitcher\V1\ManifestOptions|null + */ + public function getManifestOptions() + { + return $this->manifest_options; + } + + public function hasManifestOptions() + { + return isset($this->manifest_options); + } + + public function clearManifestOptions() + { + unset($this->manifest_options); + } + + /** + * Additional options that affect the output of the manifest. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 9; + * @param \Google\Cloud\Video\Stitcher\V1\ManifestOptions $var + * @return $this + */ + public function setManifestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\ManifestOptions::class); + $this->manifest_options = $var; + + return $this; + } + + /** + * Output only. The generated ID of the VodSession's source media. + * + * Generated from protobuf field string asset_id = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAssetId() + { + return $this->asset_id; + } + + /** + * Output only. The generated ID of the VodSession's source media. + * + * Generated from protobuf field string asset_id = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAssetId($var) + { + GPBUtil::checkString($var, True); + $this->asset_id = $var; + + return $this; + } + + /** + * Required. Determines how the ad should be tracked. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAdTracking() + { + return $this->ad_tracking; + } + + /** + * Required. Determines how the ad should be tracked. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAdTracking($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\AdTracking::class); + $this->ad_tracking = $var; + + return $this; + } + + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession.GamSettings gam_settings = 13; + * @return \Google\Cloud\Video\Stitcher\V1\VodSession\GamSettings|null + */ + public function getGamSettings() + { + return $this->gam_settings; + } + + public function hasGamSettings() + { + return isset($this->gam_settings); + } + + public function clearGamSettings() + { + unset($this->gam_settings); + } + + /** + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.VodSession.GamSettings gam_settings = 13; + * @param \Google\Cloud\Video\Stitcher\V1\VodSession\GamSettings $var + * @return $this + */ + public function setGamSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\VodSession\GamSettings::class); + $this->gam_settings = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession/GamSettings.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession/GamSettings.php new file mode 100644 index 00000000000..8063ccb2bee --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSession/GamSettings.php @@ -0,0 +1,105 @@ +google.cloud.video.stitcher.v1.VodSession.GamSettings + */ +class GamSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_code = ''; + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $stream_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code. + * @type string $stream_id + * Required. The stream ID generated by Ad Manager. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getStreamId() + { + return $this->stream_id; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setStreamId($var) + { + GPBUtil::checkString($var, True); + $this->stream_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GamSettings::class, \Google\Cloud\Video\Stitcher\V1\VodSession_GamSettings::class); + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAd.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAd.php new file mode 100644 index 00000000000..d1b8a1b4410 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAd.php @@ -0,0 +1,171 @@ +google.cloud.video.stitcher.v1.VodSessionAd + */ +class VodSessionAd extends \Google\Protobuf\Internal\Message +{ + /** + * Duration in seconds of the ad. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + /** + * Metadata of companion ads associated with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds companion_ads = 2; + */ + protected $companion_ads = null; + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `MUTE`, `UNMUTE`, `PAUSE`, `CLICK`, + * `CLICK_THROUGH`, `REWIND`, `RESUME`, `ERROR`, `FULLSCREEN`, + * `EXIT_FULLSCREEN`, `EXPAND`, `COLLAPSE`, `ACCEPT_INVITATION_LINEAR`, + * `CLOSE_LINEAR`, `SKIP`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event activity_events = 3; + */ + private $activity_events; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * Duration in seconds of the ad. + * @type \Google\Cloud\Video\Stitcher\V1\CompanionAds $companion_ads + * Metadata of companion ads associated with the ad. + * @type array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $activity_events + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `MUTE`, `UNMUTE`, `PAUSE`, `CLICK`, + * `CLICK_THROUGH`, `REWIND`, `RESUME`, `ERROR`, `FULLSCREEN`, + * `EXIT_FULLSCREEN`, `EXPAND`, `COLLAPSE`, `ACCEPT_INVITATION_LINEAR`, + * `CLOSE_LINEAR`, `SKIP`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Duration in seconds of the ad. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Duration in seconds of the ad. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Metadata of companion ads associated with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds companion_ads = 2; + * @return \Google\Cloud\Video\Stitcher\V1\CompanionAds|null + */ + public function getCompanionAds() + { + return $this->companion_ads; + } + + public function hasCompanionAds() + { + return isset($this->companion_ads); + } + + public function clearCompanionAds() + { + unset($this->companion_ads); + } + + /** + * Metadata of companion ads associated with the ad. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.CompanionAds companion_ads = 2; + * @param \Google\Cloud\Video\Stitcher\V1\CompanionAds $var + * @return $this + */ + public function setCompanionAds($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\CompanionAds::class); + $this->companion_ads = $var; + + return $this; + } + + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `MUTE`, `UNMUTE`, `PAUSE`, `CLICK`, + * `CLICK_THROUGH`, `REWIND`, `RESUME`, `ERROR`, `FULLSCREEN`, + * `EXIT_FULLSCREEN`, `EXPAND`, `COLLAPSE`, `ACCEPT_INVITATION_LINEAR`, + * `CLOSE_LINEAR`, `SKIP`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event activity_events = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActivityEvents() + { + return $this->activity_events; + } + + /** + * The list of progress tracking events for the ad break. These can be of + * the following IAB types: `MUTE`, `UNMUTE`, `PAUSE`, `CLICK`, + * `CLICK_THROUGH`, `REWIND`, `RESUME`, `ERROR`, `FULLSCREEN`, + * `EXIT_FULLSCREEN`, `EXPAND`, `COLLAPSE`, `ACCEPT_INVITATION_LINEAR`, + * `CLOSE_LINEAR`, `SKIP`. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.Event activity_events = 3; + * @param array<\Google\Cloud\Video\Stitcher\V1\Event>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActivityEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\Event::class); + $this->activity_events = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAdBreak.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAdBreak.php new file mode 100644 index 00000000000..688d8754996 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionAdBreak.php @@ -0,0 +1,189 @@ +google.cloud.video.stitcher.v1.VodSessionAdBreak + */ +class VodSessionAdBreak extends \Google\Protobuf\Internal\Message +{ + /** + * List of events that are expected to be triggered, ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.ProgressEvent progress_events = 1; + */ + private $progress_events; + /** + * Ordered list of ads stitched into the ad break. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAd ads = 2; + */ + private $ads; + /** + * Ad break end time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + */ + protected $end_time_offset = null; + /** + * Ad break start time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + */ + protected $start_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\ProgressEvent>|\Google\Protobuf\Internal\RepeatedField $progress_events + * List of events that are expected to be triggered, ordered by time. + * @type array<\Google\Cloud\Video\Stitcher\V1\VodSessionAd>|\Google\Protobuf\Internal\RepeatedField $ads + * Ordered list of ads stitched into the ad break. + * @type \Google\Protobuf\Duration $end_time_offset + * Ad break end time in seconds relative to the start of the VOD asset. + * @type \Google\Protobuf\Duration $start_time_offset + * Ad break start time in seconds relative to the start of the VOD asset. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * List of events that are expected to be triggered, ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.ProgressEvent progress_events = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProgressEvents() + { + return $this->progress_events; + } + + /** + * List of events that are expected to be triggered, ordered by time. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.ProgressEvent progress_events = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\ProgressEvent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProgressEvents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\ProgressEvent::class); + $this->progress_events = $arr; + + return $this; + } + + /** + * Ordered list of ads stitched into the ad break. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAd ads = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAds() + { + return $this->ads; + } + + /** + * Ordered list of ads stitched into the ad break. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.VodSessionAd ads = 2; + * @param array<\Google\Cloud\Video\Stitcher\V1\VodSessionAd>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\VodSessionAd::class); + $this->ads = $arr; + + return $this; + } + + /** + * Ad break end time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * Ad break end time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + + /** + * Ad break start time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Ad break start time in seconds relative to the start of the VOD asset. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionContent.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionContent.php new file mode 100644 index 00000000000..d17cc36f962 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodSessionContent.php @@ -0,0 +1,81 @@ +google.cloud.video.stitcher.v1.VodSessionContent + */ +class VodSessionContent extends \Google\Protobuf\Internal\Message +{ + /** + * The total duration in seconds of the content including the ads stitched + * in. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + */ + protected $duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $duration + * The total duration in seconds of the content including the ads stitched + * in. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * The total duration in seconds of the content including the ads stitched + * in. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * The total duration in seconds of the content including the ads stitched + * in. + * + * Generated from protobuf field .google.protobuf.Duration duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodStitchDetail.php b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodStitchDetail.php new file mode 100644 index 00000000000..5825fd8dc0e --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/proto/src/Google/Cloud/Video/Stitcher/V1/VodStitchDetail.php @@ -0,0 +1,107 @@ +google.cloud.video.stitcher.v1.VodStitchDetail + */ +class VodStitchDetail extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the stitch detail in the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A list of ad processing details for the fetched ad playlist. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdStitchDetail ad_stitch_details = 3; + */ + private $ad_stitch_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the stitch detail in the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * @type array<\Google\Cloud\Video\Stitcher\V1\AdStitchDetail>|\Google\Protobuf\Internal\RepeatedField $ad_stitch_details + * A list of ad processing details for the fetched ad playlist. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\StitchDetails::initOnce(); + parent::__construct($data); + } + + /** + * The name of the stitch detail in the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the stitch detail in the specified VOD session, in the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A list of ad processing details for the fetched ad playlist. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdStitchDetail ad_stitch_details = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdStitchDetails() + { + return $this->ad_stitch_details; + } + + /** + * A list of ad processing details for the fetched ad playlist. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.AdStitchDetail ad_stitch_details = 3; + * @param array<\Google\Cloud\Video\Stitcher\V1\AdStitchDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdStitchDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\AdStitchDetail::class); + $this->ad_stitch_details = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_cdn_key.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_cdn_key.php new file mode 100644 index 00000000000..d4023851810 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_cdn_key.php @@ -0,0 +1,94 @@ +setParent($formattedParent) + ->setCdnKey($cdnKey) + ->setCdnKeyId($cdnKeyId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->createCdnKey($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CdnKey $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $cdnKeyId = '[CDN_KEY_ID]'; + + create_cdn_key_sample($formattedParent, $cdnKeyId); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateCdnKey_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_config.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_config.php new file mode 100644 index 00000000000..5de5cad9076 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_config.php @@ -0,0 +1,108 @@ +setSourceUri($liveConfigSourceUri) + ->setAdTracking($liveConfigAdTracking); + $request = (new CreateLiveConfigRequest()) + ->setParent($formattedParent) + ->setLiveConfigId($liveConfigId) + ->setLiveConfig($liveConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->createLiveConfig($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LiveConfig $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = '[LIVE_CONFIG_ID]'; + $liveConfigSourceUri = '[SOURCE_URI]'; + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + + create_live_config_sample( + $formattedParent, + $liveConfigId, + $liveConfigSourceUri, + $liveConfigAdTracking + ); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateLiveConfig_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_session.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_session.php new file mode 100644 index 00000000000..314ebe4a0f6 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_live_session.php @@ -0,0 +1,85 @@ +setLiveConfig($formattedLiveSessionLiveConfig); + $request = (new CreateLiveSessionRequest()) + ->setParent($formattedParent) + ->setLiveSession($liveSession); + + // Call the API and handle any network failures. + try { + /** @var LiveSession $response */ + $response = $videoStitcherServiceClient->createLiveSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $formattedLiveSessionLiveConfig = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); + + create_live_session_sample($formattedParent, $formattedLiveSessionLiveConfig); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateLiveSession_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_slate.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_slate.php new file mode 100644 index 00000000000..6a2ad70bf06 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_slate.php @@ -0,0 +1,92 @@ +setParent($formattedParent) + ->setSlateId($slateId) + ->setSlate($slate); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->createSlate($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Slate $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $slateId = '[SLATE_ID]'; + + create_slate_sample($formattedParent, $slateId); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateSlate_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_vod_session.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_vod_session.php new file mode 100644 index 00000000000..5a5e4ed6bde --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/create_vod_session.php @@ -0,0 +1,94 @@ +setSourceUri($vodSessionSourceUri) + ->setAdTagUri($vodSessionAdTagUri) + ->setAdTracking($vodSessionAdTracking); + $request = (new CreateVodSessionRequest()) + ->setParent($formattedParent) + ->setVodSession($vodSession); + + // Call the API and handle any network failures. + try { + /** @var VodSession $response */ + $response = $videoStitcherServiceClient->createVodSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $vodSessionSourceUri = '[SOURCE_URI]'; + $vodSessionAdTagUri = '[AD_TAG_URI]'; + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + + create_vod_session_sample( + $formattedParent, + $vodSessionSourceUri, + $vodSessionAdTagUri, + $vodSessionAdTracking + ); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateVodSession_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php new file mode 100644 index 00000000000..c79b4d1fac4 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->deleteCdnKey($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + + delete_cdn_key_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_DeleteCdnKey_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_live_config.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_live_config.php new file mode 100644 index 00000000000..e2440ebbe25 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_live_config.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->deleteLiveConfig($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); + + delete_live_config_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_DeleteLiveConfig_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_slate.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_slate.php new file mode 100644 index 00000000000..72ceafadff7 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/delete_slate.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->deleteSlate($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + + delete_slate_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_DeleteSlate_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_cdn_key.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_cdn_key.php new file mode 100644 index 00000000000..4ce3c6c62e6 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_cdn_key.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CdnKey $response */ + $response = $videoStitcherServiceClient->getCdnKey($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + + get_cdn_key_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetCdnKey_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_ad_tag_detail.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_ad_tag_detail.php new file mode 100644 index 00000000000..d0f7dd893ec --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_ad_tag_detail.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var LiveAdTagDetail $response */ + $response = $videoStitcherServiceClient->getLiveAdTagDetail($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::liveAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_SESSION]', + '[LIVE_AD_TAG_DETAIL]' + ); + + get_live_ad_tag_detail_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetLiveAdTagDetail_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_config.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_config.php new file mode 100644 index 00000000000..f7382b0689b --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_config.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var LiveConfig $response */ + $response = $videoStitcherServiceClient->getLiveConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); + + get_live_config_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetLiveConfig_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_session.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_session.php new file mode 100644 index 00000000000..6bba8e76d34 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_live_session.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var LiveSession $response */ + $response = $videoStitcherServiceClient->getLiveSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::liveSessionName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_SESSION]' + ); + + get_live_session_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetLiveSession_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_slate.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_slate.php new file mode 100644 index 00000000000..85ec62872a6 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_slate.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Slate $response */ + $response = $videoStitcherServiceClient->getSlate($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + + get_slate_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetSlate_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php new file mode 100644 index 00000000000..100e6a83ded --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VodAdTagDetail $response */ + $response = $videoStitcherServiceClient->getVodAdTagDetail($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::vodAdTagDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_AD_TAG_DETAIL]' + ); + + get_vod_ad_tag_detail_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetVodAdTagDetail_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_session.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_session.php new file mode 100644 index 00000000000..ba90e1e43d5 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_session.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VodSession $response */ + $response = $videoStitcherServiceClient->getVodSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::vodSessionName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]' + ); + + get_vod_session_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetVodSession_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php new file mode 100644 index 00000000000..41e6cee9bb9 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VodStitchDetail $response */ + $response = $videoStitcherServiceClient->getVodStitchDetail($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VideoStitcherServiceClient::vodStitchDetailName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]', + '[VOD_STITCH_DETAIL]' + ); + + get_vod_stitch_detail_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetVodStitchDetail_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_cdn_keys.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_cdn_keys.php new file mode 100644 index 00000000000..7baa8841e2e --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_cdn_keys.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listCdnKeys($request); + + /** @var CdnKey $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_cdn_keys_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListCdnKeys_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_ad_tag_details.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_ad_tag_details.php new file mode 100644 index 00000000000..ff2d434ccf4 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_ad_tag_details.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listLiveAdTagDetails($request); + + /** @var LiveAdTagDetail $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::liveSessionName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_SESSION]' + ); + + list_live_ad_tag_details_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListLiveAdTagDetails_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_configs.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_configs.php new file mode 100644 index 00000000000..35e61ee3456 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_live_configs.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listLiveConfigs($request); + + /** @var LiveConfig $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_live_configs_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListLiveConfigs_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_slates.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_slates.php new file mode 100644 index 00000000000..50169af4a1c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_slates.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listSlates($request); + + /** @var Slate $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_slates_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListSlates_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php new file mode 100644 index 00000000000..fe57aceefba --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php @@ -0,0 +1,81 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listVodAdTagDetails($request); + + /** @var VodAdTagDetail $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::vodSessionName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]' + ); + + list_vod_ad_tag_details_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListVodAdTagDetails_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php new file mode 100644 index 00000000000..a6176994b58 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $videoStitcherServiceClient->listVodStitchDetails($request); + + /** @var VodStitchDetail $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VideoStitcherServiceClient::vodSessionName( + '[PROJECT]', + '[LOCATION]', + '[VOD_SESSION]' + ); + + list_vod_stitch_details_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListVodStitchDetails_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_cdn_key.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_cdn_key.php new file mode 100644 index 00000000000..4e4eb987519 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_cdn_key.php @@ -0,0 +1,75 @@ +setCdnKey($cdnKey) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->updateCdnKey($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CdnKey $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END videostitcher_v1_generated_VideoStitcherService_UpdateCdnKey_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_slate.php b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_slate.php new file mode 100644 index 00000000000..f2a1f513cf0 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/samples/V1/VideoStitcherServiceClient/update_slate.php @@ -0,0 +1,74 @@ +setSlate($slate) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->updateSlate($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Slate $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END videostitcher_v1_generated_VideoStitcherService_UpdateSlate_sync] diff --git a/owl-bot-staging/VideoStitcher/v1/src/V1/Client/VideoStitcherServiceClient.php b/owl-bot-staging/VideoStitcher/v1/src/V1/Client/VideoStitcherServiceClient.php new file mode 100644 index 00000000000..515788cbe00 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/src/V1/Client/VideoStitcherServiceClient.php @@ -0,0 +1,1111 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/video_stitcher_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/video_stitcher_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/video_stitcher_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/video_stitcher_service_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a cdn_key + * resource. + * + * @param string $project + * @param string $location + * @param string $cdnKey + * + * @return string The formatted cdn_key resource. + */ + public static function cdnKeyName(string $project, string $location, string $cdnKey): string + { + return self::getPathTemplate('cdnKey')->render([ + 'project' => $project, + 'location' => $location, + 'cdn_key' => $cdnKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * live_ad_tag_detail resource. + * + * @param string $project + * @param string $location + * @param string $liveSession + * @param string $liveAdTagDetail + * + * @return string The formatted live_ad_tag_detail resource. + */ + public static function liveAdTagDetailName(string $project, string $location, string $liveSession, string $liveAdTagDetail): string + { + return self::getPathTemplate('liveAdTagDetail')->render([ + 'project' => $project, + 'location' => $location, + 'live_session' => $liveSession, + 'live_ad_tag_detail' => $liveAdTagDetail, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a live_config + * resource. + * + * @param string $project + * @param string $location + * @param string $liveConfig + * + * @return string The formatted live_config resource. + */ + public static function liveConfigName(string $project, string $location, string $liveConfig): string + { + return self::getPathTemplate('liveConfig')->render([ + 'project' => $project, + 'location' => $location, + 'live_config' => $liveConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a live_session + * resource. + * + * @param string $project + * @param string $location + * @param string $liveSession + * + * @return string The formatted live_session resource. + */ + public static function liveSessionName(string $project, string $location, string $liveSession): string + { + return self::getPathTemplate('liveSession')->render([ + 'project' => $project, + 'location' => $location, + 'live_session' => $liveSession, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a slate + * resource. + * + * @param string $project + * @param string $location + * @param string $slate + * + * @return string The formatted slate resource. + */ + public static function slateName(string $project, string $location, string $slate): string + { + return self::getPathTemplate('slate')->render([ + 'project' => $project, + 'location' => $location, + 'slate' => $slate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vod_ad_tag_detail resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * @param string $vodAdTagDetail + * + * @return string The formatted vod_ad_tag_detail resource. + */ + public static function vodAdTagDetailName(string $project, string $location, string $vodSession, string $vodAdTagDetail): string + { + return self::getPathTemplate('vodAdTagDetail')->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + 'vod_ad_tag_detail' => $vodAdTagDetail, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a vod_session + * resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * + * @return string The formatted vod_session resource. + */ + public static function vodSessionName(string $project, string $location, string $vodSession): string + { + return self::getPathTemplate('vodSession')->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vod_stitch_detail resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * @param string $vodStitchDetail + * + * @return string The formatted vod_stitch_detail resource. + */ + public static function vodStitchDetailName(string $project, string $location, string $vodSession, string $vodStitchDetail): string + { + return self::getPathTemplate('vodStitchDetail')->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + 'vod_stitch_detail' => $vodStitchDetail, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cdnKey: projects/{project}/locations/{location}/cdnKeys/{cdn_key} + * - liveAdTagDetail: projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail} + * - liveConfig: projects/{project}/locations/{location}/liveConfigs/{live_config} + * - liveSession: projects/{project}/locations/{location}/liveSessions/{live_session} + * - location: projects/{project}/locations/{location} + * - slate: projects/{project}/locations/{location}/slates/{slate} + * - vodAdTagDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail} + * - vodSession: projects/{project}/locations/{location}/vodSessions/{vod_session} + * - vodStitchDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'videostitcher.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new CDN key. + * + * The async variant is {@see VideoStitcherServiceClient::createCdnKeyAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/create_cdn_key.php + * + * @param CreateCdnKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createCdnKey(CreateCdnKeyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateCdnKey', $request, $callOptions)->wait(); + } + + /** + * Registers the live config with the provided unique ID in + * the specified region. + * + * The async variant is {@see VideoStitcherServiceClient::createLiveConfigAsync()} + * . + * + * @example samples/V1/VideoStitcherServiceClient/create_live_config.php + * + * @param CreateLiveConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createLiveConfig(CreateLiveConfigRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateLiveConfig', $request, $callOptions)->wait(); + } + + /** + * Creates a new live session. + * + * The async variant is {@see VideoStitcherServiceClient::createLiveSessionAsync()} + * . + * + * @example samples/V1/VideoStitcherServiceClient/create_live_session.php + * + * @param CreateLiveSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 LiveSession + * + * @throws ApiException Thrown if the API call fails. + */ + public function createLiveSession(CreateLiveSessionRequest $request, array $callOptions = []): LiveSession + { + return $this->startApiCall('CreateLiveSession', $request, $callOptions)->wait(); + } + + /** + * Creates a slate. + * + * The async variant is {@see VideoStitcherServiceClient::createSlateAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/create_slate.php + * + * @param CreateSlateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSlate(CreateSlateRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateSlate', $request, $callOptions)->wait(); + } + + /** + * Creates a client side playback VOD session and returns the full + * tracking and playback metadata of the session. + * + * The async variant is {@see VideoStitcherServiceClient::createVodSessionAsync()} + * . + * + * @example samples/V1/VideoStitcherServiceClient/create_vod_session.php + * + * @param CreateVodSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 VodSession + * + * @throws ApiException Thrown if the API call fails. + */ + public function createVodSession(CreateVodSessionRequest $request, array $callOptions = []): VodSession + { + return $this->startApiCall('CreateVodSession', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified CDN key. + * + * The async variant is {@see VideoStitcherServiceClient::deleteCdnKeyAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/delete_cdn_key.php + * + * @param DeleteCdnKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteCdnKey(DeleteCdnKeyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteCdnKey', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified live config. + * + * The async variant is {@see VideoStitcherServiceClient::deleteLiveConfigAsync()} + * . + * + * @example samples/V1/VideoStitcherServiceClient/delete_live_config.php + * + * @param DeleteLiveConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteLiveConfig(DeleteLiveConfigRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteLiveConfig', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified slate. + * + * The async variant is {@see VideoStitcherServiceClient::deleteSlateAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/delete_slate.php + * + * @param DeleteSlateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSlate(DeleteSlateRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteSlate', $request, $callOptions)->wait(); + } + + /** + * Returns the specified CDN key. + * + * The async variant is {@see VideoStitcherServiceClient::getCdnKeyAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_cdn_key.php + * + * @param GetCdnKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 CdnKey + * + * @throws ApiException Thrown if the API call fails. + */ + public function getCdnKey(GetCdnKeyRequest $request, array $callOptions = []): CdnKey + { + return $this->startApiCall('GetCdnKey', $request, $callOptions)->wait(); + } + + /** + * Returns the specified ad tag detail for the specified live session. + * + * The async variant is + * {@see VideoStitcherServiceClient::getLiveAdTagDetailAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_live_ad_tag_detail.php + * + * @param GetLiveAdTagDetailRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 LiveAdTagDetail + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLiveAdTagDetail(GetLiveAdTagDetailRequest $request, array $callOptions = []): LiveAdTagDetail + { + return $this->startApiCall('GetLiveAdTagDetail', $request, $callOptions)->wait(); + } + + /** + * Returns the specified live config managed by the Video + * Stitcher service. + * + * The async variant is {@see VideoStitcherServiceClient::getLiveConfigAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_live_config.php + * + * @param GetLiveConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 LiveConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLiveConfig(GetLiveConfigRequest $request, array $callOptions = []): LiveConfig + { + return $this->startApiCall('GetLiveConfig', $request, $callOptions)->wait(); + } + + /** + * Returns the details for the specified live session. + * + * The async variant is {@see VideoStitcherServiceClient::getLiveSessionAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_live_session.php + * + * @param GetLiveSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 LiveSession + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLiveSession(GetLiveSessionRequest $request, array $callOptions = []): LiveSession + { + return $this->startApiCall('GetLiveSession', $request, $callOptions)->wait(); + } + + /** + * Returns the specified slate. + * + * The async variant is {@see VideoStitcherServiceClient::getSlateAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_slate.php + * + * @param GetSlateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Slate + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSlate(GetSlateRequest $request, array $callOptions = []): Slate + { + return $this->startApiCall('GetSlate', $request, $callOptions)->wait(); + } + + /** + * Returns the specified ad tag detail for the specified VOD session. + * + * The async variant is {@see VideoStitcherServiceClient::getVodAdTagDetailAsync()} + * . + * + * @example samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php + * + * @param GetVodAdTagDetailRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 VodAdTagDetail + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVodAdTagDetail(GetVodAdTagDetailRequest $request, array $callOptions = []): VodAdTagDetail + { + return $this->startApiCall('GetVodAdTagDetail', $request, $callOptions)->wait(); + } + + /** + * Returns the full tracking, playback metadata, and relevant ad-ops + * logs for the specified VOD session. + * + * The async variant is {@see VideoStitcherServiceClient::getVodSessionAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_vod_session.php + * + * @param GetVodSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 VodSession + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVodSession(GetVodSessionRequest $request, array $callOptions = []): VodSession + { + return $this->startApiCall('GetVodSession', $request, $callOptions)->wait(); + } + + /** + * Returns the specified stitching information for the specified VOD session. + * + * The async variant is + * {@see VideoStitcherServiceClient::getVodStitchDetailAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php + * + * @param GetVodStitchDetailRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 VodStitchDetail + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVodStitchDetail(GetVodStitchDetailRequest $request, array $callOptions = []): VodStitchDetail + { + return $this->startApiCall('GetVodStitchDetail', $request, $callOptions)->wait(); + } + + /** + * Lists all CDN keys in the specified project and location. + * + * The async variant is {@see VideoStitcherServiceClient::listCdnKeysAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_cdn_keys.php + * + * @param ListCdnKeysRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listCdnKeys(ListCdnKeysRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCdnKeys', $request, $callOptions); + } + + /** + * Return the list of ad tag details for the specified live session. + * + * The async variant is + * {@see VideoStitcherServiceClient::listLiveAdTagDetailsAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_live_ad_tag_details.php + * + * @param ListLiveAdTagDetailsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLiveAdTagDetails(ListLiveAdTagDetailsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLiveAdTagDetails', $request, $callOptions); + } + + /** + * Lists all live configs managed by the Video Stitcher that + * belong to the specified project and region. + * + * The async variant is {@see VideoStitcherServiceClient::listLiveConfigsAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_live_configs.php + * + * @param ListLiveConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLiveConfigs(ListLiveConfigsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLiveConfigs', $request, $callOptions); + } + + /** + * Lists all slates in the specified project and location. + * + * The async variant is {@see VideoStitcherServiceClient::listSlatesAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_slates.php + * + * @param ListSlatesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSlates(ListSlatesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSlates', $request, $callOptions); + } + + /** + * Return the list of ad tag details for the specified VOD session. + * + * The async variant is + * {@see VideoStitcherServiceClient::listVodAdTagDetailsAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php + * + * @param ListVodAdTagDetailsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listVodAdTagDetails(ListVodAdTagDetailsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListVodAdTagDetails', $request, $callOptions); + } + + /** + * Returns a list of detailed stitching information of the specified VOD + * session. + * + * The async variant is + * {@see VideoStitcherServiceClient::listVodStitchDetailsAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php + * + * @param ListVodStitchDetailsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listVodStitchDetails(ListVodStitchDetailsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListVodStitchDetails', $request, $callOptions); + } + + /** + * Updates the specified CDN key. Only update fields specified + * in the call method body. + * + * The async variant is {@see VideoStitcherServiceClient::updateCdnKeyAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/update_cdn_key.php + * + * @param UpdateCdnKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateCdnKey(UpdateCdnKeyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateCdnKey', $request, $callOptions)->wait(); + } + + /** + * Updates the specified slate. + * + * The async variant is {@see VideoStitcherServiceClient::updateSlateAsync()} . + * + * @example samples/V1/VideoStitcherServiceClient/update_slate.php + * + * @param UpdateSlateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSlate(UpdateSlateRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateSlate', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/VideoStitcher/v1/src/V1/Gapic/VideoStitcherServiceGapicClient.php b/owl-bot-staging/VideoStitcher/v1/src/V1/Gapic/VideoStitcherServiceGapicClient.php new file mode 100644 index 00000000000..6f6069da48c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/src/V1/Gapic/VideoStitcherServiceGapicClient.php @@ -0,0 +1,2066 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $cdnKey = new CdnKey(); + * $cdnKeyId = 'cdn_key_id'; + * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Video\Stitcher\V1\Client\VideoStitcherServiceClient}. + */ +class VideoStitcherServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.video.stitcher.v1.VideoStitcherService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'videostitcher.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'videostitcher.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 static $cdnKeyNameTemplate; + + private static $liveAdTagDetailNameTemplate; + + private static $liveConfigNameTemplate; + + private static $liveSessionNameTemplate; + + private static $locationNameTemplate; + + private static $slateNameTemplate; + + private static $vodAdTagDetailNameTemplate; + + private static $vodSessionNameTemplate; + + private static $vodStitchDetailNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/video_stitcher_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/video_stitcher_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/video_stitcher_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/video_stitcher_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getCdnKeyNameTemplate() + { + if (self::$cdnKeyNameTemplate == null) { + self::$cdnKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/cdnKeys/{cdn_key}'); + } + + return self::$cdnKeyNameTemplate; + } + + private static function getLiveAdTagDetailNameTemplate() + { + if (self::$liveAdTagDetailNameTemplate == null) { + self::$liveAdTagDetailNameTemplate = new PathTemplate('projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}'); + } + + return self::$liveAdTagDetailNameTemplate; + } + + private static function getLiveConfigNameTemplate() + { + if (self::$liveConfigNameTemplate == null) { + self::$liveConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/liveConfigs/{live_config}'); + } + + return self::$liveConfigNameTemplate; + } + + private static function getLiveSessionNameTemplate() + { + if (self::$liveSessionNameTemplate == null) { + self::$liveSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/liveSessions/{live_session}'); + } + + return self::$liveSessionNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getSlateNameTemplate() + { + if (self::$slateNameTemplate == null) { + self::$slateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/slates/{slate}'); + } + + return self::$slateNameTemplate; + } + + private static function getVodAdTagDetailNameTemplate() + { + if (self::$vodAdTagDetailNameTemplate == null) { + self::$vodAdTagDetailNameTemplate = new PathTemplate('projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail}'); + } + + return self::$vodAdTagDetailNameTemplate; + } + + private static function getVodSessionNameTemplate() + { + if (self::$vodSessionNameTemplate == null) { + self::$vodSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/vodSessions/{vod_session}'); + } + + return self::$vodSessionNameTemplate; + } + + private static function getVodStitchDetailNameTemplate() + { + if (self::$vodStitchDetailNameTemplate == null) { + self::$vodStitchDetailNameTemplate = new PathTemplate('projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail}'); + } + + return self::$vodStitchDetailNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'cdnKey' => self::getCdnKeyNameTemplate(), + 'liveAdTagDetail' => self::getLiveAdTagDetailNameTemplate(), + 'liveConfig' => self::getLiveConfigNameTemplate(), + 'liveSession' => self::getLiveSessionNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'slate' => self::getSlateNameTemplate(), + 'vodAdTagDetail' => self::getVodAdTagDetailNameTemplate(), + 'vodSession' => self::getVodSessionNameTemplate(), + 'vodStitchDetail' => self::getVodStitchDetailNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a cdn_key + * resource. + * + * @param string $project + * @param string $location + * @param string $cdnKey + * + * @return string The formatted cdn_key resource. + */ + public static function cdnKeyName($project, $location, $cdnKey) + { + return self::getCdnKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cdn_key' => $cdnKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * live_ad_tag_detail resource. + * + * @param string $project + * @param string $location + * @param string $liveSession + * @param string $liveAdTagDetail + * + * @return string The formatted live_ad_tag_detail resource. + */ + public static function liveAdTagDetailName($project, $location, $liveSession, $liveAdTagDetail) + { + return self::getLiveAdTagDetailNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'live_session' => $liveSession, + 'live_ad_tag_detail' => $liveAdTagDetail, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a live_config + * resource. + * + * @param string $project + * @param string $location + * @param string $liveConfig + * + * @return string The formatted live_config resource. + */ + public static function liveConfigName($project, $location, $liveConfig) + { + return self::getLiveConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'live_config' => $liveConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a live_session + * resource. + * + * @param string $project + * @param string $location + * @param string $liveSession + * + * @return string The formatted live_session resource. + */ + public static function liveSessionName($project, $location, $liveSession) + { + return self::getLiveSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'live_session' => $liveSession, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a slate + * resource. + * + * @param string $project + * @param string $location + * @param string $slate + * + * @return string The formatted slate resource. + */ + public static function slateName($project, $location, $slate) + { + return self::getSlateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'slate' => $slate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vod_ad_tag_detail resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * @param string $vodAdTagDetail + * + * @return string The formatted vod_ad_tag_detail resource. + */ + public static function vodAdTagDetailName($project, $location, $vodSession, $vodAdTagDetail) + { + return self::getVodAdTagDetailNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + 'vod_ad_tag_detail' => $vodAdTagDetail, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a vod_session + * resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * + * @return string The formatted vod_session resource. + */ + public static function vodSessionName($project, $location, $vodSession) + { + return self::getVodSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vod_stitch_detail resource. + * + * @param string $project + * @param string $location + * @param string $vodSession + * @param string $vodStitchDetail + * + * @return string The formatted vod_stitch_detail resource. + */ + public static function vodStitchDetailName($project, $location, $vodSession, $vodStitchDetail) + { + return self::getVodStitchDetailNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'vod_session' => $vodSession, + 'vod_stitch_detail' => $vodStitchDetail, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cdnKey: projects/{project}/locations/{location}/cdnKeys/{cdn_key} + * - liveAdTagDetail: projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail} + * - liveConfig: projects/{project}/locations/{location}/liveConfigs/{live_config} + * - liveSession: projects/{project}/locations/{location}/liveSessions/{live_session} + * - location: projects/{project}/locations/{location} + * - slate: projects/{project}/locations/{location}/slates/{slate} + * - vodAdTagDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail} + * - vodSession: projects/{project}/locations/{location}/vodSessions/{vod_session} + * - vodStitchDetail: projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'videostitcher.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); + } + + /** + * Creates a new CDN key. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $cdnKey = new CdnKey(); + * $cdnKeyId = 'cdn_key_id'; + * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. + * @param CdnKey $cdnKey Required. The CDN key resource to create. + * @param string $cdnKeyId Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. + * + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * @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 createCdnKey($parent, $cdnKey, $cdnKeyId, array $optionalArgs = []) + { + $request = new CreateCdnKeyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setCdnKey($cdnKey); + $request->setCdnKeyId($cdnKeyId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateCdnKey', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Registers the live config with the provided unique ID in + * the specified region. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $liveConfigId = 'live_config_id'; + * $liveConfig = new LiveConfig(); + * $operationResponse = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + * $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 = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createLiveConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * @param string $liveConfigId Required. The unique identifier ID to use for the live config. + * @param LiveConfig $liveConfig Required. The live config resource to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 createLiveConfig($parent, $liveConfigId, $liveConfig, array $optionalArgs = []) + { + $request = new CreateLiveConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLiveConfigId($liveConfigId); + $request->setLiveConfig($liveConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateLiveConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new live session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $liveSession = new LiveSession(); + * $response = $videoStitcherServiceClient->createLiveSession($formattedParent, $liveSession); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * @param LiveSession $liveSession Required. Parameters for creating a live session. + * @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\Cloud\Video\Stitcher\V1\LiveSession + * + * @throws ApiException if the remote call fails + */ + public function createLiveSession($parent, $liveSession, array $optionalArgs = []) + { + $request = new CreateLiveSessionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLiveSession($liveSession); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateLiveSession', LiveSession::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a slate. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $slateId = 'slate_id'; + * $slate = new Slate(); + * $operationResponse = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); + * $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 = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the slate should be created, in the form of + * `projects/{project_number}/locations/{location}`. + * @param string $slateId Required. The unique identifier for the slate. + * This value should conform to RFC-1034, which restricts to + * lower-case letters, numbers, and hyphen, with the first character a + * letter, the last a letter or a number, and a 63 character maximum. + * @param Slate $slate Required. The slate to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported `(00000000-0000-0000-0000-000000000000)`. + * @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 createSlate($parent, $slateId, $slate, array $optionalArgs = []) + { + $request = new CreateSlateRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSlateId($slateId); + $request->setSlate($slate); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateSlate', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a client side playback VOD session and returns the full + * tracking and playback metadata of the session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $vodSession = new VodSession(); + * $response = $videoStitcherServiceClient->createVodSession($formattedParent, $vodSession); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. + * @param VodSession $vodSession Required. Parameters for creating a session. + * @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\Cloud\Video\Stitcher\V1\VodSession + * + * @throws ApiException if the remote call fails + */ + public function createVodSession($parent, $vodSession, array $optionalArgs = []) + { + $request = new CreateVodSessionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setVodSession($vodSession); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateVodSession', VodSession::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified CDN key. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + * $operationResponse = $videoStitcherServiceClient->deleteCdnKey($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteCdnKey($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the CDN key to be deleted, in the form of + * `projects/{project_number}/locations/{location}/cdnKeys/{id}`. + * @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 deleteCdnKey($name, array $optionalArgs = []) + { + $request = new DeleteCdnKeyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteCdnKey', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified live config. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + * $operationResponse = $videoStitcherServiceClient->deleteLiveConfig($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteLiveConfig($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteLiveConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * @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 deleteLiveConfig($name, array $optionalArgs = []) + { + $request = new DeleteLiveConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteLiveConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified slate. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + * $operationResponse = $videoStitcherServiceClient->deleteSlate($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteSlate($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the slate to be deleted, in the form of + * `projects/{project_number}/locations/{location}/slates/{id}`. + * @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 deleteSlate($name, array $optionalArgs = []) + { + $request = new DeleteSlateRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteSlate', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns the specified CDN key. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + * $response = $videoStitcherServiceClient->getCdnKey($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the CDN key to be retrieved, in the form of + * `projects/{project}/locations/{location}/cdnKeys/{id}`. + * @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\Cloud\Video\Stitcher\V1\CdnKey + * + * @throws ApiException if the remote call fails + */ + public function getCdnKey($name, array $optionalArgs = []) + { + $request = new GetCdnKeyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetCdnKey', CdnKey::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified ad tag detail for the specified live session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); + * $response = $videoStitcherServiceClient->getLiveAdTagDetail($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}`. + * @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\Cloud\Video\Stitcher\V1\LiveAdTagDetail + * + * @throws ApiException if the remote call fails + */ + public function getLiveAdTagDetail($name, array $optionalArgs = []) + { + $request = new GetLiveAdTagDetailRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLiveAdTagDetail', LiveAdTagDetail::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified live config managed by the Video + * Stitcher service. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + * $response = $videoStitcherServiceClient->getLiveConfig($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * @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\Cloud\Video\Stitcher\V1\LiveConfig + * + * @throws ApiException if the remote call fails + */ + public function getLiveConfig($name, array $optionalArgs = []) + { + $request = new GetLiveConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLiveConfig', LiveConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the details for the specified live session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + * $response = $videoStitcherServiceClient->getLiveSession($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the live session, in the form of + * `projects/{project_number}/locations/{location}/liveSessions/{id}`. + * @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\Cloud\Video\Stitcher\V1\LiveSession + * + * @throws ApiException if the remote call fails + */ + public function getLiveSession($name, array $optionalArgs = []) + { + $request = new GetLiveSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLiveSession', LiveSession::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified slate. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + * $response = $videoStitcherServiceClient->getSlate($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. + * @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\Cloud\Video\Stitcher\V1\Slate + * + * @throws ApiException if the remote call fails + */ + public function getSlate($name, array $optionalArgs = []) + { + $request = new GetSlateRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSlate', Slate::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified ad tag detail for the specified VOD session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); + * $response = $videoStitcherServiceClient->getVodAdTagDetail($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the ad tag detail for the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. + * @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\Cloud\Video\Stitcher\V1\VodAdTagDetail + * + * @throws ApiException if the remote call fails + */ + public function getVodAdTagDetail($name, array $optionalArgs = []) + { + $request = new GetVodAdTagDetailRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVodAdTagDetail', VodAdTagDetail::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the full tracking, playback metadata, and relevant ad-ops + * logs for the specified VOD session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + * $response = $videoStitcherServiceClient->getVodSession($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the VOD session to be retrieved, in the form of + * `projects/{project_number}/locations/{location}/vodSessions/{id}`. + * @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\Cloud\Video\Stitcher\V1\VodSession + * + * @throws ApiException if the remote call fails + */ + public function getVodSession($name, array $optionalArgs = []) + { + $request = new GetVodSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVodSession', VodSession::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the specified stitching information for the specified VOD session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); + * $response = $videoStitcherServiceClient->getVodStitchDetail($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the stitch detail in the specified VOD session, in + * the form of + * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. + * @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\Cloud\Video\Stitcher\V1\VodStitchDetail + * + * @throws ApiException if the remote call fails + */ + public function getVodStitchDetail($name, array $optionalArgs = []) + { + $request = new GetVodStitchDetailRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVodStitchDetail', VodStitchDetail::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all CDN keys in the specified project and location. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listCdnKeys($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listCdnKeys($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project that contains the list of CDN keys, in the form of + * `projects/{project_number}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listCdnKeys($parent, array $optionalArgs = []) + { + $request = new ListCdnKeysRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCdnKeys', $optionalArgs, ListCdnKeysResponse::class, $request); + } + + /** + * Return the list of ad tag details for the specified live session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listLiveAdTagDetails($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listLiveAdTagDetails($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource parent in the form of + * `projects/{project}/locations/{location}/liveSessions/{live_session}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLiveAdTagDetails($parent, array $optionalArgs = []) + { + $request = new ListLiveAdTagDetailsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLiveAdTagDetails', $optionalArgs, ListLiveAdTagDetailsResponse::class, $request); + } + + /** + * Lists all live configs managed by the Video Stitcher that + * belong to the specified project and region. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * @type string $orderBy + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLiveConfigs($parent, array $optionalArgs = []) + { + $request = new ListLiveConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLiveConfigs', $optionalArgs, ListLiveConfigsResponse::class, $request); + } + + /** + * Lists all slates in the specified project and location. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listSlates($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listSlates($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSlates($parent, array $optionalArgs = []) + { + $request = new ListSlatesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSlates', $optionalArgs, ListSlatesResponse::class, $request); + } + + /** + * Return the list of ad tag details for the specified VOD session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listVodAdTagDetails($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listVodAdTagDetails($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVodAdTagDetails($parent, array $optionalArgs = []) + { + $request = new ListVodAdTagDetailsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVodAdTagDetails', $optionalArgs, ListVodAdTagDetailsResponse::class, $request); + } + + /** + * Returns a list of detailed stitching information of the specified VOD + * session. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listVodStitchDetails($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listVodStitchDetails($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVodStitchDetails($parent, array $optionalArgs = []) + { + $request = new ListVodStitchDetailsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVodStitchDetails', $optionalArgs, ListVodStitchDetailsResponse::class, $request); + } + + /** + * Updates the specified CDN key. Only update fields specified + * in the call method body. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $cdnKey = new CdnKey(); + * $updateMask = new FieldMask(); + * $operationResponse = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); + * $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 = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param CdnKey $cdnKey Required. The CDN key resource which replaces the resource on the server. + * @param FieldMask $updateMask Required. The update mask applies to the resource. + * For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 updateCdnKey($cdnKey, $updateMask, array $optionalArgs = []) + { + $request = new UpdateCdnKeyRequest(); + $requestParamHeaders = []; + $request->setCdnKey($cdnKey); + $request->setUpdateMask($updateMask); + $requestParamHeaders['cdn_key.name'] = $cdnKey->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateCdnKey', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified slate. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $slate = new Slate(); + * $updateMask = new FieldMask(); + * $operationResponse = $videoStitcherServiceClient->updateSlate($slate, $updateMask); + * $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 = $videoStitcherServiceClient->updateSlate($slate, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param Slate $slate Required. The resource with updated fields. + * @param FieldMask $updateMask Required. The update mask which specifies fields which should be updated. + * @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 updateSlate($slate, $updateMask, array $optionalArgs = []) + { + $request = new UpdateSlateRequest(); + $requestParamHeaders = []; + $request->setSlate($slate); + $request->setUpdateMask($updateMask); + $requestParamHeaders['slate.name'] = $slate->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateSlate', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/VideoStitcher/v1/src/V1/VideoStitcherServiceClient.php b/owl-bot-staging/VideoStitcher/v1/src/V1/VideoStitcherServiceClient.php new file mode 100644 index 00000000000..791f4020756 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/src/V1/VideoStitcherServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.video.stitcher.v1.VideoStitcherService' => [ + 'CreateCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\CdnKey', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateLiveConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\LiveConfig', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\Slate', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteLiveConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\CdnKey', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'cdn_key.name', + 'fieldAccessors' => [ + 'getCdnKey', + 'getName', + ], + ], + ], + ], + 'UpdateSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\Slate', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'slate.name', + 'fieldAccessors' => [ + 'getSlate', + 'getName', + ], + ], + ], + ], + 'CreateLiveSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\LiveSession', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateVodSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\VodSession', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetCdnKey' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\CdnKey', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveAdTagDetail' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\LiveConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\LiveSession', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSlate' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\Slate', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVodAdTagDetail' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\VodAdTagDetail', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVodSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\VodSession', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVodStitchDetail' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\VodStitchDetail', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListCdnKeys' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCdnKeys', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListCdnKeysResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLiveAdTagDetails' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLiveAdTagDetails', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLiveConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLiveConfigs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListLiveConfigsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListSlates' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSlates', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListSlatesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListVodAdTagDetails' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getVodAdTagDetails', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListVodStitchDetails' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getVodStitchDetails', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'cdnKey' => 'projects/{project}/locations/{location}/cdnKeys/{cdn_key}', + 'liveAdTagDetail' => 'projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail}', + 'liveConfig' => 'projects/{project}/locations/{location}/liveConfigs/{live_config}', + 'liveSession' => 'projects/{project}/locations/{location}/liveSessions/{live_session}', + 'location' => 'projects/{project}/locations/{location}', + 'slate' => 'projects/{project}/locations/{location}/slates/{slate}', + 'vodAdTagDetail' => 'projects/{project}/locations/{location}/vodSessions/{vod_session}/vodAdTagDetails/{vod_ad_tag_detail}', + 'vodSession' => 'projects/{project}/locations/{location}/vodSessions/{vod_session}', + 'vodStitchDetail' => 'projects/{project}/locations/{location}/vodSessions/{vod_session}/vodStitchDetails/{vod_stitch_detail}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VideoStitcher/v1/src/V1/resources/video_stitcher_service_rest_client_config.php b/owl-bot-staging/VideoStitcher/v1/src/V1/resources/video_stitcher_service_rest_client_config.php new file mode 100644 index 00000000000..d6dd5bc244c --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/src/V1/resources/video_stitcher_service_rest_client_config.php @@ -0,0 +1,344 @@ + [ + 'google.cloud.video.stitcher.v1.VideoStitcherService' => [ + 'CreateCdnKey' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/cdnKeys', + 'body' => 'cdn_key', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cdn_key_id', + ], + ], + 'CreateLiveConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveConfigs', + 'body' => 'live_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'live_config_id', + ], + ], + 'CreateLiveSession' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveSessions', + 'body' => 'live_session', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSlate' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/slates', + 'body' => 'slate', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'slate_id', + ], + ], + 'CreateVodSession' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/vodSessions', + 'body' => 'vod_session', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteCdnKey' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/cdnKeys/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteLiveConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSlate' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/slates/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCdnKey' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/cdnKeys/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveAdTagDetail' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveSessions/*/liveAdTagDetails/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLiveSession' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveSessions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSlate' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/slates/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVodAdTagDetail' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/vodSessions/*/vodAdTagDetails/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVodSession' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/vodSessions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVodStitchDetail' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/vodSessions/*/vodStitchDetails/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListCdnKeys' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/cdnKeys', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListLiveAdTagDetails' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/liveSessions/*}/liveAdTagDetails', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListLiveConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSlates' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/slates', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListVodAdTagDetails' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/vodSessions/*}/vodAdTagDetails', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListVodStitchDetails' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/vodSessions/*}/vodStitchDetails', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateCdnKey' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{cdn_key.name=projects/*/locations/*/cdnKeys/*}', + 'body' => 'cdn_key', + 'placeholders' => [ + 'cdn_key.name' => [ + 'getters' => [ + 'getCdnKey', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateSlate' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{slate.name=projects/*/locations/*/slates/*}', + 'body' => 'slate', + 'placeholders' => [ + 'slate.name' => [ + 'getters' => [ + 'getSlate', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php b/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php new file mode 100644 index 00000000000..0bf03d6a381 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/Client/VideoStitcherServiceClientTest.php @@ -0,0 +1,2363 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VideoStitcherServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VideoStitcherServiceClient($options); + } + + /** @test */ + public function createCdnKeyTest() + { + $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/createCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $cdnKey = new CdnKey(); + $cdnKeyId = 'cdnKeyId1672586061'; + $request = (new CreateCdnKeyRequest()) + ->setParent($formattedParent) + ->setCdnKey($cdnKey) + ->setCdnKeyId($cdnKeyId); + $response = $gapicClient->createCdnKey($request); + $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.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKey(); + $this->assertProtobufEquals($cdnKey, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKeyId(); + $this->assertProtobufEquals($cdnKeyId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + $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 createCdnKeyExceptionTest() + { + $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/createCdnKeyTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $cdnKey = new CdnKey(); + $cdnKeyId = 'cdnKeyId1672586061'; + $request = (new CreateCdnKeyRequest()) + ->setParent($formattedParent) + ->setCdnKey($cdnKey) + ->setCdnKeyId($cdnKeyId); + $response = $gapicClient->createCdnKey($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + 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 createLiveConfigTest() + { + $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/createLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $request = (new CreateLiveConfigRequest()) + ->setParent($formattedParent) + ->setLiveConfigId($liveConfigId) + ->setLiveConfig($liveConfig); + $response = $gapicClient->createLiveConfig($request); + $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.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfigId(); + $this->assertProtobufEquals($liveConfigId, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfig(); + $this->assertProtobufEquals($liveConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + $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 createLiveConfigExceptionTest() + { + $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/createLiveConfigTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $request = (new CreateLiveConfigRequest()) + ->setParent($formattedParent) + ->setLiveConfigId($liveConfigId) + ->setLiveConfig($liveConfig); + $response = $gapicClient->createLiveConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + 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 createLiveSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $playUri = 'playUri1879098849'; + $liveConfig = 'liveConfig-1498665483'; + $expectedResponse = new LiveSession(); + $expectedResponse->setName($name); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setLiveConfig($liveConfig); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); + $request = (new CreateLiveSessionRequest()) + ->setParent($formattedParent) + ->setLiveSession($liveSession); + $response = $gapicClient->createLiveSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveSession', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getLiveSession(); + $this->assertProtobufEquals($liveSession, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createLiveSessionExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); + $request = (new CreateLiveSessionRequest()) + ->setParent($formattedParent) + ->setLiveSession($liveSession); + try { + $gapicClient->createLiveSession($request); + // 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()); + } + + /** @test */ + public function createSlateTest() + { + $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/createSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $slateId = 'slateId-1486865023'; + $slate = new Slate(); + $request = (new CreateSlateRequest()) + ->setParent($formattedParent) + ->setSlateId($slateId) + ->setSlate($slate); + $response = $gapicClient->createSlate($request); + $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.video.stitcher.v1.VideoStitcherService/CreateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSlateId(); + $this->assertProtobufEquals($slateId, $actualValue); + $actualValue = $actualApiRequestObject->getSlate(); + $this->assertProtobufEquals($slate, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); + $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 createSlateExceptionTest() + { + $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/createSlateTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $slateId = 'slateId-1486865023'; + $slate = new Slate(); + $request = (new CreateSlateRequest()) + ->setParent($formattedParent) + ->setSlateId($slateId) + ->setSlate($slate); + $response = $gapicClient->createSlate($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); + 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 createVodSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $playUri = 'playUri1879098849'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $assetId = 'assetId-373202742'; + $expectedResponse = new VodSession(); + $expectedResponse->setName($name); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setAssetId($assetId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vodSession = new VodSession(); + $vodSessionSourceUri = 'vodSessionSourceUri2085185606'; + $vodSession->setSourceUri($vodSessionSourceUri); + $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; + $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); + $request = (new CreateVodSessionRequest()) + ->setParent($formattedParent) + ->setVodSession($vodSession); + $response = $gapicClient->createVodSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateVodSession', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getVodSession(); + $this->assertProtobufEquals($vodSession, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createVodSessionExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vodSession = new VodSession(); + $vodSessionSourceUri = 'vodSessionSourceUri2085185606'; + $vodSession->setSourceUri($vodSessionSourceUri); + $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; + $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); + $request = (new CreateVodSessionRequest()) + ->setParent($formattedParent) + ->setVodSession($vodSession); + try { + $gapicClient->createVodSession($request); + // 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()); + } + + /** @test */ + public function deleteCdnKeyTest() + { + $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/deleteCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $request = (new DeleteCdnKeyRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteCdnKey($request); + $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.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); + $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 deleteCdnKeyExceptionTest() + { + $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/deleteCdnKeyTest'); + $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 + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $request = (new DeleteCdnKeyRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteCdnKey($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); + 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 deleteLiveConfigTest() + { + $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/deleteLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $request = (new DeleteLiveConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteLiveConfig($request); + $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.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + $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 deleteLiveConfigExceptionTest() + { + $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/deleteLiveConfigTest'); + $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 + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $request = (new DeleteLiveConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteLiveConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + 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 deleteSlateTest() + { + $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/deleteSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $request = (new DeleteSlateRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteSlate($request); + $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.video.stitcher.v1.VideoStitcherService/DeleteSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); + $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 deleteSlateExceptionTest() + { + $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/deleteSlateTest'); + $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 + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $request = (new DeleteSlateRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteSlate($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); + 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 getCdnKeyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name2); + $expectedResponse->setHostname($hostname); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $request = (new GetCdnKeyRequest()) + ->setName($formattedName); + $response = $gapicClient->getCdnKey($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetCdnKey', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCdnKeyExceptionTest() + { + $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 + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $request = (new GetCdnKeyRequest()) + ->setName($formattedName); + try { + $gapicClient->getCdnKey($request); + // 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()); + } + + /** @test */ + public function getLiveAdTagDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new LiveAdTagDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); + $request = (new GetLiveAdTagDetailRequest()) + ->setName($formattedName); + $response = $gapicClient->getLiveAdTagDetail($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveAdTagDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveAdTagDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); + $request = (new GetLiveAdTagDetailRequest()) + ->setName($formattedName); + try { + $gapicClient->getLiveAdTagDetail($request); + // 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()); + } + + /** @test */ + public function getLiveConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $request = (new GetLiveConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getLiveConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveConfigExceptionTest() + { + $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 + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $request = (new GetLiveConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getLiveConfig($request); + // 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()); + } + + /** @test */ + public function getLiveSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $playUri = 'playUri1879098849'; + $liveConfig = 'liveConfig-1498665483'; + $expectedResponse = new LiveSession(); + $expectedResponse->setName($name2); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setLiveConfig($liveConfig); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $request = (new GetLiveSessionRequest()) + ->setName($formattedName); + $response = $gapicClient->getLiveSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveSessionExceptionTest() + { + $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 + $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $request = (new GetLiveSessionRequest()) + ->setName($formattedName); + try { + $gapicClient->getLiveSession($request); + // 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()); + } + + /** @test */ + public function getSlateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $request = (new GetSlateRequest()) + ->setName($formattedName); + $response = $gapicClient->getSlate($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetSlate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSlateExceptionTest() + { + $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 + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $request = (new GetSlateRequest()) + ->setName($formattedName); + try { + $gapicClient->getSlate($request); + // 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()); + } + + /** @test */ + public function getVodAdTagDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new VodAdTagDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); + $request = (new GetVodAdTagDetailRequest()) + ->setName($formattedName); + $response = $gapicClient->getVodAdTagDetail($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodAdTagDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodAdTagDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); + $request = (new GetVodAdTagDetailRequest()) + ->setName($formattedName); + try { + $gapicClient->getVodAdTagDetail($request); + // 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()); + } + + /** @test */ + public function getVodSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $playUri = 'playUri1879098849'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $assetId = 'assetId-373202742'; + $expectedResponse = new VodSession(); + $expectedResponse->setName($name2); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setAssetId($assetId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new GetVodSessionRequest()) + ->setName($formattedName); + $response = $gapicClient->getVodSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodSessionExceptionTest() + { + $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 + $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new GetVodSessionRequest()) + ->setName($formattedName); + try { + $gapicClient->getVodSession($request); + // 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()); + } + + /** @test */ + public function getVodStitchDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new VodStitchDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); + $request = (new GetVodStitchDetailRequest()) + ->setName($formattedName); + $response = $gapicClient->getVodStitchDetail($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodStitchDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodStitchDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); + $request = (new GetVodStitchDetailRequest()) + ->setName($formattedName); + try { + $gapicClient->getVodStitchDetail($request); + // 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()); + } + + /** @test */ + public function listCdnKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cdnKeysElement = new CdnKey(); + $cdnKeys = [ + $cdnKeysElement, + ]; + $expectedResponse = new ListCdnKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCdnKeys($cdnKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListCdnKeysRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listCdnKeys($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCdnKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListCdnKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCdnKeysExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListCdnKeysRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listCdnKeys($request); + // 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()); + } + + /** @test */ + public function listLiveAdTagDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $liveAdTagDetailsElement = new LiveAdTagDetail(); + $liveAdTagDetails = [ + $liveAdTagDetailsElement, + ]; + $expectedResponse = new ListLiveAdTagDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLiveAdTagDetails($liveAdTagDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $request = (new ListLiveAdTagDetailsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listLiveAdTagDetails($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLiveAdTagDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveAdTagDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLiveAdTagDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $request = (new ListLiveAdTagDetailsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listLiveAdTagDetails($request); + // 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()); + } + + /** @test */ + public function listLiveConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $liveConfigsElement = new LiveConfig(); + $liveConfigs = [ + $liveConfigsElement, + ]; + $expectedResponse = new ListLiveConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLiveConfigs($liveConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListLiveConfigsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listLiveConfigs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLiveConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLiveConfigsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListLiveConfigsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listLiveConfigs($request); + // 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()); + } + + /** @test */ + public function listSlatesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $slatesElement = new Slate(); + $slates = [ + $slatesElement, + ]; + $expectedResponse = new ListSlatesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSlates($slates); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListSlatesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listSlates($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSlates()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListSlates', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSlatesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListSlatesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listSlates($request); + // 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()); + } + + /** @test */ + public function listVodAdTagDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vodAdTagDetailsElement = new VodAdTagDetail(); + $vodAdTagDetails = [ + $vodAdTagDetailsElement, + ]; + $expectedResponse = new ListVodAdTagDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVodAdTagDetails($vodAdTagDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new ListVodAdTagDetailsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listVodAdTagDetails($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVodAdTagDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodAdTagDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVodAdTagDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new ListVodAdTagDetailsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listVodAdTagDetails($request); + // 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()); + } + + /** @test */ + public function listVodStitchDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vodStitchDetailsElement = new VodStitchDetail(); + $vodStitchDetails = [ + $vodStitchDetailsElement, + ]; + $expectedResponse = new ListVodStitchDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVodStitchDetails($vodStitchDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new ListVodStitchDetailsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listVodStitchDetails($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVodStitchDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodStitchDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVodStitchDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $request = (new ListVodStitchDetailsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listVodStitchDetails($request); + // 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()); + } + + /** @test */ + public function updateCdnKeyTest() + { + $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/updateCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $cdnKey = new CdnKey(); + $updateMask = new FieldMask(); + $request = (new UpdateCdnKeyRequest()) + ->setCdnKey($cdnKey) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateCdnKey($request); + $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.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCdnKey(); + $this->assertProtobufEquals($cdnKey, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); + $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 updateCdnKeyExceptionTest() + { + $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/updateCdnKeyTest'); + $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 + $cdnKey = new CdnKey(); + $updateMask = new FieldMask(); + $request = (new UpdateCdnKeyRequest()) + ->setCdnKey($cdnKey) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateCdnKey($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); + 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 updateSlateTest() + { + $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/updateSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $slate = new Slate(); + $updateMask = new FieldMask(); + $request = (new UpdateSlateRequest()) + ->setSlate($slate) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateSlate($request); + $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.video.stitcher.v1.VideoStitcherService/UpdateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getSlate(); + $this->assertProtobufEquals($slate, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); + $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 updateSlateExceptionTest() + { + $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/updateSlateTest'); + $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 + $slate = new Slate(); + $updateMask = new FieldMask(); + $request = (new UpdateSlateRequest()) + ->setSlate($slate) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateSlate($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); + 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 createCdnKeyAsyncTest() + { + $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/createCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $cdnKey = new CdnKey(); + $cdnKeyId = 'cdnKeyId1672586061'; + $request = (new CreateCdnKeyRequest()) + ->setParent($formattedParent) + ->setCdnKey($cdnKey) + ->setCdnKeyId($cdnKeyId); + $response = $gapicClient->createCdnKeyAsync($request)->wait(); + $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.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKey(); + $this->assertProtobufEquals($cdnKey, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKeyId(); + $this->assertProtobufEquals($cdnKeyId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + $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()); + } +} diff --git a/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/VideoStitcherServiceClientTest.php b/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/VideoStitcherServiceClientTest.php new file mode 100644 index 00000000000..7d2b18ebf41 --- /dev/null +++ b/owl-bot-staging/VideoStitcher/v1/tests/Unit/V1/VideoStitcherServiceClientTest.php @@ -0,0 +1,2147 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VideoStitcherServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VideoStitcherServiceClient($options); + } + + /** @test */ + public function createCdnKeyTest() + { + $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/createCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $cdnKey = new CdnKey(); + $cdnKeyId = 'cdnKeyId1672586061'; + $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + $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.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKey(); + $this->assertProtobufEquals($cdnKey, $actualValue); + $actualValue = $actualApiRequestObject->getCdnKeyId(); + $this->assertProtobufEquals($cdnKeyId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + $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 createCdnKeyExceptionTest() + { + $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/createCdnKeyTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $cdnKey = new CdnKey(); + $cdnKeyId = 'cdnKeyId1672586061'; + $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + 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 createLiveConfigTest() + { + $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/createLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + $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.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfigId(); + $this->assertProtobufEquals($liveConfigId, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfig(); + $this->assertProtobufEquals($liveConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + $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 createLiveConfigExceptionTest() + { + $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/createLiveConfigTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + 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 createLiveSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $playUri = 'playUri1879098849'; + $liveConfig = 'liveConfig-1498665483'; + $expectedResponse = new LiveSession(); + $expectedResponse->setName($name); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setLiveConfig($liveConfig); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); + $response = $gapicClient->createLiveSession($formattedParent, $liveSession); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveSession', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getLiveSession(); + $this->assertProtobufEquals($liveSession, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createLiveSessionExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); + try { + $gapicClient->createLiveSession($formattedParent, $liveSession); + // 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()); + } + + /** @test */ + public function createSlateTest() + { + $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/createSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $slateId = 'slateId-1486865023'; + $slate = new Slate(); + $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); + $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.video.stitcher.v1.VideoStitcherService/CreateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSlateId(); + $this->assertProtobufEquals($slateId, $actualValue); + $actualValue = $actualApiRequestObject->getSlate(); + $this->assertProtobufEquals($slate, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); + $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 createSlateExceptionTest() + { + $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/createSlateTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $slateId = 'slateId-1486865023'; + $slate = new Slate(); + $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); + 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 createVodSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $playUri = 'playUri1879098849'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $assetId = 'assetId-373202742'; + $expectedResponse = new VodSession(); + $expectedResponse->setName($name); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setAssetId($assetId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vodSession = new VodSession(); + $vodSessionSourceUri = 'vodSessionSourceUri2085185606'; + $vodSession->setSourceUri($vodSessionSourceUri); + $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; + $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); + $response = $gapicClient->createVodSession($formattedParent, $vodSession); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateVodSession', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getVodSession(); + $this->assertProtobufEquals($vodSession, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createVodSessionExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vodSession = new VodSession(); + $vodSessionSourceUri = 'vodSessionSourceUri2085185606'; + $vodSession->setSourceUri($vodSessionSourceUri); + $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; + $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); + try { + $gapicClient->createVodSession($formattedParent, $vodSession); + // 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()); + } + + /** @test */ + public function deleteCdnKeyTest() + { + $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/deleteCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $response = $gapicClient->deleteCdnKey($formattedName); + $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.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); + $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 deleteCdnKeyExceptionTest() + { + $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/deleteCdnKeyTest'); + $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 + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $response = $gapicClient->deleteCdnKey($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); + 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 deleteLiveConfigTest() + { + $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/deleteLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->deleteLiveConfig($formattedName); + $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.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + $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 deleteLiveConfigExceptionTest() + { + $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/deleteLiveConfigTest'); + $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 + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->deleteLiveConfig($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + 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 deleteSlateTest() + { + $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/deleteSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $response = $gapicClient->deleteSlate($formattedName); + $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.video.stitcher.v1.VideoStitcherService/DeleteSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); + $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 deleteSlateExceptionTest() + { + $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/deleteSlateTest'); + $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 + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $response = $gapicClient->deleteSlate($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); + 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 getCdnKeyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name2); + $expectedResponse->setHostname($hostname); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $response = $gapicClient->getCdnKey($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetCdnKey', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCdnKeyExceptionTest() + { + $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 + $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + try { + $gapicClient->getCdnKey($formattedName); + // 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()); + } + + /** @test */ + public function getLiveAdTagDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new LiveAdTagDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); + $response = $gapicClient->getLiveAdTagDetail($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveAdTagDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveAdTagDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->liveAdTagDetailName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]', '[LIVE_AD_TAG_DETAIL]'); + try { + $gapicClient->getLiveAdTagDetail($formattedName); + // 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()); + } + + /** @test */ + public function getLiveConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->getLiveConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveConfigExceptionTest() + { + $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 + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + try { + $gapicClient->getLiveConfig($formattedName); + // 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()); + } + + /** @test */ + public function getLiveSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $playUri = 'playUri1879098849'; + $liveConfig = 'liveConfig-1498665483'; + $expectedResponse = new LiveSession(); + $expectedResponse->setName($name2); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setLiveConfig($liveConfig); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $response = $gapicClient->getLiveSession($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveSessionExceptionTest() + { + $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 + $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + try { + $gapicClient->getLiveSession($formattedName); + // 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()); + } + + /** @test */ + public function getSlateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $response = $gapicClient->getSlate($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetSlate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSlateExceptionTest() + { + $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 + $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + try { + $gapicClient->getSlate($formattedName); + // 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()); + } + + /** @test */ + public function getVodAdTagDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new VodAdTagDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); + $response = $gapicClient->getVodAdTagDetail($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodAdTagDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodAdTagDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->vodAdTagDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_AD_TAG_DETAIL]'); + try { + $gapicClient->getVodAdTagDetail($formattedName); + // 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()); + } + + /** @test */ + public function getVodSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $playUri = 'playUri1879098849'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $assetId = 'assetId-373202742'; + $expectedResponse = new VodSession(); + $expectedResponse->setName($name2); + $expectedResponse->setPlayUri($playUri); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setAssetId($assetId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $response = $gapicClient->getVodSession($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodSessionExceptionTest() + { + $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 + $formattedName = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + try { + $gapicClient->getVodSession($formattedName); + // 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()); + } + + /** @test */ + public function getVodStitchDetailTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new VodStitchDetail(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); + $response = $gapicClient->getVodStitchDetail($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetVodStitchDetail', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVodStitchDetailExceptionTest() + { + $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 + $formattedName = $gapicClient->vodStitchDetailName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]', '[VOD_STITCH_DETAIL]'); + try { + $gapicClient->getVodStitchDetail($formattedName); + // 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()); + } + + /** @test */ + public function listCdnKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cdnKeysElement = new CdnKey(); + $cdnKeys = [ + $cdnKeysElement, + ]; + $expectedResponse = new ListCdnKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCdnKeys($cdnKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listCdnKeys($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCdnKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListCdnKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCdnKeysExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listCdnKeys($formattedParent); + // 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()); + } + + /** @test */ + public function listLiveAdTagDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $liveAdTagDetailsElement = new LiveAdTagDetail(); + $liveAdTagDetails = [ + $liveAdTagDetailsElement, + ]; + $expectedResponse = new ListLiveAdTagDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLiveAdTagDetails($liveAdTagDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + $response = $gapicClient->listLiveAdTagDetails($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLiveAdTagDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveAdTagDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLiveAdTagDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); + try { + $gapicClient->listLiveAdTagDetails($formattedParent); + // 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()); + } + + /** @test */ + public function listLiveConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $liveConfigsElement = new LiveConfig(); + $liveConfigs = [ + $liveConfigsElement, + ]; + $expectedResponse = new ListLiveConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLiveConfigs($liveConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listLiveConfigs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLiveConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLiveConfigsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listLiveConfigs($formattedParent); + // 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()); + } + + /** @test */ + public function listSlatesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $slatesElement = new Slate(); + $slates = [ + $slatesElement, + ]; + $expectedResponse = new ListSlatesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSlates($slates); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listSlates($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSlates()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListSlates', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSlatesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listSlates($formattedParent); + // 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()); + } + + /** @test */ + public function listVodAdTagDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vodAdTagDetailsElement = new VodAdTagDetail(); + $vodAdTagDetails = [ + $vodAdTagDetailsElement, + ]; + $expectedResponse = new ListVodAdTagDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVodAdTagDetails($vodAdTagDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $response = $gapicClient->listVodAdTagDetails($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVodAdTagDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodAdTagDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVodAdTagDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + try { + $gapicClient->listVodAdTagDetails($formattedParent); + // 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()); + } + + /** @test */ + public function listVodStitchDetailsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vodStitchDetailsElement = new VodStitchDetail(); + $vodStitchDetails = [ + $vodStitchDetailsElement, + ]; + $expectedResponse = new ListVodStitchDetailsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVodStitchDetails($vodStitchDetails); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + $response = $gapicClient->listVodStitchDetails($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVodStitchDetails()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListVodStitchDetails', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVodStitchDetailsExceptionTest() + { + $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 + $formattedParent = $gapicClient->vodSessionName('[PROJECT]', '[LOCATION]', '[VOD_SESSION]'); + try { + $gapicClient->listVodStitchDetails($formattedParent); + // 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()); + } + + /** @test */ + public function updateCdnKeyTest() + { + $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/updateCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $expectedResponse = new CdnKey(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $cdnKey = new CdnKey(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateCdnKey($cdnKey, $updateMask); + $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.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCdnKey(); + $this->assertProtobufEquals($cdnKey, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); + $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 updateCdnKeyExceptionTest() + { + $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/updateCdnKeyTest'); + $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 + $cdnKey = new CdnKey(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateCdnKey($cdnKey, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); + 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 updateSlateTest() + { + $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/updateSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new Slate(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $slate = new Slate(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateSlate($slate, $updateMask); + $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.video.stitcher.v1.VideoStitcherService/UpdateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getSlate(); + $this->assertProtobufEquals($slate, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); + $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 updateSlateExceptionTest() + { + $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/updateSlateTest'); + $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 + $slate = new Slate(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateSlate($slate, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); + 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()); + } +} diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Resources.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Resources.php new file mode 100644 index 00000000000..ad3639321ae Binary files /dev/null and b/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Resources.php differ diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Services.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Services.php new file mode 100644 index 00000000000..6b3a1569e6c --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/GPBMetadata/Google/Cloud/Video/Transcoder/V1/Services.php @@ -0,0 +1,90 @@ +internalAddGeneratedFile( + ' + +/google/cloud/video/transcoder/v1/services.proto google.cloud.video.transcoder.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto0google/cloud/video/transcoder/v1/resources.protogoogle/protobuf/empty.proto" +CreateJobRequest9 +parent ( B)AA# +!locations.googleapis.com/Location7 +job ( 2%.google.cloud.video.transcoder.v1.JobBA" +ListJobsRequest9 +parent ( B)AA# +!locations.googleapis.com/Location + page_size ( + +page_token (  +filter (  +order_by ( "D + GetJobRequest3 +name ( B%AA +transcoder.googleapis.com/Job"^ +DeleteJobRequest3 +name ( B%AA +transcoder.googleapis.com/Job + allow_missing ("u +ListJobsResponse3 +jobs ( 2%.google.cloud.video.transcoder.v1.Job +next_page_token (  + unreachable ( " +CreateJobTemplateRequest9 +parent ( B)AA# +!locations.googleapis.com/LocationH + job_template ( 2-.google.cloud.video.transcoder.v1.JobTemplateBA +job_template_id ( BA" +ListJobTemplatesRequest9 +parent ( B)AA# +!locations.googleapis.com/Location + page_size ( + +page_token (  +filter (  +order_by ( "T +GetJobTemplateRequest; +name ( B-AA\' +%transcoder.googleapis.com/JobTemplate"n +DeleteJobTemplateRequest; +name ( B-AA\' +%transcoder.googleapis.com/JobTemplate + allow_missing (" +ListJobTemplatesResponseD + job_templates ( 2-.google.cloud.video.transcoder.v1.JobTemplate +next_page_token (  + unreachable ( 2 +TranscoderService + CreateJob2.google.cloud.video.transcoder.v1.CreateJobRequest%.google.cloud.video.transcoder.v1.Job"BA +parent,job/"(/v1/{parent=projects/*/locations/*}/jobs:job +ListJobs1.google.cloud.video.transcoder.v1.ListJobsRequest2.google.cloud.video.transcoder.v1.ListJobsResponse"9Aparent*(/v1/{parent=projects/*/locations/*}/jobs +GetJob/.google.cloud.video.transcoder.v1.GetJobRequest%.google.cloud.video.transcoder.v1.Job"7Aname*(/v1/{name=projects/*/locations/*/jobs/*} + DeleteJob2.google.cloud.video.transcoder.v1.DeleteJobRequest.google.protobuf.Empty"7Aname**(/v1/{name=projects/*/locations/*/jobs/*} +CreateJobTemplate:.google.cloud.video.transcoder.v1.CreateJobTemplateRequest-.google.cloud.video.transcoder.v1.JobTemplate"lA#parent,job_template,job_template_id@"0/v1/{parent=projects/*/locations/*}/jobTemplates: job_template +ListJobTemplates9.google.cloud.video.transcoder.v1.ListJobTemplatesRequest:.google.cloud.video.transcoder.v1.ListJobTemplatesResponse"AAparent20/v1/{parent=projects/*/locations/*}/jobTemplates +GetJobTemplate7.google.cloud.video.transcoder.v1.GetJobTemplateRequest-.google.cloud.video.transcoder.v1.JobTemplate"?Aname20/v1/{name=projects/*/locations/*/jobTemplates/*} +DeleteJobTemplate:.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest.google.protobuf.Empty"?Aname2*0/v1/{name=projects/*/locations/*/jobTemplates/*}MAtranscoder.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +$com.google.cloud.video.transcoder.v1B ServicesProtoPZDcloud.google.com/go/video/transcoder/apiv1/transcoderpb;transcoderpb Google.Cloud.Video.Transcoder.V1 Google\\Cloud\\Video\\Transcoder\\V1$Google::Cloud::Video::Transcoder::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AdBreak.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AdBreak.php new file mode 100644 index 00000000000..9cadeb444fd --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AdBreak.php @@ -0,0 +1,81 @@ +google.cloud.video.transcoder.v1.AdBreak + */ +class AdBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Start time in seconds for the ad break, relative to the output file + * timeline. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + */ + protected $start_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $start_time_offset + * Start time in seconds for the ad break, relative to the output file + * timeline. The default is `0s`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Start time in seconds for the ad break, relative to the output file + * timeline. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Start time in seconds for the ad break, relative to the output file + * timeline. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream.php new file mode 100644 index 00000000000..7cf6be6554b --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream.php @@ -0,0 +1,389 @@ +google.cloud.video.transcoder.v1.AudioStream + */ +class AudioStream extends \Google\Protobuf\Internal\Message +{ + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * - `aac-he` + * - `aac-he-v2` + * - `mp3` + * - `ac3` + * - `eac3` + * + * Generated from protobuf field string codec = 1; + */ + protected $codec = ''; + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + */ + protected $channel_count = 0; + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `["fl", "fr"]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + */ + private $channel_layout; + /** + * The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AudioStream.AudioMapping mapping = 5; + */ + private $mapping; + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + */ + protected $sample_rate_hertz = 0; + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 7; + */ + protected $language_code = ''; + /** + * The name for this particular audio stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 8; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $codec + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * - `aac-he` + * - `aac-he-v2` + * - `mp3` + * - `ac3` + * - `eac3` + * @type int $bitrate_bps + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * @type int $channel_count + * Number of audio channels. Must be between 1 and 6. The default is 2. + * @type array|\Google\Protobuf\Internal\RepeatedField $channel_layout + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `["fl", "fr"]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * @type array<\Google\Cloud\Video\Transcoder\V1\AudioStream\AudioMapping>|\Google\Protobuf\Internal\RepeatedField $mapping + * The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + * @type int $sample_rate_hertz + * The audio sample rate in Hertz. The default is 48000 Hertz. + * @type string $language_code + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * @type string $display_name + * The name for this particular audio stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * - `aac-he` + * - `aac-he-v2` + * - `mp3` + * - `ac3` + * - `eac3` + * + * Generated from protobuf field string codec = 1; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * The codec for this audio stream. The default is `aac`. + * Supported audio codecs: + * - `aac` + * - `aac-he` + * - `aac-he-v2` + * - `mp3` + * - `ac3` + * - `eac3` + * + * Generated from protobuf field string codec = 1; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. Audio bitrate in bits per second. Must be between 1 and + * 10,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + * @return int + */ + public function getChannelCount() + { + return $this->channel_count; + } + + /** + * Number of audio channels. Must be between 1 and 6. The default is 2. + * + * Generated from protobuf field int32 channel_count = 3; + * @param int $var + * @return $this + */ + public function setChannelCount($var) + { + GPBUtil::checkInt32($var); + $this->channel_count = $var; + + return $this; + } + + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `["fl", "fr"]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChannelLayout() + { + return $this->channel_layout; + } + + /** + * A list of channel names specifying layout of the audio channels. + * This only affects the metadata embedded in the container headers, if + * supported by the specified format. The default is `["fl", "fr"]`. + * Supported channel names: + * - `fl` - Front left channel + * - `fr` - Front right channel + * - `sl` - Side left channel + * - `sr` - Side right channel + * - `fc` - Front center channel + * - `lfe` - Low frequency + * + * Generated from protobuf field repeated string channel_layout = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChannelLayout($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->channel_layout = $arr; + + return $this; + } + + /** + * The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AudioStream.AudioMapping mapping = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMapping() + { + return $this->mapping; + } + + /** + * The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AudioStream.AudioMapping mapping = 5; + * @param array<\Google\Cloud\Video\Transcoder\V1\AudioStream\AudioMapping>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMapping($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\AudioStream\AudioMapping::class); + $this->mapping = $arr; + + return $this; + } + + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * The audio sample rate in Hertz. The default is 48000 Hertz. + * + * Generated from protobuf field int32 sample_rate_hertz = 6; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 7; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 7; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The name for this particular audio stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 8; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The name for this particular audio stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 8; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream/AudioMapping.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream/AudioMapping.php new file mode 100644 index 00000000000..ee7b36b6e3d --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/AudioStream/AudioMapping.php @@ -0,0 +1,248 @@ +google.cloud.video.transcoder.v1.AudioStream.AudioMapping + */ +class AudioMapping extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `EditAtom.key` that references the atom with audio inputs + * in the `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $atom_key = ''; + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_key = ''; + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_track = 0; + /** + * Required. The zero-based index of the channel in the input audio stream. + * + * Generated from protobuf field int32 input_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_channel = 0; + /** + * Required. The zero-based index of the channel in the output audio stream. + * + * Generated from protobuf field int32 output_channel = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_channel = 0; + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 6; + */ + protected $gain_db = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $atom_key + * Required. The `EditAtom.key` that references the atom with audio inputs + * in the `Job.edit_list`. + * @type string $input_key + * Required. The `Input.key` that identifies the input file. + * @type int $input_track + * Required. The zero-based index of the track in the input file. + * @type int $input_channel + * Required. The zero-based index of the channel in the input audio stream. + * @type int $output_channel + * Required. The zero-based index of the channel in the output audio stream. + * @type float $gain_db + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `EditAtom.key` that references the atom with audio inputs + * in the `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAtomKey() + { + return $this->atom_key; + } + + /** + * Required. The `EditAtom.key` that references the atom with audio inputs + * in the `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAtomKey($var) + { + GPBUtil::checkString($var, True); + $this->atom_key = $var; + + return $this; + } + + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputKey() + { + return $this->input_key; + } + + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputKey($var) + { + GPBUtil::checkString($var, True); + $this->input_key = $var; + + return $this; + } + + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInputTrack() + { + return $this->input_track; + } + + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInputTrack($var) + { + GPBUtil::checkInt32($var); + $this->input_track = $var; + + return $this; + } + + /** + * Required. The zero-based index of the channel in the input audio stream. + * + * Generated from protobuf field int32 input_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInputChannel() + { + return $this->input_channel; + } + + /** + * Required. The zero-based index of the channel in the input audio stream. + * + * Generated from protobuf field int32 input_channel = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInputChannel($var) + { + GPBUtil::checkInt32($var); + $this->input_channel = $var; + + return $this; + } + + /** + * Required. The zero-based index of the channel in the output audio stream. + * + * Generated from protobuf field int32 output_channel = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getOutputChannel() + { + return $this->output_channel; + } + + /** + * Required. The zero-based index of the channel in the output audio stream. + * + * Generated from protobuf field int32 output_channel = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setOutputChannel($var) + { + GPBUtil::checkInt32($var); + $this->output_channel = $var; + + return $this; + } + + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 6; + * @return float + */ + public function getGainDb() + { + return $this->gain_db; + } + + /** + * Audio volume control in dB. Negative values decrease volume, + * positive values increase. The default is 0. + * + * Generated from protobuf field double gain_db = 6; + * @param float $var + * @return $this + */ + public function setGainDb($var) + { + GPBUtil::checkDouble($var); + $this->gain_db = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AudioMapping::class, \Google\Cloud\Video\Transcoder\V1\AudioStream_AudioMapping::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobRequest.php new file mode 100644 index 00000000000..e6d90c39b24 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobRequest.php @@ -0,0 +1,132 @@ +google.cloud.video.transcoder.v1.CreateJobRequest + */ +class CreateJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Parameters for creating transcoding job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $job = null; + + /** + * @param string $parent Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * Please see {@see TranscoderServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Transcoder\V1\Job $job Required. Parameters for creating transcoding job. + * + * @return \Google\Cloud\Video\Transcoder\V1\CreateJobRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Transcoder\V1\Job $job): self + { + return (new self()) + ->setParent($parent) + ->setJob($job); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * @type \Google\Cloud\Video\Transcoder\V1\Job $job + * Required. Parameters for creating transcoding job. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Parameters for creating transcoding job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Transcoder\V1\Job|null + */ + public function getJob() + { + return $this->job; + } + + public function hasJob() + { + return isset($this->job); + } + + public function clearJob() + { + unset($this->job); + } + + /** + * Required. Parameters for creating transcoding job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Transcoder\V1\Job $var + * @return $this + */ + public function setJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Job::class); + $this->job = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobTemplateRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobTemplateRequest.php new file mode 100644 index 00000000000..2259a64b891 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/CreateJobTemplateRequest.php @@ -0,0 +1,184 @@ +google.cloud.video.transcoder.v1.CreateJobTemplateRequest + */ +class CreateJobTemplateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Parameters for creating job template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobTemplate job_template = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $job_template = null; + /** + * Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * + * Generated from protobuf field string job_template_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $job_template_id = ''; + + /** + * @param string $parent Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * Please see {@see TranscoderServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Video\Transcoder\V1\JobTemplate $jobTemplate Required. Parameters for creating job template. + * @param string $jobTemplateId Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * + * @return \Google\Cloud\Video\Transcoder\V1\CreateJobTemplateRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Video\Transcoder\V1\JobTemplate $jobTemplate, string $jobTemplateId): self + { + return (new self()) + ->setParent($parent) + ->setJobTemplate($jobTemplate) + ->setJobTemplateId($jobTemplateId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * @type \Google\Cloud\Video\Transcoder\V1\JobTemplate $job_template + * Required. Parameters for creating job template. + * @type string $job_template_id + * Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Parameters for creating job template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobTemplate job_template = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Transcoder\V1\JobTemplate|null + */ + public function getJobTemplate() + { + return $this->job_template; + } + + public function hasJobTemplate() + { + return isset($this->job_template); + } + + public function clearJobTemplate() + { + unset($this->job_template); + } + + /** + * Required. Parameters for creating job template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobTemplate job_template = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Transcoder\V1\JobTemplate $var + * @return $this + */ + public function setJobTemplate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\JobTemplate::class); + $this->job_template = $var; + + return $this; + } + + /** + * Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * + * Generated from protobuf field string job_template_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getJobTemplateId() + { + return $this->job_template_id; + } + + /** + * Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * + * Generated from protobuf field string job_template_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setJobTemplateId($var) + { + GPBUtil::checkString($var, True); + $this->job_template_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobRequest.php new file mode 100644 index 00000000000..56bf79ae59c --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobRequest.php @@ -0,0 +1,124 @@ +google.cloud.video.transcoder.v1.DeleteJobRequest + */ +class DeleteJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + */ + protected $allow_missing = false; + + /** + * @param string $name Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * Please see {@see TranscoderServiceClient::jobName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\DeleteJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * @type bool $allow_missing + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobTemplateRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobTemplateRequest.php new file mode 100644 index 00000000000..a7db529776b --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/DeleteJobTemplateRequest.php @@ -0,0 +1,124 @@ +google.cloud.video.transcoder.v1.DeleteJobTemplateRequest + */ +class DeleteJobTemplateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + */ + protected $allow_missing = false; + + /** + * @param string $name Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * Please see {@see TranscoderServiceClient::jobTemplateName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\DeleteJobTemplateRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * @type bool $allow_missing + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * + * Generated from protobuf field bool allow_missing = 2; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/EditAtom.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/EditAtom.php new file mode 100644 index 00000000000..42921c0de75 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/EditAtom.php @@ -0,0 +1,209 @@ +google.cloud.video.transcoder.v1.EditAtom + */ +class EditAtom extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this atom. Must be specified when using advanced + * mapping. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * List of `Input.key`s identifying files that should be used in this atom. + * The listed `inputs` must have the same timeline. + * + * Generated from protobuf field repeated string inputs = 2; + */ + private $inputs; + /** + * End time in seconds for the atom, relative to the input file timeline. + * When `end_time_offset` is not specified, the `inputs` are used until + * the end of the atom. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + */ + protected $end_time_offset = null; + /** + * Start time in seconds for the atom, relative to the input file timeline. + * The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + */ + protected $start_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this atom. Must be specified when using advanced + * mapping. + * @type array|\Google\Protobuf\Internal\RepeatedField $inputs + * List of `Input.key`s identifying files that should be used in this atom. + * The listed `inputs` must have the same timeline. + * @type \Google\Protobuf\Duration $end_time_offset + * End time in seconds for the atom, relative to the input file timeline. + * When `end_time_offset` is not specified, the `inputs` are used until + * the end of the atom. + * @type \Google\Protobuf\Duration $start_time_offset + * Start time in seconds for the atom, relative to the input file timeline. + * The default is `0s`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this atom. Must be specified when using advanced + * mapping. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this atom. Must be specified when using advanced + * mapping. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * List of `Input.key`s identifying files that should be used in this atom. + * The listed `inputs` must have the same timeline. + * + * Generated from protobuf field repeated string inputs = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputs() + { + return $this->inputs; + } + + /** + * List of `Input.key`s identifying files that should be used in this atom. + * The listed `inputs` must have the same timeline. + * + * Generated from protobuf field repeated string inputs = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->inputs = $arr; + + return $this; + } + + /** + * End time in seconds for the atom, relative to the input file timeline. + * When `end_time_offset` is not specified, the `inputs` are used until + * the end of the atom. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * End time in seconds for the atom, relative to the input file timeline. + * When `end_time_offset` is not specified, the `inputs` are used until + * the end of the atom. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + + /** + * Start time in seconds for the atom, relative to the input file timeline. + * The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Start time in seconds for the atom, relative to the input file timeline. + * The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ElementaryStream.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ElementaryStream.php new file mode 100644 index 00000000000..6660485d8e2 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ElementaryStream.php @@ -0,0 +1,177 @@ +google.cloud.video.transcoder.v1.ElementaryStream + */ +class ElementaryStream extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + */ + protected $key = ''; + protected $elementary_stream; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this elementary stream. + * @type \Google\Cloud\Video\Transcoder\V1\VideoStream $video_stream + * Encoding of a video stream. + * @type \Google\Cloud\Video\Transcoder\V1\AudioStream $audio_stream + * Encoding of an audio stream. + * @type \Google\Cloud\Video\Transcoder\V1\TextStream $text_stream + * Encoding of a text stream. For example, closed captions or subtitles. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this elementary stream. + * + * Generated from protobuf field string key = 4; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Encoding of a video stream. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream video_stream = 1; + * @return \Google\Cloud\Video\Transcoder\V1\VideoStream|null + */ + public function getVideoStream() + { + return $this->readOneof(1); + } + + public function hasVideoStream() + { + return $this->hasOneof(1); + } + + /** + * Encoding of a video stream. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream video_stream = 1; + * @param \Google\Cloud\Video\Transcoder\V1\VideoStream $var + * @return $this + */ + public function setVideoStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\VideoStream::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Encoding of an audio stream. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.AudioStream audio_stream = 2; + * @return \Google\Cloud\Video\Transcoder\V1\AudioStream|null + */ + public function getAudioStream() + { + return $this->readOneof(2); + } + + public function hasAudioStream() + { + return $this->hasOneof(2); + } + + /** + * Encoding of an audio stream. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.AudioStream audio_stream = 2; + * @param \Google\Cloud\Video\Transcoder\V1\AudioStream $var + * @return $this + */ + public function setAudioStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\AudioStream::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Encoding of a text stream. For example, closed captions or subtitles. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.TextStream text_stream = 3; + * @return \Google\Cloud\Video\Transcoder\V1\TextStream|null + */ + public function getTextStream() + { + return $this->readOneof(3); + } + + public function hasTextStream() + { + return $this->hasOneof(3); + } + + /** + * Encoding of a text stream. For example, closed captions or subtitles. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.TextStream text_stream = 3; + * @param \Google\Cloud\Video\Transcoder\V1\TextStream $var + * @return $this + */ + public function setTextStream($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\TextStream::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getElementaryStream() + { + return $this->whichOneof("elementary_stream"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption.php new file mode 100644 index 00000000000..a9d3c1ca80e --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption.php @@ -0,0 +1,265 @@ +google.cloud.video.transcoder.v1.Encryption + */ +class Encryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $id = ''; + /** + * Required. DRM system(s) to use; at least one must be specified. If a + * DRM system is omitted, it is considered disabled. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.DrmSystems drm_systems = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $drm_systems = null; + protected $encryption_mode; + protected $secret_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Required. Identifier for this set of encryption options. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\Aes128Encryption $aes_128 + * Configuration for AES-128 encryption. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\SampleAesEncryption $sample_aes + * Configuration for SAMPLE-AES encryption. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\MpegCommonEncryption $mpeg_cenc + * Configuration for MPEG Common Encryption (MPEG-CENC). + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\SecretManagerSource $secret_manager_key_source + * Keys are stored in Google Secret Manager. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\DrmSystems $drm_systems + * Required. DRM system(s) to use; at least one must be specified. If a + * DRM system is omitted, it is considered disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. Identifier for this set of encryption options. + * + * Generated from protobuf field string id = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Configuration for AES-128 encryption. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Aes128Encryption aes_128 = 3; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\Aes128Encryption|null + */ + public function getAes128() + { + return $this->readOneof(3); + } + + public function hasAes128() + { + return $this->hasOneof(3); + } + + /** + * Configuration for AES-128 encryption. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Aes128Encryption aes_128 = 3; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\Aes128Encryption $var + * @return $this + */ + public function setAes128($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\Aes128Encryption::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Configuration for SAMPLE-AES encryption. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.SampleAesEncryption sample_aes = 4; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\SampleAesEncryption|null + */ + public function getSampleAes() + { + return $this->readOneof(4); + } + + public function hasSampleAes() + { + return $this->hasOneof(4); + } + + /** + * Configuration for SAMPLE-AES encryption. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.SampleAesEncryption sample_aes = 4; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\SampleAesEncryption $var + * @return $this + */ + public function setSampleAes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\SampleAesEncryption::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Configuration for MPEG Common Encryption (MPEG-CENC). + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.MpegCommonEncryption mpeg_cenc = 5; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\MpegCommonEncryption|null + */ + public function getMpegCenc() + { + return $this->readOneof(5); + } + + public function hasMpegCenc() + { + return $this->hasOneof(5); + } + + /** + * Configuration for MPEG Common Encryption (MPEG-CENC). + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.MpegCommonEncryption mpeg_cenc = 5; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\MpegCommonEncryption $var + * @return $this + */ + public function setMpegCenc($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\MpegCommonEncryption::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Keys are stored in Google Secret Manager. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.SecretManagerSource secret_manager_key_source = 7; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\SecretManagerSource|null + */ + public function getSecretManagerKeySource() + { + return $this->readOneof(7); + } + + public function hasSecretManagerKeySource() + { + return $this->hasOneof(7); + } + + /** + * Keys are stored in Google Secret Manager. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.SecretManagerSource secret_manager_key_source = 7; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\SecretManagerSource $var + * @return $this + */ + public function setSecretManagerKeySource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\SecretManagerSource::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Required. DRM system(s) to use; at least one must be specified. If a + * DRM system is omitted, it is considered disabled. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.DrmSystems drm_systems = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\DrmSystems|null + */ + public function getDrmSystems() + { + return $this->drm_systems; + } + + public function hasDrmSystems() + { + return isset($this->drm_systems); + } + + public function clearDrmSystems() + { + unset($this->drm_systems); + } + + /** + * Required. DRM system(s) to use; at least one must be specified. If a + * DRM system is omitted, it is considered disabled. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.DrmSystems drm_systems = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\DrmSystems $var + * @return $this + */ + public function setDrmSystems($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\DrmSystems::class); + $this->drm_systems = $var; + + return $this; + } + + /** + * @return string + */ + public function getEncryptionMode() + { + return $this->whichOneof("encryption_mode"); + } + + /** + * @return string + */ + public function getSecretSource() + { + return $this->whichOneof("secret_source"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Aes128Encryption.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Aes128Encryption.php new file mode 100644 index 00000000000..87e9b575234 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Aes128Encryption.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.Aes128Encryption + */ +class Aes128Encryption extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aes128Encryption::class, \Google\Cloud\Video\Transcoder\V1\Encryption_Aes128Encryption::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Clearkey.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Clearkey.php new file mode 100644 index 00000000000..d201d844ac9 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Clearkey.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.Clearkey + */ +class Clearkey extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Clearkey::class, \Google\Cloud\Video\Transcoder\V1\Encryption_Clearkey::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/DrmSystems.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/DrmSystems.php new file mode 100644 index 00000000000..715c3f2c0fb --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/DrmSystems.php @@ -0,0 +1,212 @@ +google.cloud.video.transcoder.v1.Encryption.DrmSystems + */ +class DrmSystems extends \Google\Protobuf\Internal\Message +{ + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Widevine widevine = 1; + */ + protected $widevine = null; + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Fairplay fairplay = 2; + */ + protected $fairplay = null; + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Playready playready = 3; + */ + protected $playready = null; + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Clearkey clearkey = 4; + */ + protected $clearkey = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\Widevine $widevine + * Widevine configuration. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\Fairplay $fairplay + * Fairplay configuration. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\Playready $playready + * Playready configuration. + * @type \Google\Cloud\Video\Transcoder\V1\Encryption\Clearkey $clearkey + * Clearkey configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Widevine widevine = 1; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\Widevine|null + */ + public function getWidevine() + { + return $this->widevine; + } + + public function hasWidevine() + { + return isset($this->widevine); + } + + public function clearWidevine() + { + unset($this->widevine); + } + + /** + * Widevine configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Widevine widevine = 1; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\Widevine $var + * @return $this + */ + public function setWidevine($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\Widevine::class); + $this->widevine = $var; + + return $this; + } + + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Fairplay fairplay = 2; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\Fairplay|null + */ + public function getFairplay() + { + return $this->fairplay; + } + + public function hasFairplay() + { + return isset($this->fairplay); + } + + public function clearFairplay() + { + unset($this->fairplay); + } + + /** + * Fairplay configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Fairplay fairplay = 2; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\Fairplay $var + * @return $this + */ + public function setFairplay($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\Fairplay::class); + $this->fairplay = $var; + + return $this; + } + + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Playready playready = 3; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\Playready|null + */ + public function getPlayready() + { + return $this->playready; + } + + public function hasPlayready() + { + return isset($this->playready); + } + + public function clearPlayready() + { + unset($this->playready); + } + + /** + * Playready configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Playready playready = 3; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\Playready $var + * @return $this + */ + public function setPlayready($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\Playready::class); + $this->playready = $var; + + return $this; + } + + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Clearkey clearkey = 4; + * @return \Google\Cloud\Video\Transcoder\V1\Encryption\Clearkey|null + */ + public function getClearkey() + { + return $this->clearkey; + } + + public function hasClearkey() + { + return isset($this->clearkey); + } + + public function clearClearkey() + { + unset($this->clearkey); + } + + /** + * Clearkey configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Encryption.Clearkey clearkey = 4; + * @param \Google\Cloud\Video\Transcoder\V1\Encryption\Clearkey $var + * @return $this + */ + public function setClearkey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Encryption\Clearkey::class); + $this->clearkey = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DrmSystems::class, \Google\Cloud\Video\Transcoder\V1\Encryption_DrmSystems::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Fairplay.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Fairplay.php new file mode 100644 index 00000000000..adf6d5cfd6d --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Fairplay.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.Fairplay + */ +class Fairplay extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Fairplay::class, \Google\Cloud\Video\Transcoder\V1\Encryption_Fairplay::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/MpegCommonEncryption.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/MpegCommonEncryption.php new file mode 100644 index 00000000000..5c7b5bc1f8e --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/MpegCommonEncryption.php @@ -0,0 +1,82 @@ +google.cloud.video.transcoder.v1.Encryption.MpegCommonEncryption + */ +class MpegCommonEncryption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Specify the encryption scheme. + * Supported encryption schemes: + * - `cenc` + * - `cbcs` + * + * Generated from protobuf field string scheme = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scheme = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $scheme + * Required. Specify the encryption scheme. + * Supported encryption schemes: + * - `cenc` + * - `cbcs` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Specify the encryption scheme. + * Supported encryption schemes: + * - `cenc` + * - `cbcs` + * + * Generated from protobuf field string scheme = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getScheme() + { + return $this->scheme; + } + + /** + * Required. Specify the encryption scheme. + * Supported encryption schemes: + * - `cenc` + * - `cbcs` + * + * Generated from protobuf field string scheme = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setScheme($var) + { + GPBUtil::checkString($var, True); + $this->scheme = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MpegCommonEncryption::class, \Google\Cloud\Video\Transcoder\V1\Encryption_MpegCommonEncryption::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Playready.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Playready.php new file mode 100644 index 00000000000..9d8b238fee1 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Playready.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.Playready + */ +class Playready extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Playready::class, \Google\Cloud\Video\Transcoder\V1\Encryption_Playready::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SampleAesEncryption.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SampleAesEncryption.php new file mode 100644 index 00000000000..1556a0bebec --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SampleAesEncryption.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.SampleAesEncryption + */ +class SampleAesEncryption extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SampleAesEncryption::class, \Google\Cloud\Video\Transcoder\V1\Encryption_SampleAesEncryption::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SecretManagerSource.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SecretManagerSource.php new file mode 100644 index 00000000000..9d166b65d38 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/SecretManagerSource.php @@ -0,0 +1,86 @@ +google.cloud.video.transcoder.v1.Encryption.SecretManagerSource + */ +class SecretManagerSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Secret Version containing the encryption key in + * the following format: + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * Note that only numbered versions are supported. Aliases like "latest" are + * not supported. + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $secret_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $secret_version + * Required. The name of the Secret Version containing the encryption key in + * the following format: + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * Note that only numbered versions are supported. Aliases like "latest" are + * not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Secret Version containing the encryption key in + * the following format: + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * Note that only numbered versions are supported. Aliases like "latest" are + * not supported. + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSecretVersion() + { + return $this->secret_version; + } + + /** + * Required. The name of the Secret Version containing the encryption key in + * the following format: + * `projects/{project}/secrets/{secret_id}/versions/{version_number}` + * Note that only numbered versions are supported. Aliases like "latest" are + * not supported. + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSecretVersion($var) + { + GPBUtil::checkString($var, True); + $this->secret_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SecretManagerSource::class, \Google\Cloud\Video\Transcoder\V1\Encryption_SecretManagerSource::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Widevine.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Widevine.php new file mode 100644 index 00000000000..86155a0cd35 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Encryption/Widevine.php @@ -0,0 +1,36 @@ +google.cloud.video.transcoder.v1.Encryption.Widevine + */ +class Widevine extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Widevine::class, \Google\Cloud\Video\Transcoder\V1\Encryption_Widevine::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobRequest.php new file mode 100644 index 00000000000..d84bf513d42 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobRequest.php @@ -0,0 +1,86 @@ +google.cloud.video.transcoder.v1.GetJobRequest + */ +class GetJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * Please see {@see TranscoderServiceClient::jobName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\GetJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobTemplateRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobTemplateRequest.php new file mode 100644 index 00000000000..e9a034eaf21 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/GetJobTemplateRequest.php @@ -0,0 +1,91 @@ +google.cloud.video.transcoder.v1.GetJobTemplateRequest + */ +class GetJobTemplateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * Please see {@see TranscoderServiceClient::jobTemplateName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\GetJobTemplateRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Input.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Input.php new file mode 100644 index 00000000000..3c19c7ccc6a --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Input.php @@ -0,0 +1,165 @@ +google.cloud.video.transcoder.v1.Input + */ +class Input extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this input. Must be specified when using advanced + * mapping and edit lists. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * URI of the media. Input files must be at least 5 seconds in duration and + * stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). + * If empty, the value is populated from `Job.input_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig preprocessing_config = 3; + */ + protected $preprocessing_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this input. Must be specified when using advanced + * mapping and edit lists. + * @type string $uri + * URI of the media. Input files must be at least 5 seconds in duration and + * stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). + * If empty, the value is populated from `Job.input_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig $preprocessing_config + * Preprocessing configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this input. Must be specified when using advanced + * mapping and edit lists. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this input. Must be specified when using advanced + * mapping and edit lists. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * URI of the media. Input files must be at least 5 seconds in duration and + * stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). + * If empty, the value is populated from `Job.input_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI of the media. Input files must be at least 5 seconds in duration and + * stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). + * If empty, the value is populated from `Job.input_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig preprocessing_config = 3; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig|null + */ + public function getPreprocessingConfig() + { + return $this->preprocessing_config; + } + + public function hasPreprocessingConfig() + { + return isset($this->preprocessing_config); + } + + public function clearPreprocessingConfig() + { + unset($this->preprocessing_config); + } + + /** + * Preprocessing configurations. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig preprocessing_config = 3; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig $var + * @return $this + */ + public function setPreprocessingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig::class); + $this->preprocessing_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job.php new file mode 100644 index 00000000000..b4d69eee883 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job.php @@ -0,0 +1,672 @@ +google.cloud.video.transcoder.v1.Job + */ +class Job extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the job. + * Format: `projects/{project_number}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Input only. Specify the `input_uri` to populate empty `uri` fields in each + * element of `Job.config.inputs` or `JobTemplate.config.inputs` when using + * template. URI of the media. Input files must be at least 5 seconds in + * duration and stored in Cloud Storage (for example, + * `gs://bucket/inputs/file.mp4`). See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string input_uri = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $input_uri = ''; + /** + * Input only. Specify the `output_uri` to populate an empty + * `Job.config.output.uri` or `JobTemplate.config.output.uri` when using + * template. URI for the output file(s). For example, + * `gs://my-bucket/outputs/`. See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string output_uri = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $output_uri = ''; + /** + * Output only. The current state of the job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingState state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time the job was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the transcoding started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time the transcoding finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Job time to live value in days, which will be effective after job + * completion. Job should be deleted automatically after the given TTL. Enter + * a value between 1 and 90. The default is 30. + * + * Generated from protobuf field int32 ttl_after_completion_days = 15; + */ + protected $ttl_after_completion_days = 0; + /** + * The labels associated with this job. You can use these to organize and + * group your jobs. + * + * Generated from protobuf field map labels = 16; + */ + private $labels; + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * The processing mode of the job. + * The default is `PROCESSING_MODE_INTERACTIVE`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingMode mode = 20; + */ + protected $mode = 0; + /** + * The processing priority of a batch job. + * This field can only be set for batch mode jobs. The default value is 0. + * This value cannot be negative. Higher values correspond to higher + * priorities for the job. + * + * Generated from protobuf field int32 batch_mode_priority = 21; + */ + protected $batch_mode_priority = 0; + /** + * Optional. The optimization strategy of the job. The default is + * `AUTODETECT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.OptimizationStrategy optimization = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $optimization = 0; + protected $job_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the job. + * Format: `projects/{project_number}/locations/{location}/jobs/{job}` + * @type string $input_uri + * Input only. Specify the `input_uri` to populate empty `uri` fields in each + * element of `Job.config.inputs` or `JobTemplate.config.inputs` when using + * template. URI of the media. Input files must be at least 5 seconds in + * duration and stored in Cloud Storage (for example, + * `gs://bucket/inputs/file.mp4`). See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * @type string $output_uri + * Input only. Specify the `output_uri` to populate an empty + * `Job.config.output.uri` or `JobTemplate.config.output.uri` when using + * template. URI for the output file(s). For example, + * `gs://my-bucket/outputs/`. See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * @type string $template_id + * Input only. Specify the `template_id` to use for populating `Job.config`. + * The default is `preset/web-hd`, which is the only supported preset. + * User defined JobTemplate: `{job_template_id}` + * @type \Google\Cloud\Video\Transcoder\V1\JobConfig $config + * The configuration for this job. + * @type int $state + * Output only. The current state of the job. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the job was created. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time the transcoding started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the transcoding finished. + * @type int $ttl_after_completion_days + * Job time to live value in days, which will be effective after job + * completion. Job should be deleted automatically after the given TTL. Enter + * a value between 1 and 90. The default is 30. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels associated with this job. You can use these to organize and + * group your jobs. + * @type \Google\Rpc\Status $error + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * @type int $mode + * The processing mode of the job. + * The default is `PROCESSING_MODE_INTERACTIVE`. + * @type int $batch_mode_priority + * The processing priority of a batch job. + * This field can only be set for batch mode jobs. The default value is 0. + * This value cannot be negative. Higher values correspond to higher + * priorities for the job. + * @type int $optimization + * Optional. The optimization strategy of the job. The default is + * `AUTODETECT`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the job. + * Format: `projects/{project_number}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the job. + * Format: `projects/{project_number}/locations/{location}/jobs/{job}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Input only. Specify the `input_uri` to populate empty `uri` fields in each + * element of `Job.config.inputs` or `JobTemplate.config.inputs` when using + * template. URI of the media. Input files must be at least 5 seconds in + * duration and stored in Cloud Storage (for example, + * `gs://bucket/inputs/file.mp4`). See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string input_uri = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getInputUri() + { + return $this->input_uri; + } + + /** + * Input only. Specify the `input_uri` to populate empty `uri` fields in each + * element of `Job.config.inputs` or `JobTemplate.config.inputs` when using + * template. URI of the media. Input files must be at least 5 seconds in + * duration and stored in Cloud Storage (for example, + * `gs://bucket/inputs/file.mp4`). See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string input_uri = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setInputUri($var) + { + GPBUtil::checkString($var, True); + $this->input_uri = $var; + + return $this; + } + + /** + * Input only. Specify the `output_uri` to populate an empty + * `Job.config.output.uri` or `JobTemplate.config.output.uri` when using + * template. URI for the output file(s). For example, + * `gs://my-bucket/outputs/`. See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string output_uri = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getOutputUri() + { + return $this->output_uri; + } + + /** + * Input only. Specify the `output_uri` to populate an empty + * `Job.config.output.uri` or `JobTemplate.config.output.uri` when using + * template. URI for the output file(s). For example, + * `gs://my-bucket/outputs/`. See [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string output_uri = 3 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setOutputUri($var) + { + GPBUtil::checkString($var, True); + $this->output_uri = $var; + + return $this; + } + + /** + * Input only. Specify the `template_id` to use for populating `Job.config`. + * The default is `preset/web-hd`, which is the only supported preset. + * User defined JobTemplate: `{job_template_id}` + * + * Generated from protobuf field string template_id = 4 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getTemplateId() + { + return $this->readOneof(4); + } + + public function hasTemplateId() + { + return $this->hasOneof(4); + } + + /** + * Input only. Specify the `template_id` to use for populating `Job.config`. + * The default is `preset/web-hd`, which is the only supported preset. + * User defined JobTemplate: `{job_template_id}` + * + * Generated from protobuf field string template_id = 4 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTemplateId($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The configuration for this job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobConfig config = 5; + * @return \Google\Cloud\Video\Transcoder\V1\JobConfig|null + */ + public function getConfig() + { + return $this->readOneof(5); + } + + public function hasConfig() + { + return $this->hasOneof(5); + } + + /** + * The configuration for this job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobConfig config = 5; + * @param \Google\Cloud\Video\Transcoder\V1\JobConfig $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\JobConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Output only. The current state of the job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingState state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the job. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingState state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Job\ProcessingState::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time the job was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the job was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the transcoding started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time the transcoding started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time the transcoding finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the transcoding finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Job time to live value in days, which will be effective after job + * completion. Job should be deleted automatically after the given TTL. Enter + * a value between 1 and 90. The default is 30. + * + * Generated from protobuf field int32 ttl_after_completion_days = 15; + * @return int + */ + public function getTtlAfterCompletionDays() + { + return $this->ttl_after_completion_days; + } + + /** + * Job time to live value in days, which will be effective after job + * completion. Job should be deleted automatically after the given TTL. Enter + * a value between 1 and 90. The default is 30. + * + * Generated from protobuf field int32 ttl_after_completion_days = 15; + * @param int $var + * @return $this + */ + public function setTtlAfterCompletionDays($var) + { + GPBUtil::checkInt32($var); + $this->ttl_after_completion_days = $var; + + return $this; + } + + /** + * The labels associated with this job. You can use these to organize and + * group your jobs. + * + * Generated from protobuf field map labels = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels associated with this job. You can use these to organize and + * group your jobs. + * + * Generated from protobuf field map labels = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. An error object that describes the reason for the failure. + * This property is always present when `state` is `FAILED`. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * The processing mode of the job. + * The default is `PROCESSING_MODE_INTERACTIVE`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingMode mode = 20; + * @return int + */ + public function getMode() + { + return $this->mode; + } + + /** + * The processing mode of the job. + * The default is `PROCESSING_MODE_INTERACTIVE`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.ProcessingMode mode = 20; + * @param int $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Job\ProcessingMode::class); + $this->mode = $var; + + return $this; + } + + /** + * The processing priority of a batch job. + * This field can only be set for batch mode jobs. The default value is 0. + * This value cannot be negative. Higher values correspond to higher + * priorities for the job. + * + * Generated from protobuf field int32 batch_mode_priority = 21; + * @return int + */ + public function getBatchModePriority() + { + return $this->batch_mode_priority; + } + + /** + * The processing priority of a batch job. + * This field can only be set for batch mode jobs. The default value is 0. + * This value cannot be negative. Higher values correspond to higher + * priorities for the job. + * + * Generated from protobuf field int32 batch_mode_priority = 21; + * @param int $var + * @return $this + */ + public function setBatchModePriority($var) + { + GPBUtil::checkInt32($var); + $this->batch_mode_priority = $var; + + return $this; + } + + /** + * Optional. The optimization strategy of the job. The default is + * `AUTODETECT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.OptimizationStrategy optimization = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getOptimization() + { + return $this->optimization; + } + + /** + * Optional. The optimization strategy of the job. The default is + * `AUTODETECT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Job.OptimizationStrategy optimization = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setOptimization($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Job\OptimizationStrategy::class); + $this->optimization = $var; + + return $this; + } + + /** + * @return string + */ + public function getJobConfig() + { + return $this->whichOneof("job_config"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/OptimizationStrategy.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/OptimizationStrategy.php new file mode 100644 index 00000000000..6a0e492447c --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/OptimizationStrategy.php @@ -0,0 +1,64 @@ +google.cloud.video.transcoder.v1.Job.OptimizationStrategy + */ +class OptimizationStrategy +{ + /** + * The optimization strategy is not specified. + * + * Generated from protobuf enum OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; + */ + const OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; + /** + * Prioritize job processing speed. + * + * Generated from protobuf enum AUTODETECT = 1; + */ + const AUTODETECT = 1; + /** + * Disable all optimizations. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + + private static $valueToName = [ + self::OPTIMIZATION_STRATEGY_UNSPECIFIED => 'OPTIMIZATION_STRATEGY_UNSPECIFIED', + self::AUTODETECT => 'AUTODETECT', + self::DISABLED => 'DISABLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OptimizationStrategy::class, \Google\Cloud\Video\Transcoder\V1\Job_OptimizationStrategy::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingMode.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingMode.php new file mode 100644 index 00000000000..4ada220e2b3 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingMode.php @@ -0,0 +1,67 @@ +google.cloud.video.transcoder.v1.Job.ProcessingMode + */ +class ProcessingMode +{ + /** + * The job processing mode is not specified. + * + * Generated from protobuf enum PROCESSING_MODE_UNSPECIFIED = 0; + */ + const PROCESSING_MODE_UNSPECIFIED = 0; + /** + * The job processing mode is interactive mode. + * Interactive job will either be ran or rejected if quota does not allow + * for it. + * + * Generated from protobuf enum PROCESSING_MODE_INTERACTIVE = 1; + */ + const PROCESSING_MODE_INTERACTIVE = 1; + /** + * The job processing mode is batch mode. + * Batch mode allows queuing of jobs. + * + * Generated from protobuf enum PROCESSING_MODE_BATCH = 2; + */ + const PROCESSING_MODE_BATCH = 2; + + private static $valueToName = [ + self::PROCESSING_MODE_UNSPECIFIED => 'PROCESSING_MODE_UNSPECIFIED', + self::PROCESSING_MODE_INTERACTIVE => 'PROCESSING_MODE_INTERACTIVE', + self::PROCESSING_MODE_BATCH => 'PROCESSING_MODE_BATCH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ProcessingMode::class, \Google\Cloud\Video\Transcoder\V1\Job_ProcessingMode::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingState.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingState.php new file mode 100644 index 00000000000..28e9b85c5af --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Job/ProcessingState.php @@ -0,0 +1,79 @@ +google.cloud.video.transcoder.v1.Job.ProcessingState + */ +class ProcessingState +{ + /** + * The processing state is not specified. + * + * Generated from protobuf enum PROCESSING_STATE_UNSPECIFIED = 0; + */ + const PROCESSING_STATE_UNSPECIFIED = 0; + /** + * The job is enqueued and will be picked up for processing soon. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The job is being processed. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The job has been completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The job has failed. For additional information, see `failure_reason` and + * `failure_details` + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + + private static $valueToName = [ + self::PROCESSING_STATE_UNSPECIFIED => 'PROCESSING_STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ProcessingState::class, \Google\Cloud\Video\Transcoder\V1\Job_ProcessingState::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobConfig.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobConfig.php new file mode 100644 index 00000000000..70d6c9f15aa --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobConfig.php @@ -0,0 +1,451 @@ +google.cloud.video.transcoder.v1.JobConfig + */ +class JobConfig extends \Google\Protobuf\Internal\Message +{ + /** + * List of input assets stored in Cloud Storage. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Input inputs = 1; + */ + private $inputs; + /** + * List of `Edit atom`s. Defines the ultimate timeline of the resulting + * file or manifest. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.EditAtom edit_list = 2; + */ + private $edit_list; + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.ElementaryStream elementary_streams = 3; + */ + private $elementary_streams; + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.MuxStream mux_streams = 4; + */ + private $mux_streams; + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Manifest manifests = 5; + */ + private $manifests; + /** + * Output configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Output output = 6; + */ + protected $output = null; + /** + * List of ad breaks. Specifies where to insert ad break tags in the output + * manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AdBreak ad_breaks = 7; + */ + private $ad_breaks; + /** + * Destination on Pub/Sub. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PubsubDestination pubsub_destination = 8; + */ + protected $pubsub_destination = null; + /** + * List of output sprite sheets. + * Spritesheets require at least one VideoStream in the Jobconfig. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.SpriteSheet sprite_sheets = 9; + */ + private $sprite_sheets; + /** + * List of overlays on the output video, in descending Z-order. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay overlays = 10; + */ + private $overlays; + /** + * List of encryption configurations for the content. + * Each configuration has an ID. Specify this ID in the + * [MuxStream.encryption_id][google.cloud.video.transcoder.v1.MuxStream.encryption_id] + * field to indicate the configuration to use for that `MuxStream` output. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Encryption encryptions = 11; + */ + private $encryptions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Transcoder\V1\Input>|\Google\Protobuf\Internal\RepeatedField $inputs + * List of input assets stored in Cloud Storage. + * @type array<\Google\Cloud\Video\Transcoder\V1\EditAtom>|\Google\Protobuf\Internal\RepeatedField $edit_list + * List of `Edit atom`s. Defines the ultimate timeline of the resulting + * file or manifest. + * @type array<\Google\Cloud\Video\Transcoder\V1\ElementaryStream>|\Google\Protobuf\Internal\RepeatedField $elementary_streams + * List of elementary streams. + * @type array<\Google\Cloud\Video\Transcoder\V1\MuxStream>|\Google\Protobuf\Internal\RepeatedField $mux_streams + * List of multiplexing settings for output streams. + * @type array<\Google\Cloud\Video\Transcoder\V1\Manifest>|\Google\Protobuf\Internal\RepeatedField $manifests + * List of output manifests. + * @type \Google\Cloud\Video\Transcoder\V1\Output $output + * Output configuration. + * @type array<\Google\Cloud\Video\Transcoder\V1\AdBreak>|\Google\Protobuf\Internal\RepeatedField $ad_breaks + * List of ad breaks. Specifies where to insert ad break tags in the output + * manifests. + * @type \Google\Cloud\Video\Transcoder\V1\PubsubDestination $pubsub_destination + * Destination on Pub/Sub. + * @type array<\Google\Cloud\Video\Transcoder\V1\SpriteSheet>|\Google\Protobuf\Internal\RepeatedField $sprite_sheets + * List of output sprite sheets. + * Spritesheets require at least one VideoStream in the Jobconfig. + * @type array<\Google\Cloud\Video\Transcoder\V1\Overlay>|\Google\Protobuf\Internal\RepeatedField $overlays + * List of overlays on the output video, in descending Z-order. + * @type array<\Google\Cloud\Video\Transcoder\V1\Encryption>|\Google\Protobuf\Internal\RepeatedField $encryptions + * List of encryption configurations for the content. + * Each configuration has an ID. Specify this ID in the + * [MuxStream.encryption_id][google.cloud.video.transcoder.v1.MuxStream.encryption_id] + * field to indicate the configuration to use for that `MuxStream` output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * List of input assets stored in Cloud Storage. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Input inputs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputs() + { + return $this->inputs; + } + + /** + * List of input assets stored in Cloud Storage. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Input inputs = 1; + * @param array<\Google\Cloud\Video\Transcoder\V1\Input>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Input::class); + $this->inputs = $arr; + + return $this; + } + + /** + * List of `Edit atom`s. Defines the ultimate timeline of the resulting + * file or manifest. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.EditAtom edit_list = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEditList() + { + return $this->edit_list; + } + + /** + * List of `Edit atom`s. Defines the ultimate timeline of the resulting + * file or manifest. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.EditAtom edit_list = 2; + * @param array<\Google\Cloud\Video\Transcoder\V1\EditAtom>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEditList($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\EditAtom::class); + $this->edit_list = $arr; + + return $this; + } + + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.ElementaryStream elementary_streams = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElementaryStreams() + { + return $this->elementary_streams; + } + + /** + * List of elementary streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.ElementaryStream elementary_streams = 3; + * @param array<\Google\Cloud\Video\Transcoder\V1\ElementaryStream>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElementaryStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\ElementaryStream::class); + $this->elementary_streams = $arr; + + return $this; + } + + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.MuxStream mux_streams = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMuxStreams() + { + return $this->mux_streams; + } + + /** + * List of multiplexing settings for output streams. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.MuxStream mux_streams = 4; + * @param array<\Google\Cloud\Video\Transcoder\V1\MuxStream>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMuxStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\MuxStream::class); + $this->mux_streams = $arr; + + return $this; + } + + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Manifest manifests = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManifests() + { + return $this->manifests; + } + + /** + * List of output manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Manifest manifests = 5; + * @param array<\Google\Cloud\Video\Transcoder\V1\Manifest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManifests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Manifest::class); + $this->manifests = $arr; + + return $this; + } + + /** + * Output configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Output output = 6; + * @return \Google\Cloud\Video\Transcoder\V1\Output|null + */ + public function getOutput() + { + return $this->output; + } + + public function hasOutput() + { + return isset($this->output); + } + + public function clearOutput() + { + unset($this->output); + } + + /** + * Output configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Output output = 6; + * @param \Google\Cloud\Video\Transcoder\V1\Output $var + * @return $this + */ + public function setOutput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Output::class); + $this->output = $var; + + return $this; + } + + /** + * List of ad breaks. Specifies where to insert ad break tags in the output + * manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AdBreak ad_breaks = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdBreaks() + { + return $this->ad_breaks; + } + + /** + * List of ad breaks. Specifies where to insert ad break tags in the output + * manifests. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.AdBreak ad_breaks = 7; + * @param array<\Google\Cloud\Video\Transcoder\V1\AdBreak>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdBreaks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\AdBreak::class); + $this->ad_breaks = $arr; + + return $this; + } + + /** + * Destination on Pub/Sub. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PubsubDestination pubsub_destination = 8; + * @return \Google\Cloud\Video\Transcoder\V1\PubsubDestination|null + */ + public function getPubsubDestination() + { + return $this->pubsub_destination; + } + + public function hasPubsubDestination() + { + return isset($this->pubsub_destination); + } + + public function clearPubsubDestination() + { + unset($this->pubsub_destination); + } + + /** + * Destination on Pub/Sub. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PubsubDestination pubsub_destination = 8; + * @param \Google\Cloud\Video\Transcoder\V1\PubsubDestination $var + * @return $this + */ + public function setPubsubDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PubsubDestination::class); + $this->pubsub_destination = $var; + + return $this; + } + + /** + * List of output sprite sheets. + * Spritesheets require at least one VideoStream in the Jobconfig. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.SpriteSheet sprite_sheets = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpriteSheets() + { + return $this->sprite_sheets; + } + + /** + * List of output sprite sheets. + * Spritesheets require at least one VideoStream in the Jobconfig. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.SpriteSheet sprite_sheets = 9; + * @param array<\Google\Cloud\Video\Transcoder\V1\SpriteSheet>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpriteSheets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\SpriteSheet::class); + $this->sprite_sheets = $arr; + + return $this; + } + + /** + * List of overlays on the output video, in descending Z-order. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay overlays = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOverlays() + { + return $this->overlays; + } + + /** + * List of overlays on the output video, in descending Z-order. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay overlays = 10; + * @param array<\Google\Cloud\Video\Transcoder\V1\Overlay>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOverlays($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Overlay::class); + $this->overlays = $arr; + + return $this; + } + + /** + * List of encryption configurations for the content. + * Each configuration has an ID. Specify this ID in the + * [MuxStream.encryption_id][google.cloud.video.transcoder.v1.MuxStream.encryption_id] + * field to indicate the configuration to use for that `MuxStream` output. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Encryption encryptions = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEncryptions() + { + return $this->encryptions; + } + + /** + * List of encryption configurations for the content. + * Each configuration has an ID. Specify this ID in the + * [MuxStream.encryption_id][google.cloud.video.transcoder.v1.MuxStream.encryption_id] + * field to indicate the configuration to use for that `MuxStream` output. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Encryption encryptions = 11; + * @param array<\Google\Cloud\Video\Transcoder\V1\Encryption>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEncryptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Encryption::class); + $this->encryptions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobTemplate.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobTemplate.php new file mode 100644 index 00000000000..1cf56319089 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/JobTemplate.php @@ -0,0 +1,157 @@ +google.cloud.video.transcoder.v1.JobTemplate + */ +class JobTemplate extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the job template. + * Format: + * `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The configuration for this template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobConfig config = 2; + */ + protected $config = null; + /** + * The labels associated with this job template. You can use these to organize + * and group your job templates. + * + * Generated from protobuf field map labels = 3; + */ + private $labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the job template. + * Format: + * `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` + * @type \Google\Cloud\Video\Transcoder\V1\JobConfig $config + * The configuration for this template. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels associated with this job template. You can use these to organize + * and group your job templates. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the job template. + * Format: + * `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the job template. + * Format: + * `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The configuration for this template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobConfig config = 2; + * @return \Google\Cloud\Video\Transcoder\V1\JobConfig|null + */ + public function getConfig() + { + return $this->config; + } + + public function hasConfig() + { + return isset($this->config); + } + + public function clearConfig() + { + unset($this->config); + } + + /** + * The configuration for this template. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.JobConfig config = 2; + * @param \Google\Cloud\Video\Transcoder\V1\JobConfig $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\JobConfig::class); + $this->config = $var; + + return $this; + } + + /** + * The labels associated with this job template. You can use these to organize + * and group your job templates. + * + * Generated from protobuf field map labels = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels associated with this job template. You can use these to organize + * and group your job templates. + * + * Generated from protobuf field map labels = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesRequest.php new file mode 100644 index 00000000000..9a3f102490b --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesRequest.php @@ -0,0 +1,234 @@ +google.cloud.video.transcoder.v1.ListJobTemplatesRequest + */ +class ListJobTemplatesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * Please see {@see TranscoderServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\ListJobTemplatesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The `next_page_token` value returned from a previous List request, if + * any. + * @type string $filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $order_by + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesResponse.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesResponse.php new file mode 100644 index 00000000000..3162f2362bd --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobTemplatesResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.transcoder.v1.ListJobTemplatesResponse + */ +class ListJobTemplatesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of job templates in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.JobTemplate job_templates = 1; + */ + private $job_templates; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Transcoder\V1\JobTemplate>|\Google\Protobuf\Internal\RepeatedField $job_templates + * List of job templates in the specified region. + * @type string $next_page_token + * The pagination token. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * List of regions that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * List of job templates in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.JobTemplate job_templates = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getJobTemplates() + { + return $this->job_templates; + } + + /** + * List of job templates in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.JobTemplate job_templates = 1; + * @param array<\Google\Cloud\Video\Transcoder\V1\JobTemplate>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setJobTemplates($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\JobTemplate::class); + $this->job_templates = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsRequest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsRequest.php new file mode 100644 index 00000000000..62bf0d1d56a --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsRequest.php @@ -0,0 +1,230 @@ +google.cloud.video.transcoder.v1.ListJobsRequest + */ +class ListJobsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. Format: `projects/{project}/locations/{location}` + * Please see {@see TranscoderServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Video\Transcoder\V1\ListJobsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Format: `projects/{project}/locations/{location}` + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The `next_page_token` value returned from a previous List request, if + * any. + * @type string $filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $order_by + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The `next_page_token` value returned from a previous List request, if + * any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsResponse.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsResponse.php new file mode 100644 index 00000000000..0049a9825e2 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/ListJobsResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.transcoder.v1.ListJobsResponse + */ +class ListJobsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of jobs in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Job jobs = 1; + */ + private $jobs; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Transcoder\V1\Job>|\Google\Protobuf\Internal\RepeatedField $jobs + * List of jobs in the specified region. + * @type string $next_page_token + * The pagination token. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * List of regions that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Services::initOnce(); + parent::__construct($data); + } + + /** + * List of jobs in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Job jobs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getJobs() + { + return $this->jobs; + } + + /** + * List of jobs in the specified region. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Job jobs = 1; + * @param array<\Google\Cloud\Video\Transcoder\V1\Job>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Job::class); + $this->jobs = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * List of regions that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest.php new file mode 100644 index 00000000000..875edbe8fd4 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest.php @@ -0,0 +1,197 @@ +google.cloud.video.transcoder.v1.Manifest + */ +class Manifest extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest.type`. + * + * Generated from protobuf field string file_name = 1; + */ + protected $file_name = ''; + /** + * Required. Type of the manifest. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Required. List of user given `MuxStream.key`s that should appear in this + * manifest. + * When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` + * and `.m3u8` extension is generated for each element of the + * `Manifest.mux_streams`. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $mux_streams; + protected $manifest_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $file_name + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest.type`. + * @type int $type + * Required. Type of the manifest. + * @type array|\Google\Protobuf\Internal\RepeatedField $mux_streams + * Required. List of user given `MuxStream.key`s that should appear in this + * manifest. + * When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` + * and `.m3u8` extension is generated for each element of the + * `Manifest.mux_streams`. + * @type \Google\Cloud\Video\Transcoder\V1\Manifest\DashConfig $dash + * `DASH` manifest configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest.type`. + * + * Generated from protobuf field string file_name = 1; + * @return string + */ + public function getFileName() + { + return $this->file_name; + } + + /** + * The name of the generated file. The default is `manifest` with the + * extension suffix corresponding to the `Manifest.type`. + * + * Generated from protobuf field string file_name = 1; + * @param string $var + * @return $this + */ + public function setFileName($var) + { + GPBUtil::checkString($var, True); + $this->file_name = $var; + + return $this; + } + + /** + * Required. Type of the manifest. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. Type of the manifest. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.ManifestType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Manifest\ManifestType::class); + $this->type = $var; + + return $this; + } + + /** + * Required. List of user given `MuxStream.key`s that should appear in this + * manifest. + * When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` + * and `.m3u8` extension is generated for each element of the + * `Manifest.mux_streams`. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMuxStreams() + { + return $this->mux_streams; + } + + /** + * Required. List of user given `MuxStream.key`s that should appear in this + * manifest. + * When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` + * and `.m3u8` extension is generated for each element of the + * `Manifest.mux_streams`. + * + * Generated from protobuf field repeated string mux_streams = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMuxStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->mux_streams = $arr; + + return $this; + } + + /** + * `DASH` manifest configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.DashConfig dash = 4; + * @return \Google\Cloud\Video\Transcoder\V1\Manifest\DashConfig|null + */ + public function getDash() + { + return $this->readOneof(4); + } + + public function hasDash() + { + return $this->hasOneof(4); + } + + /** + * `DASH` manifest configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.DashConfig dash = 4; + * @param \Google\Cloud\Video\Transcoder\V1\Manifest\DashConfig $var + * @return $this + */ + public function setDash($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Manifest\DashConfig::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getManifestConfig() + { + return $this->whichOneof("manifest_config"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig.php new file mode 100644 index 00000000000..6feafae25d7 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig.php @@ -0,0 +1,74 @@ +google.cloud.video.transcoder.v1.Manifest.DashConfig + */ +class DashConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The segment reference scheme for a `DASH` manifest. The default is + * `SEGMENT_LIST`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.DashConfig.SegmentReferenceScheme segment_reference_scheme = 1; + */ + protected $segment_reference_scheme = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $segment_reference_scheme + * The segment reference scheme for a `DASH` manifest. The default is + * `SEGMENT_LIST`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The segment reference scheme for a `DASH` manifest. The default is + * `SEGMENT_LIST`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.DashConfig.SegmentReferenceScheme segment_reference_scheme = 1; + * @return int + */ + public function getSegmentReferenceScheme() + { + return $this->segment_reference_scheme; + } + + /** + * The segment reference scheme for a `DASH` manifest. The default is + * `SEGMENT_LIST`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Manifest.DashConfig.SegmentReferenceScheme segment_reference_scheme = 1; + * @param int $var + * @return $this + */ + public function setSegmentReferenceScheme($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Manifest\DashConfig\SegmentReferenceScheme::class); + $this->segment_reference_scheme = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DashConfig::class, \Google\Cloud\Video\Transcoder\V1\Manifest_DashConfig::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig/SegmentReferenceScheme.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig/SegmentReferenceScheme.php new file mode 100644 index 00000000000..2f5d2d255be --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/DashConfig/SegmentReferenceScheme.php @@ -0,0 +1,64 @@ +google.cloud.video.transcoder.v1.Manifest.DashConfig.SegmentReferenceScheme + */ +class SegmentReferenceScheme +{ + /** + * The segment reference scheme is not specified. + * + * Generated from protobuf enum SEGMENT_REFERENCE_SCHEME_UNSPECIFIED = 0; + */ + const SEGMENT_REFERENCE_SCHEME_UNSPECIFIED = 0; + /** + * Lists the URLs of media files for each segment. + * + * Generated from protobuf enum SEGMENT_LIST = 1; + */ + const SEGMENT_LIST = 1; + /** + * Lists each segment from a template with $Number$ variable. + * + * Generated from protobuf enum SEGMENT_TEMPLATE_NUMBER = 2; + */ + const SEGMENT_TEMPLATE_NUMBER = 2; + + private static $valueToName = [ + self::SEGMENT_REFERENCE_SCHEME_UNSPECIFIED => 'SEGMENT_REFERENCE_SCHEME_UNSPECIFIED', + self::SEGMENT_LIST => 'SEGMENT_LIST', + self::SEGMENT_TEMPLATE_NUMBER => 'SEGMENT_TEMPLATE_NUMBER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SegmentReferenceScheme::class, \Google\Cloud\Video\Transcoder\V1\Manifest_DashConfig_SegmentReferenceScheme::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/ManifestType.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/ManifestType.php new file mode 100644 index 00000000000..6b4b08cef48 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Manifest/ManifestType.php @@ -0,0 +1,64 @@ +google.cloud.video.transcoder.v1.Manifest.ManifestType + */ +class ManifestType +{ + /** + * The manifest type is not specified. + * + * Generated from protobuf enum MANIFEST_TYPE_UNSPECIFIED = 0; + */ + const MANIFEST_TYPE_UNSPECIFIED = 0; + /** + * Create an HLS manifest. The corresponding file extension is `.m3u8`. + * + * Generated from protobuf enum HLS = 1; + */ + const HLS = 1; + /** + * Create an MPEG-DASH manifest. The corresponding file extension is `.mpd`. + * + * Generated from protobuf enum DASH = 2; + */ + const DASH = 2; + + private static $valueToName = [ + self::MANIFEST_TYPE_UNSPECIFIED => 'MANIFEST_TYPE_UNSPECIFIED', + self::HLS => 'HLS', + self::DASH => 'DASH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ManifestType::class, \Google\Cloud\Video\Transcoder\V1\Manifest_ManifestType::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/MuxStream.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/MuxStream.php new file mode 100644 index 00000000000..fbd5e7f4e19 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/MuxStream.php @@ -0,0 +1,299 @@ +google.cloud.video.transcoder.v1.MuxStream + */ +class MuxStream extends \Google\Protobuf\Internal\Message +{ + /** + * A unique key for this multiplexed stream. HLS media manifests will be + * named `MuxStream.key` with the `.m3u8` extension suffix. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The name of the generated file. The default is `MuxStream.key` with the + * extension suffix corresponding to the `MuxStream.container`. + * Individual segments also have an incremental 10-digit zero-padded suffix + * starting from 0 before the extension, such as `mux_stream0000000123.ts`. + * + * Generated from protobuf field string file_name = 2; + */ + protected $file_name = ''; + /** + * The container format. The default is `mp4` + * Supported container formats: + * - `ts` + * - `fmp4`- the corresponding file extension is `.m4s` + * - `mp4` + * - `vtt` + * See also: + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) + * + * Generated from protobuf field string container = 3; + */ + protected $container = ''; + /** + * List of `ElementaryStream.key`s multiplexed in this stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + */ + private $elementary_streams; + /** + * Segment settings for `ts`, `fmp4` and `vtt`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.SegmentSettings segment_settings = 5; + */ + protected $segment_settings = null; + /** + * Identifier of the encryption configuration to use. If omitted, output will + * be unencrypted. + * + * Generated from protobuf field string encryption_id = 7; + */ + protected $encryption_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * A unique key for this multiplexed stream. HLS media manifests will be + * named `MuxStream.key` with the `.m3u8` extension suffix. + * @type string $file_name + * The name of the generated file. The default is `MuxStream.key` with the + * extension suffix corresponding to the `MuxStream.container`. + * Individual segments also have an incremental 10-digit zero-padded suffix + * starting from 0 before the extension, such as `mux_stream0000000123.ts`. + * @type string $container + * The container format. The default is `mp4` + * Supported container formats: + * - `ts` + * - `fmp4`- the corresponding file extension is `.m4s` + * - `mp4` + * - `vtt` + * See also: + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) + * @type array|\Google\Protobuf\Internal\RepeatedField $elementary_streams + * List of `ElementaryStream.key`s multiplexed in this stream. + * @type \Google\Cloud\Video\Transcoder\V1\SegmentSettings $segment_settings + * Segment settings for `ts`, `fmp4` and `vtt`. + * @type string $encryption_id + * Identifier of the encryption configuration to use. If omitted, output will + * be unencrypted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * A unique key for this multiplexed stream. HLS media manifests will be + * named `MuxStream.key` with the `.m3u8` extension suffix. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * A unique key for this multiplexed stream. HLS media manifests will be + * named `MuxStream.key` with the `.m3u8` extension suffix. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The name of the generated file. The default is `MuxStream.key` with the + * extension suffix corresponding to the `MuxStream.container`. + * Individual segments also have an incremental 10-digit zero-padded suffix + * starting from 0 before the extension, such as `mux_stream0000000123.ts`. + * + * Generated from protobuf field string file_name = 2; + * @return string + */ + public function getFileName() + { + return $this->file_name; + } + + /** + * The name of the generated file. The default is `MuxStream.key` with the + * extension suffix corresponding to the `MuxStream.container`. + * Individual segments also have an incremental 10-digit zero-padded suffix + * starting from 0 before the extension, such as `mux_stream0000000123.ts`. + * + * Generated from protobuf field string file_name = 2; + * @param string $var + * @return $this + */ + public function setFileName($var) + { + GPBUtil::checkString($var, True); + $this->file_name = $var; + + return $this; + } + + /** + * The container format. The default is `mp4` + * Supported container formats: + * - `ts` + * - `fmp4`- the corresponding file extension is `.m4s` + * - `mp4` + * - `vtt` + * See also: + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) + * + * Generated from protobuf field string container = 3; + * @return string + */ + public function getContainer() + { + return $this->container; + } + + /** + * The container format. The default is `mp4` + * Supported container formats: + * - `ts` + * - `fmp4`- the corresponding file extension is `.m4s` + * - `mp4` + * - `vtt` + * See also: + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) + * + * Generated from protobuf field string container = 3; + * @param string $var + * @return $this + */ + public function setContainer($var) + { + GPBUtil::checkString($var, True); + $this->container = $var; + + return $this; + } + + /** + * List of `ElementaryStream.key`s multiplexed in this stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElementaryStreams() + { + return $this->elementary_streams; + } + + /** + * List of `ElementaryStream.key`s multiplexed in this stream. + * + * Generated from protobuf field repeated string elementary_streams = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElementaryStreams($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->elementary_streams = $arr; + + return $this; + } + + /** + * Segment settings for `ts`, `fmp4` and `vtt`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.SegmentSettings segment_settings = 5; + * @return \Google\Cloud\Video\Transcoder\V1\SegmentSettings|null + */ + public function getSegmentSettings() + { + return $this->segment_settings; + } + + public function hasSegmentSettings() + { + return isset($this->segment_settings); + } + + public function clearSegmentSettings() + { + unset($this->segment_settings); + } + + /** + * Segment settings for `ts`, `fmp4` and `vtt`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.SegmentSettings segment_settings = 5; + * @param \Google\Cloud\Video\Transcoder\V1\SegmentSettings $var + * @return $this + */ + public function setSegmentSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\SegmentSettings::class); + $this->segment_settings = $var; + + return $this; + } + + /** + * Identifier of the encryption configuration to use. If omitted, output will + * be unencrypted. + * + * Generated from protobuf field string encryption_id = 7; + * @return string + */ + public function getEncryptionId() + { + return $this->encryption_id; + } + + /** + * Identifier of the encryption configuration to use. If omitted, output will + * be unencrypted. + * + * Generated from protobuf field string encryption_id = 7; + * @param string $var + * @return $this + */ + public function setEncryptionId($var) + { + GPBUtil::checkString($var, True); + $this->encryption_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Output.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Output.php new file mode 100644 index 00000000000..e3203d1eb0b --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Output.php @@ -0,0 +1,79 @@ +google.cloud.video.transcoder.v1.Output + */ +class Output extends \Google\Protobuf\Internal\Message +{ + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * If empty, the value is populated from `Job.output_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * If empty, the value is populated from `Job.output_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * If empty, the value is populated from `Job.output_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the output file(s). For example, `gs://my-bucket/outputs/`. + * If empty, the value is populated from `Job.output_uri`. See + * [Supported input and output + * formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay.php new file mode 100644 index 00000000000..fa19100a1a1 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay.php @@ -0,0 +1,115 @@ +google.cloud.video.transcoder.v1.Overlay + */ +class Overlay extends \Google\Protobuf\Internal\Message +{ + /** + * Image overlay. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.Image image = 1; + */ + protected $image = null; + /** + * List of Animations. The list should be chronological, without any time + * overlap. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay.Animation animations = 2; + */ + private $animations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\Image $image + * Image overlay. + * @type array<\Google\Cloud\Video\Transcoder\V1\Overlay\Animation>|\Google\Protobuf\Internal\RepeatedField $animations + * List of Animations. The list should be chronological, without any time + * overlap. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Image overlay. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.Image image = 1; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\Image|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * Image overlay. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.Image image = 1; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\Image::class); + $this->image = $var; + + return $this; + } + + /** + * List of Animations. The list should be chronological, without any time + * overlap. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay.Animation animations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnimations() + { + return $this->animations; + } + + /** + * List of Animations. The list should be chronological, without any time + * overlap. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.Overlay.Animation animations = 2; + * @param array<\Google\Cloud\Video\Transcoder\V1\Overlay\Animation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnimations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\Overlay\Animation::class); + $this->animations = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Animation.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Animation.php new file mode 100644 index 00000000000..721b5ff9f16 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Animation.php @@ -0,0 +1,144 @@ +google.cloud.video.transcoder.v1.Overlay.Animation + */ +class Animation extends \Google\Protobuf\Internal\Message +{ + protected $animation_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationStatic $animation_static + * Display static overlay object. + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationFade $animation_fade + * Display overlay object with fade animation. + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationEnd $animation_end + * End previous animation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Display static overlay object. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationStatic animation_static = 1; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationStatic|null + */ + public function getAnimationStatic() + { + return $this->readOneof(1); + } + + public function hasAnimationStatic() + { + return $this->hasOneof(1); + } + + /** + * Display static overlay object. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationStatic animation_static = 1; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationStatic $var + * @return $this + */ + public function setAnimationStatic($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationStatic::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Display overlay object with fade animation. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationFade animation_fade = 2; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationFade|null + */ + public function getAnimationFade() + { + return $this->readOneof(2); + } + + public function hasAnimationFade() + { + return $this->hasOneof(2); + } + + /** + * Display overlay object with fade animation. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationFade animation_fade = 2; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationFade $var + * @return $this + */ + public function setAnimationFade($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationFade::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * End previous animation. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationEnd animation_end = 3; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationEnd|null + */ + public function getAnimationEnd() + { + return $this->readOneof(3); + } + + public function hasAnimationEnd() + { + return $this->hasOneof(3); + } + + /** + * End previous animation. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.AnimationEnd animation_end = 3; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationEnd $var + * @return $this + */ + public function setAnimationEnd($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\AnimationEnd::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getAnimationType() + { + return $this->whichOneof("animation_type"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Animation::class, \Google\Cloud\Video\Transcoder\V1\Overlay_Animation::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationEnd.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationEnd.php new file mode 100644 index 00000000000..38f7c28a175 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationEnd.php @@ -0,0 +1,82 @@ +google.cloud.video.transcoder.v1.Overlay.AnimationEnd + */ +class AnimationEnd extends \Google\Protobuf\Internal\Message +{ + /** + * The time to end overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + */ + protected $start_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $start_time_offset + * The time to end overlay object, in seconds. Default: 0 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The time to end overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * The time to end overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AnimationEnd::class, \Google\Cloud\Video\Transcoder\V1\Overlay_AnimationEnd::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationFade.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationFade.php new file mode 100644 index 00000000000..f6a10418cbd --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationFade.php @@ -0,0 +1,222 @@ +google.cloud.video.transcoder.v1.Overlay.AnimationFade + */ +class AnimationFade extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.FadeType fade_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fade_type = 0; + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 2; + */ + protected $xy = null; + /** + * The time to start the fade animation, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 3; + */ + protected $start_time_offset = null; + /** + * The time to end the fade animation, in seconds. Default: + * `start_time_offset` + 1s + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 4; + */ + protected $end_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $fade_type + * Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $xy + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * @type \Google\Protobuf\Duration $start_time_offset + * The time to start the fade animation, in seconds. Default: 0 + * @type \Google\Protobuf\Duration $end_time_offset + * The time to end the fade animation, in seconds. Default: + * `start_time_offset` + 1s + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.FadeType fade_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getFadeType() + { + return $this->fade_type; + } + + /** + * Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.FadeType fade_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setFadeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Transcoder\V1\Overlay\FadeType::class); + $this->fade_type = $var; + + return $this; + } + + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 2; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate|null + */ + public function getXy() + { + return $this->xy; + } + + public function hasXy() + { + return isset($this->xy); + } + + public function clearXy() + { + unset($this->xy); + } + + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 2; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $var + * @return $this + */ + public function setXy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate::class); + $this->xy = $var; + + return $this; + } + + /** + * The time to start the fade animation, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * The time to start the fade animation, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + + /** + * The time to end the fade animation, in seconds. Default: + * `start_time_offset` + 1s + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 4; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * The time to end the fade animation, in seconds. Default: + * `start_time_offset` + 1s + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 4; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AnimationFade::class, \Google\Cloud\Video\Transcoder\V1\Overlay_AnimationFade::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationStatic.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationStatic.php new file mode 100644 index 00000000000..8829a32fef8 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/AnimationStatic.php @@ -0,0 +1,140 @@ +google.cloud.video.transcoder.v1.Overlay.AnimationStatic + */ +class AnimationStatic extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 1; + */ + protected $xy = null; + /** + * The time to start displaying the overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 2; + */ + protected $start_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $xy + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * @type \Google\Protobuf\Duration $start_time_offset + * The time to start displaying the overlay object, in seconds. Default: 0 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 1; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate|null + */ + public function getXy() + { + return $this->xy; + } + + public function hasXy() + { + return isset($this->xy); + } + + public function clearXy() + { + unset($this->xy); + } + + /** + * Normalized coordinates based on output video resolution. Valid + * values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + * object. For example, use the x and y coordinates {0,0} to position the + * top-left corner of the overlay animation in the top-left corner of the + * output video. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate xy = 1; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $var + * @return $this + */ + public function setXy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate::class); + $this->xy = $var; + + return $this; + } + + /** + * The time to start displaying the overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * The time to start displaying the overlay object, in seconds. Default: 0 + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AnimationStatic::class, \Google\Cloud\Video\Transcoder\V1\Overlay_AnimationStatic::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/FadeType.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/FadeType.php new file mode 100644 index 00000000000..00d84b08ab3 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/FadeType.php @@ -0,0 +1,64 @@ +google.cloud.video.transcoder.v1.Overlay.FadeType + */ +class FadeType +{ + /** + * The fade type is not specified. + * + * Generated from protobuf enum FADE_TYPE_UNSPECIFIED = 0; + */ + const FADE_TYPE_UNSPECIFIED = 0; + /** + * Fade the overlay object into view. + * + * Generated from protobuf enum FADE_IN = 1; + */ + const FADE_IN = 1; + /** + * Fade the overlay object out of view. + * + * Generated from protobuf enum FADE_OUT = 2; + */ + const FADE_OUT = 2; + + private static $valueToName = [ + self::FADE_TYPE_UNSPECIFIED => 'FADE_TYPE_UNSPECIFIED', + self::FADE_IN => 'FADE_IN', + self::FADE_OUT => 'FADE_OUT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FadeType::class, \Google\Cloud\Video\Transcoder\V1\Overlay_FadeType::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Image.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Image.php new file mode 100644 index 00000000000..88bcf10bc53 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/Image.php @@ -0,0 +1,168 @@ +google.cloud.video.transcoder.v1.Overlay.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the image in Cloud Storage. For example, + * `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + /** + * Normalized image resolution, based on output video resolution. Valid + * values: `0.0`–`1.0`. To respect the original image aspect ratio, set + * either `x` or `y` to `0.0`. To use the original image resolution, set + * both `x` and `y` to `0.0`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate resolution = 2; + */ + protected $resolution = null; + /** + * Target image opacity. Valid values are from `1.0` (solid, default) to + * `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. + * + * Generated from protobuf field double alpha = 3; + */ + protected $alpha = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. URI of the image in Cloud Storage. For example, + * `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported. + * @type \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $resolution + * Normalized image resolution, based on output video resolution. Valid + * values: `0.0`–`1.0`. To respect the original image aspect ratio, set + * either `x` or `y` to `0.0`. To use the original image resolution, set + * both `x` and `y` to `0.0`. + * @type float $alpha + * Target image opacity. Valid values are from `1.0` (solid, default) to + * `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the image in Cloud Storage. For example, + * `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. URI of the image in Cloud Storage. For example, + * `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Normalized image resolution, based on output video resolution. Valid + * values: `0.0`–`1.0`. To respect the original image aspect ratio, set + * either `x` or `y` to `0.0`. To use the original image resolution, set + * both `x` and `y` to `0.0`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate resolution = 2; + * @return \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate|null + */ + public function getResolution() + { + return $this->resolution; + } + + public function hasResolution() + { + return isset($this->resolution); + } + + public function clearResolution() + { + unset($this->resolution); + } + + /** + * Normalized image resolution, based on output video resolution. Valid + * values: `0.0`–`1.0`. To respect the original image aspect ratio, set + * either `x` or `y` to `0.0`. To use the original image resolution, set + * both `x` and `y` to `0.0`. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate resolution = 2; + * @param \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate $var + * @return $this + */ + public function setResolution($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\Overlay\NormalizedCoordinate::class); + $this->resolution = $var; + + return $this; + } + + /** + * Target image opacity. Valid values are from `1.0` (solid, default) to + * `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. + * + * Generated from protobuf field double alpha = 3; + * @return float + */ + public function getAlpha() + { + return $this->alpha; + } + + /** + * Target image opacity. Valid values are from `1.0` (solid, default) to + * `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. + * + * Generated from protobuf field double alpha = 3; + * @param float $var + * @return $this + */ + public function setAlpha($var) + { + GPBUtil::checkDouble($var); + $this->alpha = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Image::class, \Google\Cloud\Video\Transcoder\V1\Overlay_Image::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/NormalizedCoordinate.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/NormalizedCoordinate.php new file mode 100644 index 00000000000..6212da72fc3 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/Overlay/NormalizedCoordinate.php @@ -0,0 +1,104 @@ +google.cloud.video.transcoder.v1.Overlay.NormalizedCoordinate + */ +class NormalizedCoordinate extends \Google\Protobuf\Internal\Message +{ + /** + * Normalized x coordinate. + * + * Generated from protobuf field double x = 1; + */ + protected $x = 0.0; + /** + * Normalized y coordinate. + * + * Generated from protobuf field double y = 2; + */ + protected $y = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * Normalized x coordinate. + * @type float $y + * Normalized y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Normalized x coordinate. + * + * Generated from protobuf field double x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * Normalized x coordinate. + * + * Generated from protobuf field double x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkDouble($var); + $this->x = $var; + + return $this; + } + + /** + * Normalized y coordinate. + * + * Generated from protobuf field double y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Normalized y coordinate. + * + * Generated from protobuf field double y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkDouble($var); + $this->y = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NormalizedCoordinate::class, \Google\Cloud\Video\Transcoder\V1\Overlay_NormalizedCoordinate::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig.php new file mode 100644 index 00000000000..a89acfa1847 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig.php @@ -0,0 +1,341 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig + */ +class PreprocessingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Color preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Color color = 1; + */ + protected $color = null; + /** + * Denoise preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Denoise denoise = 2; + */ + protected $denoise = null; + /** + * Deblock preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deblock deblock = 3; + */ + protected $deblock = null; + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Audio audio = 4; + */ + protected $audio = null; + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Crop crop = 5; + */ + protected $crop = null; + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Pad pad = 6; + */ + protected $pad = null; + /** + * Specify the video deinterlace configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace deinterlace = 7; + */ + protected $deinterlace = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Color $color + * Color preprocessing configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Denoise $denoise + * Denoise preprocessing configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deblock $deblock + * Deblock preprocessing configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Audio $audio + * Audio preprocessing configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Crop $crop + * Specify the video cropping configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Pad $pad + * Specify the video pad filter configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace $deinterlace + * Specify the video deinterlace configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Color preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Color color = 1; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Color|null + */ + public function getColor() + { + return $this->color; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * Color preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Color color = 1; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Color $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Color::class); + $this->color = $var; + + return $this; + } + + /** + * Denoise preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Denoise denoise = 2; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Denoise|null + */ + public function getDenoise() + { + return $this->denoise; + } + + public function hasDenoise() + { + return isset($this->denoise); + } + + public function clearDenoise() + { + unset($this->denoise); + } + + /** + * Denoise preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Denoise denoise = 2; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Denoise $var + * @return $this + */ + public function setDenoise($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Denoise::class); + $this->denoise = $var; + + return $this; + } + + /** + * Deblock preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deblock deblock = 3; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deblock|null + */ + public function getDeblock() + { + return $this->deblock; + } + + public function hasDeblock() + { + return isset($this->deblock); + } + + public function clearDeblock() + { + unset($this->deblock); + } + + /** + * Deblock preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deblock deblock = 3; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deblock $var + * @return $this + */ + public function setDeblock($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deblock::class); + $this->deblock = $var; + + return $this; + } + + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Audio audio = 4; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Audio|null + */ + public function getAudio() + { + return $this->audio; + } + + public function hasAudio() + { + return isset($this->audio); + } + + public function clearAudio() + { + unset($this->audio); + } + + /** + * Audio preprocessing configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Audio audio = 4; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Audio $var + * @return $this + */ + public function setAudio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Audio::class); + $this->audio = $var; + + return $this; + } + + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Crop crop = 5; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Crop|null + */ + public function getCrop() + { + return $this->crop; + } + + public function hasCrop() + { + return isset($this->crop); + } + + public function clearCrop() + { + unset($this->crop); + } + + /** + * Specify the video cropping configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Crop crop = 5; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Crop $var + * @return $this + */ + public function setCrop($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Crop::class); + $this->crop = $var; + + return $this; + } + + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Pad pad = 6; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Pad|null + */ + public function getPad() + { + return $this->pad; + } + + public function hasPad() + { + return isset($this->pad); + } + + public function clearPad() + { + unset($this->pad); + } + + /** + * Specify the video pad filter configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Pad pad = 6; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Pad $var + * @return $this + */ + public function setPad($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Pad::class); + $this->pad = $var; + + return $this; + } + + /** + * Specify the video deinterlace configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace deinterlace = 7; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace|null + */ + public function getDeinterlace() + { + return $this->deinterlace; + } + + public function hasDeinterlace() + { + return isset($this->deinterlace); + } + + public function clearDeinterlace() + { + unset($this->deinterlace); + } + + /** + * Specify the video deinterlace configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace deinterlace = 7; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace $var + * @return $this + */ + public function setDeinterlace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace::class); + $this->deinterlace = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Audio.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Audio.php new file mode 100644 index 00000000000..5527aa011f4 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Audio.php @@ -0,0 +1,182 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Audio + */ +class Audio extends \Google\Protobuf\Internal\Message +{ + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 (the default), where: + * * -24 is the Advanced Television Systems Committee (ATSC A/85) standard + * * -23 is the EU R128 broadcast standard + * * -19 is the prior standard for online mono audio + * * -18 is the ReplayGain standard + * * -16 is the prior standard for stereo audio + * * -14 is the new online audio standard recommended by Spotify, as well + * as Amazon Echo + * * 0 disables normalization + * + * Generated from protobuf field double lufs = 1; + */ + protected $lufs = 0.0; + /** + * Enable boosting high frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool high_boost = 2; + */ + protected $high_boost = false; + /** + * Enable boosting low frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool low_boost = 3; + */ + protected $low_boost = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $lufs + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 (the default), where: + * * -24 is the Advanced Television Systems Committee (ATSC A/85) standard + * * -23 is the EU R128 broadcast standard + * * -19 is the prior standard for online mono audio + * * -18 is the ReplayGain standard + * * -16 is the prior standard for stereo audio + * * -14 is the new online audio standard recommended by Spotify, as well + * as Amazon Echo + * * 0 disables normalization + * @type bool $high_boost + * Enable boosting high frequency components. The default is `false`. + * **Note:** This field is not supported. + * @type bool $low_boost + * Enable boosting low frequency components. The default is `false`. + * **Note:** This field is not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 (the default), where: + * * -24 is the Advanced Television Systems Committee (ATSC A/85) standard + * * -23 is the EU R128 broadcast standard + * * -19 is the prior standard for online mono audio + * * -18 is the ReplayGain standard + * * -16 is the prior standard for stereo audio + * * -14 is the new online audio standard recommended by Spotify, as well + * as Amazon Echo + * * 0 disables normalization + * + * Generated from protobuf field double lufs = 1; + * @return float + */ + public function getLufs() + { + return $this->lufs; + } + + /** + * Specify audio loudness normalization in loudness units relative to full + * scale (LUFS). Enter a value between -24 and 0 (the default), where: + * * -24 is the Advanced Television Systems Committee (ATSC A/85) standard + * * -23 is the EU R128 broadcast standard + * * -19 is the prior standard for online mono audio + * * -18 is the ReplayGain standard + * * -16 is the prior standard for stereo audio + * * -14 is the new online audio standard recommended by Spotify, as well + * as Amazon Echo + * * 0 disables normalization + * + * Generated from protobuf field double lufs = 1; + * @param float $var + * @return $this + */ + public function setLufs($var) + { + GPBUtil::checkDouble($var); + $this->lufs = $var; + + return $this; + } + + /** + * Enable boosting high frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool high_boost = 2; + * @return bool + */ + public function getHighBoost() + { + return $this->high_boost; + } + + /** + * Enable boosting high frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool high_boost = 2; + * @param bool $var + * @return $this + */ + public function setHighBoost($var) + { + GPBUtil::checkBool($var); + $this->high_boost = $var; + + return $this; + } + + /** + * Enable boosting low frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool low_boost = 3; + * @return bool + */ + public function getLowBoost() + { + return $this->low_boost; + } + + /** + * Enable boosting low frequency components. The default is `false`. + * **Note:** This field is not supported. + * + * Generated from protobuf field bool low_boost = 3; + * @param bool $var + * @return $this + */ + public function setLowBoost($var) + { + GPBUtil::checkBool($var); + $this->low_boost = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Audio::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Audio::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Color.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Color.php new file mode 100644 index 00000000000..7fcb9b37682 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Color.php @@ -0,0 +1,163 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Color + */ +class Color extends \Google\Protobuf\Internal\Message +{ + /** + * Control color saturation of the video. Enter a value between -1 and 1, + * where -1 is fully desaturated and 1 is maximum saturation. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double saturation = 1; + */ + protected $saturation = 0.0; + /** + * Control black and white contrast of the video. Enter a value between -1 + * and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double contrast = 2; + */ + protected $contrast = 0.0; + /** + * Control brightness of the video. Enter a value between -1 and 1, where -1 + * is minimum brightness and 1 is maximum brightness. 0 is no change. The + * default is 0. + * + * Generated from protobuf field double brightness = 3; + */ + protected $brightness = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $saturation + * Control color saturation of the video. Enter a value between -1 and 1, + * where -1 is fully desaturated and 1 is maximum saturation. 0 is no + * change. The default is 0. + * @type float $contrast + * Control black and white contrast of the video. Enter a value between -1 + * and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no + * change. The default is 0. + * @type float $brightness + * Control brightness of the video. Enter a value between -1 and 1, where -1 + * is minimum brightness and 1 is maximum brightness. 0 is no change. The + * default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Control color saturation of the video. Enter a value between -1 and 1, + * where -1 is fully desaturated and 1 is maximum saturation. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double saturation = 1; + * @return float + */ + public function getSaturation() + { + return $this->saturation; + } + + /** + * Control color saturation of the video. Enter a value between -1 and 1, + * where -1 is fully desaturated and 1 is maximum saturation. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double saturation = 1; + * @param float $var + * @return $this + */ + public function setSaturation($var) + { + GPBUtil::checkDouble($var); + $this->saturation = $var; + + return $this; + } + + /** + * Control black and white contrast of the video. Enter a value between -1 + * and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double contrast = 2; + * @return float + */ + public function getContrast() + { + return $this->contrast; + } + + /** + * Control black and white contrast of the video. Enter a value between -1 + * and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no + * change. The default is 0. + * + * Generated from protobuf field double contrast = 2; + * @param float $var + * @return $this + */ + public function setContrast($var) + { + GPBUtil::checkDouble($var); + $this->contrast = $var; + + return $this; + } + + /** + * Control brightness of the video. Enter a value between -1 and 1, where -1 + * is minimum brightness and 1 is maximum brightness. 0 is no change. The + * default is 0. + * + * Generated from protobuf field double brightness = 3; + * @return float + */ + public function getBrightness() + { + return $this->brightness; + } + + /** + * Control brightness of the video. Enter a value between -1 and 1, where -1 + * is minimum brightness and 1 is maximum brightness. 0 is no change. The + * default is 0. + * + * Generated from protobuf field double brightness = 3; + * @param float $var + * @return $this + */ + public function setBrightness($var) + { + GPBUtil::checkDouble($var); + $this->brightness = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Color::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Color::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Crop.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Crop.php new file mode 100644 index 00000000000..a4a924ad486 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Crop.php @@ -0,0 +1,173 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Crop + */ +class Crop extends \Google\Protobuf\Internal\Message +{ + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + */ + protected $top_pixels = 0; + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + */ + protected $bottom_pixels = 0; + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + */ + protected $left_pixels = 0; + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + */ + protected $right_pixels = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $top_pixels + * The number of pixels to crop from the top. The default is 0. + * @type int $bottom_pixels + * The number of pixels to crop from the bottom. The default is 0. + * @type int $left_pixels + * The number of pixels to crop from the left. The default is 0. + * @type int $right_pixels + * The number of pixels to crop from the right. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @return int + */ + public function getTopPixels() + { + return $this->top_pixels; + } + + /** + * The number of pixels to crop from the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @param int $var + * @return $this + */ + public function setTopPixels($var) + { + GPBUtil::checkInt32($var); + $this->top_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @return int + */ + public function getBottomPixels() + { + return $this->bottom_pixels; + } + + /** + * The number of pixels to crop from the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @param int $var + * @return $this + */ + public function setBottomPixels($var) + { + GPBUtil::checkInt32($var); + $this->bottom_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @return int + */ + public function getLeftPixels() + { + return $this->left_pixels; + } + + /** + * The number of pixels to crop from the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @param int $var + * @return $this + */ + public function setLeftPixels($var) + { + GPBUtil::checkInt32($var); + $this->left_pixels = $var; + + return $this; + } + + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @return int + */ + public function getRightPixels() + { + return $this->right_pixels; + } + + /** + * The number of pixels to crop from the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @param int $var + * @return $this + */ + public function setRightPixels($var) + { + GPBUtil::checkInt32($var); + $this->right_pixels = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Crop::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Crop::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deblock.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deblock.php new file mode 100644 index 00000000000..a1c2d7c6a2a --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deblock.php @@ -0,0 +1,113 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Deblock + */ +class Deblock extends \Google\Protobuf\Internal\Message +{ + /** + * Set strength of the deblocker. Enter a value between 0 and 1. The higher + * the value, the stronger the block removal. 0 is no deblocking. The + * default is 0. + * + * Generated from protobuf field double strength = 1; + */ + protected $strength = 0.0; + /** + * Enable deblocker. The default is `false`. + * + * Generated from protobuf field bool enabled = 2; + */ + protected $enabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $strength + * Set strength of the deblocker. Enter a value between 0 and 1. The higher + * the value, the stronger the block removal. 0 is no deblocking. The + * default is 0. + * @type bool $enabled + * Enable deblocker. The default is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Set strength of the deblocker. Enter a value between 0 and 1. The higher + * the value, the stronger the block removal. 0 is no deblocking. The + * default is 0. + * + * Generated from protobuf field double strength = 1; + * @return float + */ + public function getStrength() + { + return $this->strength; + } + + /** + * Set strength of the deblocker. Enter a value between 0 and 1. The higher + * the value, the stronger the block removal. 0 is no deblocking. The + * default is 0. + * + * Generated from protobuf field double strength = 1; + * @param float $var + * @return $this + */ + public function setStrength($var) + { + GPBUtil::checkDouble($var); + $this->strength = $var; + + return $this; + } + + /** + * Enable deblocker. The default is `false`. + * + * Generated from protobuf field bool enabled = 2; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Enable deblocker. The default is `false`. + * + * Generated from protobuf field bool enabled = 2; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Deblock::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Deblock::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace.php new file mode 100644 index 00000000000..b770eda51e3 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace.php @@ -0,0 +1,111 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace + */ +class Deinterlace extends \Google\Protobuf\Internal\Message +{ + protected $deinterlacing_filter; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\YadifConfig $yadif + * Specifies the Yet Another Deinterlacing Filter Configuration. + * @type \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\BwdifConfig $bwdif + * Specifies the Bob Weaver Deinterlacing Filter Configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the Yet Another Deinterlacing Filter Configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.YadifConfig yadif = 1; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\YadifConfig|null + */ + public function getYadif() + { + return $this->readOneof(1); + } + + public function hasYadif() + { + return $this->hasOneof(1); + } + + /** + * Specifies the Yet Another Deinterlacing Filter Configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.YadifConfig yadif = 1; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\YadifConfig $var + * @return $this + */ + public function setYadif($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\YadifConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Specifies the Bob Weaver Deinterlacing Filter Configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.BwdifConfig bwdif = 2; + * @return \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\BwdifConfig|null + */ + public function getBwdif() + { + return $this->readOneof(2); + } + + public function hasBwdif() + { + return $this->hasOneof(2); + } + + /** + * Specifies the Bob Weaver Deinterlacing Filter Configuration. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.BwdifConfig bwdif = 2; + * @param \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\BwdifConfig $var + * @return $this + */ + public function setBwdif($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig\Deinterlace\BwdifConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getDeinterlacingFilter() + { + return $this->whichOneof("deinterlacing_filter"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Deinterlace::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Deinterlace::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/BwdifConfig.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/BwdifConfig.php new file mode 100644 index 00000000000..ac4676c464e --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/BwdifConfig.php @@ -0,0 +1,178 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.BwdifConfig + */ +class BwdifConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + */ + protected $mode = ''; + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 2; + */ + protected $parity = ''; + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 3; + */ + protected $deinterlace_all_frames = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mode + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * @type string $parity + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * @type bool $deinterlace_all_frames + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + * @return string + */ + public function getMode() + { + return $this->mode; + } + + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + * @param string $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkString($var, True); + $this->mode = $var; + + return $this; + } + + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 2; + * @return string + */ + public function getParity() + { + return $this->parity; + } + + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 2; + * @param string $var + * @return $this + */ + public function setParity($var) + { + GPBUtil::checkString($var, True); + $this->parity = $var; + + return $this; + } + + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 3; + * @return bool + */ + public function getDeinterlaceAllFrames() + { + return $this->deinterlace_all_frames; + } + + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 3; + * @param bool $var + * @return $this + */ + public function setDeinterlaceAllFrames($var) + { + GPBUtil::checkBool($var); + $this->deinterlace_all_frames = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BwdifConfig::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Deinterlace_BwdifConfig::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/YadifConfig.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/YadifConfig.php new file mode 100644 index 00000000000..48e8862bebb --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Deinterlace/YadifConfig.php @@ -0,0 +1,216 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Deinterlace.YadifConfig + */ +class YadifConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + */ + protected $mode = ''; + /** + * Disable spacial interlacing. + * The default is `false`. + * + * Generated from protobuf field bool disable_spatial_interlacing = 2; + */ + protected $disable_spatial_interlacing = false; + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 3; + */ + protected $parity = ''; + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 4; + */ + protected $deinterlace_all_frames = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mode + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * @type bool $disable_spatial_interlacing + * Disable spacial interlacing. + * The default is `false`. + * @type string $parity + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * @type bool $deinterlace_all_frames + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + * @return string + */ + public function getMode() + { + return $this->mode; + } + + /** + * Specifies the deinterlacing mode to adopt. + * The default is `send_frame`. + * Supported values: + * - `send_frame`: Output one frame for each frame + * - `send_field`: Output one frame for each field + * + * Generated from protobuf field string mode = 1; + * @param string $var + * @return $this + */ + public function setMode($var) + { + GPBUtil::checkString($var, True); + $this->mode = $var; + + return $this; + } + + /** + * Disable spacial interlacing. + * The default is `false`. + * + * Generated from protobuf field bool disable_spatial_interlacing = 2; + * @return bool + */ + public function getDisableSpatialInterlacing() + { + return $this->disable_spatial_interlacing; + } + + /** + * Disable spacial interlacing. + * The default is `false`. + * + * Generated from protobuf field bool disable_spatial_interlacing = 2; + * @param bool $var + * @return $this + */ + public function setDisableSpatialInterlacing($var) + { + GPBUtil::checkBool($var); + $this->disable_spatial_interlacing = $var; + + return $this; + } + + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 3; + * @return string + */ + public function getParity() + { + return $this->parity; + } + + /** + * The picture field parity assumed for the input interlaced video. + * The default is `auto`. + * Supported values: + * - `tff`: Assume the top field is first + * - `bff`: Assume the bottom field is first + * - `auto`: Enable automatic detection of field parity + * + * Generated from protobuf field string parity = 3; + * @param string $var + * @return $this + */ + public function setParity($var) + { + GPBUtil::checkString($var, True); + $this->parity = $var; + + return $this; + } + + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 4; + * @return bool + */ + public function getDeinterlaceAllFrames() + { + return $this->deinterlace_all_frames; + } + + /** + * Deinterlace all frames rather than just the frames identified as + * interlaced. The default is `false`. + * + * Generated from protobuf field bool deinterlace_all_frames = 4; + * @param bool $var + * @return $this + */ + public function setDeinterlaceAllFrames($var) + { + GPBUtil::checkBool($var); + $this->deinterlace_all_frames = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(YadifConfig::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Deinterlace_YadifConfig::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Denoise.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Denoise.php new file mode 100644 index 00000000000..8b261dd4c49 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Denoise.php @@ -0,0 +1,121 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Denoise + */ +class Denoise extends \Google\Protobuf\Internal\Message +{ + /** + * Set strength of the denoise. Enter a value between 0 and 1. The higher + * the value, the smoother the image. 0 is no denoising. The default is 0. + * + * Generated from protobuf field double strength = 1; + */ + protected $strength = 0.0; + /** + * Set the denoiser mode. The default is `standard`. + * Supported denoiser modes: + * - `standard` + * - `grain` + * + * Generated from protobuf field string tune = 2; + */ + protected $tune = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $strength + * Set strength of the denoise. Enter a value between 0 and 1. The higher + * the value, the smoother the image. 0 is no denoising. The default is 0. + * @type string $tune + * Set the denoiser mode. The default is `standard`. + * Supported denoiser modes: + * - `standard` + * - `grain` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Set strength of the denoise. Enter a value between 0 and 1. The higher + * the value, the smoother the image. 0 is no denoising. The default is 0. + * + * Generated from protobuf field double strength = 1; + * @return float + */ + public function getStrength() + { + return $this->strength; + } + + /** + * Set strength of the denoise. Enter a value between 0 and 1. The higher + * the value, the smoother the image. 0 is no denoising. The default is 0. + * + * Generated from protobuf field double strength = 1; + * @param float $var + * @return $this + */ + public function setStrength($var) + { + GPBUtil::checkDouble($var); + $this->strength = $var; + + return $this; + } + + /** + * Set the denoiser mode. The default is `standard`. + * Supported denoiser modes: + * - `standard` + * - `grain` + * + * Generated from protobuf field string tune = 2; + * @return string + */ + public function getTune() + { + return $this->tune; + } + + /** + * Set the denoiser mode. The default is `standard`. + * Supported denoiser modes: + * - `standard` + * - `grain` + * + * Generated from protobuf field string tune = 2; + * @param string $var + * @return $this + */ + public function setTune($var) + { + GPBUtil::checkString($var, True); + $this->tune = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Denoise::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Denoise::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Pad.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Pad.php new file mode 100644 index 00000000000..04d702ce9f9 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PreprocessingConfig/Pad.php @@ -0,0 +1,173 @@ +google.cloud.video.transcoder.v1.PreprocessingConfig.Pad + */ +class Pad extends \Google\Protobuf\Internal\Message +{ + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + */ + protected $top_pixels = 0; + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + */ + protected $bottom_pixels = 0; + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + */ + protected $left_pixels = 0; + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + */ + protected $right_pixels = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $top_pixels + * The number of pixels to add to the top. The default is 0. + * @type int $bottom_pixels + * The number of pixels to add to the bottom. The default is 0. + * @type int $left_pixels + * The number of pixels to add to the left. The default is 0. + * @type int $right_pixels + * The number of pixels to add to the right. The default is 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @return int + */ + public function getTopPixels() + { + return $this->top_pixels; + } + + /** + * The number of pixels to add to the top. The default is 0. + * + * Generated from protobuf field int32 top_pixels = 1; + * @param int $var + * @return $this + */ + public function setTopPixels($var) + { + GPBUtil::checkInt32($var); + $this->top_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @return int + */ + public function getBottomPixels() + { + return $this->bottom_pixels; + } + + /** + * The number of pixels to add to the bottom. The default is 0. + * + * Generated from protobuf field int32 bottom_pixels = 2; + * @param int $var + * @return $this + */ + public function setBottomPixels($var) + { + GPBUtil::checkInt32($var); + $this->bottom_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @return int + */ + public function getLeftPixels() + { + return $this->left_pixels; + } + + /** + * The number of pixels to add to the left. The default is 0. + * + * Generated from protobuf field int32 left_pixels = 3; + * @param int $var + * @return $this + */ + public function setLeftPixels($var) + { + GPBUtil::checkInt32($var); + $this->left_pixels = $var; + + return $this; + } + + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @return int + */ + public function getRightPixels() + { + return $this->right_pixels; + } + + /** + * The number of pixels to add to the right. The default is 0. + * + * Generated from protobuf field int32 right_pixels = 4; + * @param int $var + * @return $this + */ + public function setRightPixels($var) + { + GPBUtil::checkInt32($var); + $this->right_pixels = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Pad::class, \Google\Cloud\Video\Transcoder\V1\PreprocessingConfig_Pad::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PubsubDestination.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PubsubDestination.php new file mode 100644 index 00000000000..554c0dbf012 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/PubsubDestination.php @@ -0,0 +1,71 @@ +google.cloud.video.transcoder.v1.PubsubDestination + */ +class PubsubDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the Pub/Sub topic to publish job completion notification + * to. For example: `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1; + */ + protected $topic = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $topic + * The name of the Pub/Sub topic to publish job completion notification + * to. For example: `projects/{project}/topics/{topic}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the Pub/Sub topic to publish job completion notification + * to. For example: `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1; + * @return string + */ + public function getTopic() + { + return $this->topic; + } + + /** + * The name of the Pub/Sub topic to publish job completion notification + * to. For example: `projects/{project}/topics/{topic}`. + * + * Generated from protobuf field string topic = 1; + * @param string $var + * @return $this + */ + public function setTopic($var) + { + GPBUtil::checkString($var, True); + $this->topic = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SegmentSettings.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SegmentSettings.php new file mode 100644 index 00000000000..9b21c31ca42 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SegmentSettings.php @@ -0,0 +1,123 @@ +google.cloud.video.transcoder.v1.SegmentSettings + */ +class SegmentSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Duration of the segments in seconds. The default is `6.0s`. Note that + * `segmentDuration` must be greater than or equal to + * [`gopDuration`](#videostream), and `segmentDuration` must be divisible by + * [`gopDuration`](#videostream). + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + */ + protected $segment_duration = null; + /** + * Required. Create an individual segment file. The default is `false`. + * + * Generated from protobuf field bool individual_segments = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $individual_segments = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $segment_duration + * Duration of the segments in seconds. The default is `6.0s`. Note that + * `segmentDuration` must be greater than or equal to + * [`gopDuration`](#videostream), and `segmentDuration` must be divisible by + * [`gopDuration`](#videostream). + * @type bool $individual_segments + * Required. Create an individual segment file. The default is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Duration of the segments in seconds. The default is `6.0s`. Note that + * `segmentDuration` must be greater than or equal to + * [`gopDuration`](#videostream), and `segmentDuration` must be divisible by + * [`gopDuration`](#videostream). + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getSegmentDuration() + { + return $this->segment_duration; + } + + public function hasSegmentDuration() + { + return isset($this->segment_duration); + } + + public function clearSegmentDuration() + { + unset($this->segment_duration); + } + + /** + * Duration of the segments in seconds. The default is `6.0s`. Note that + * `segmentDuration` must be greater than or equal to + * [`gopDuration`](#videostream), and `segmentDuration` must be divisible by + * [`gopDuration`](#videostream). + * + * Generated from protobuf field .google.protobuf.Duration segment_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSegmentDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->segment_duration = $var; + + return $this; + } + + /** + * Required. Create an individual segment file. The default is `false`. + * + * Generated from protobuf field bool individual_segments = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getIndividualSegments() + { + return $this->individual_segments; + } + + /** + * Required. Create an individual segment file. The default is `false`. + * + * Generated from protobuf field bool individual_segments = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setIndividualSegments($var) + { + GPBUtil::checkBool($var); + $this->individual_segments = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SpriteSheet.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SpriteSheet.php new file mode 100644 index 00000000000..b0b6c8cfeec --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/SpriteSheet.php @@ -0,0 +1,575 @@ +google.cloud.video.transcoder.v1.SpriteSheet + */ +class SpriteSheet extends \Google\Protobuf\Internal\Message +{ + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + */ + protected $format = ''; + /** + * Required. File name prefix for the generated sprite sheets. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $file_prefix = ''; + /** + * Required. The width of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field or the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sprite_width_pixels = 0; + /** + * Required. The height of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field or the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sprite_height_pixels = 0; + /** + * The maximum number of sprites per row in a sprite sheet. The default is 0, + * which indicates no maximum limit. + * + * Generated from protobuf field int32 column_count = 5; + */ + protected $column_count = 0; + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. The default is 0, which indicates no maximum + * limit. + * + * Generated from protobuf field int32 row_count = 6; + */ + protected $row_count = 0; + /** + * Start time in seconds, relative to the output file timeline. Determines the + * first sprite to pick. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 7; + */ + protected $start_time_offset = null; + /** + * End time in seconds, relative to the output file timeline. When + * `end_time_offset` is not specified, the sprites are generated until the end + * of the output file. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 8; + */ + protected $end_time_offset = null; + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 11; + */ + protected $quality = 0; + protected $extraction_strategy; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $format + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * @type string $file_prefix + * Required. File name prefix for the generated sprite sheets. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * @type int $sprite_width_pixels + * Required. The width of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field or the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type int $sprite_height_pixels + * Required. The height of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field or the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type int $column_count + * The maximum number of sprites per row in a sprite sheet. The default is 0, + * which indicates no maximum limit. + * @type int $row_count + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. The default is 0, which indicates no maximum + * limit. + * @type \Google\Protobuf\Duration $start_time_offset + * Start time in seconds, relative to the output file timeline. Determines the + * first sprite to pick. The default is `0s`. + * @type \Google\Protobuf\Duration $end_time_offset + * End time in seconds, relative to the output file timeline. When + * `end_time_offset` is not specified, the sprites are generated until the end + * of the output file. + * @type int $total_count + * Total number of sprites. Create the specified number of sprites + * distributed evenly across the timeline of the output media. The default + * is 100. + * @type \Google\Protobuf\Duration $interval + * Starting from `0s`, create sprites at regular intervals. Specify the + * interval value in seconds. + * @type int $quality + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Format type. The default is `jpeg`. + * Supported formats: + * - `jpeg` + * + * Generated from protobuf field string format = 1; + * @param string $var + * @return $this + */ + public function setFormat($var) + { + GPBUtil::checkString($var, True); + $this->format = $var; + + return $this; + } + + /** + * Required. File name prefix for the generated sprite sheets. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilePrefix() + { + return $this->file_prefix; + } + + /** + * Required. File name prefix for the generated sprite sheets. + * Each sprite sheet has an incremental 10-digit zero-padded suffix starting + * from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + * + * Generated from protobuf field string file_prefix = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilePrefix($var) + { + GPBUtil::checkString($var, True); + $this->file_prefix = $var; + + return $this; + } + + /** + * Required. The width of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field or the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSpriteWidthPixels() + { + return $this->sprite_width_pixels; + } + + /** + * Required. The width of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field or the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_width_pixels = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSpriteWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->sprite_width_pixels = $var; + + return $this; + } + + /** + * Required. The height of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field or the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSpriteHeightPixels() + { + return $this->sprite_height_pixels; + } + + /** + * Required. The height of sprite in pixels. Must be an even integer. To + * preserve the source aspect ratio, set the + * [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] + * field or the + * [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] + * field, but not both (the API will automatically calculate the missing + * field). + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 sprite_height_pixels = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSpriteHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->sprite_height_pixels = $var; + + return $this; + } + + /** + * The maximum number of sprites per row in a sprite sheet. The default is 0, + * which indicates no maximum limit. + * + * Generated from protobuf field int32 column_count = 5; + * @return int + */ + public function getColumnCount() + { + return $this->column_count; + } + + /** + * The maximum number of sprites per row in a sprite sheet. The default is 0, + * which indicates no maximum limit. + * + * Generated from protobuf field int32 column_count = 5; + * @param int $var + * @return $this + */ + public function setColumnCount($var) + { + GPBUtil::checkInt32($var); + $this->column_count = $var; + + return $this; + } + + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. The default is 0, which indicates no maximum + * limit. + * + * Generated from protobuf field int32 row_count = 6; + * @return int + */ + public function getRowCount() + { + return $this->row_count; + } + + /** + * The maximum number of rows per sprite sheet. When the sprite sheet is full, + * a new sprite sheet is created. The default is 0, which indicates no maximum + * limit. + * + * Generated from protobuf field int32 row_count = 6; + * @param int $var + * @return $this + */ + public function setRowCount($var) + { + GPBUtil::checkInt32($var); + $this->row_count = $var; + + return $this; + } + + /** + * Start time in seconds, relative to the output file timeline. Determines the + * first sprite to pick. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getStartTimeOffset() + { + return $this->start_time_offset; + } + + public function hasStartTimeOffset() + { + return isset($this->start_time_offset); + } + + public function clearStartTimeOffset() + { + unset($this->start_time_offset); + } + + /** + * Start time in seconds, relative to the output file timeline. Determines the + * first sprite to pick. The default is `0s`. + * + * Generated from protobuf field .google.protobuf.Duration start_time_offset = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setStartTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->start_time_offset = $var; + + return $this; + } + + /** + * End time in seconds, relative to the output file timeline. When + * `end_time_offset` is not specified, the sprites are generated until the end + * of the output file. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 8; + * @return \Google\Protobuf\Duration|null + */ + public function getEndTimeOffset() + { + return $this->end_time_offset; + } + + public function hasEndTimeOffset() + { + return isset($this->end_time_offset); + } + + public function clearEndTimeOffset() + { + unset($this->end_time_offset); + } + + /** + * End time in seconds, relative to the output file timeline. When + * `end_time_offset` is not specified, the sprites are generated until the end + * of the output file. + * + * Generated from protobuf field .google.protobuf.Duration end_time_offset = 8; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->end_time_offset = $var; + + return $this; + } + + /** + * Total number of sprites. Create the specified number of sprites + * distributed evenly across the timeline of the output media. The default + * is 100. + * + * Generated from protobuf field int32 total_count = 9; + * @return int + */ + public function getTotalCount() + { + return $this->readOneof(9); + } + + public function hasTotalCount() + { + return $this->hasOneof(9); + } + + /** + * Total number of sprites. Create the specified number of sprites + * distributed evenly across the timeline of the output media. The default + * is 100. + * + * Generated from protobuf field int32 total_count = 9; + * @param int $var + * @return $this + */ + public function setTotalCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Starting from `0s`, create sprites at regular intervals. Specify the + * interval value in seconds. + * + * Generated from protobuf field .google.protobuf.Duration interval = 10; + * @return \Google\Protobuf\Duration|null + */ + public function getInterval() + { + return $this->readOneof(10); + } + + public function hasInterval() + { + return $this->hasOneof(10); + } + + /** + * Starting from `0s`, create sprites at regular intervals. Specify the + * interval value in seconds. + * + * Generated from protobuf field .google.protobuf.Duration interval = 10; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setInterval($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 11; + * @return int + */ + public function getQuality() + { + return $this->quality; + } + + /** + * The quality of the generated sprite sheet. Enter a value between 1 + * and 100, where 1 is the lowest quality and 100 is the highest quality. + * The default is 100. A high quality value corresponds to a low image data + * compression ratio. + * + * Generated from protobuf field int32 quality = 11; + * @param int $var + * @return $this + */ + public function setQuality($var) + { + GPBUtil::checkInt32($var); + $this->quality = $var; + + return $this; + } + + /** + * @return string + */ + public function getExtractionStrategy() + { + return $this->whichOneof("extraction_strategy"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream.php new file mode 100644 index 00000000000..e7f56aa9a08 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream.php @@ -0,0 +1,209 @@ +google.cloud.video.transcoder.v1.TextStream + */ +class TextStream extends \Google\Protobuf\Internal\Message +{ + /** + * The codec for this text stream. The default is `webvtt`. + * Supported text codecs: + * - `srt` + * - `ttml` + * - `cea608` + * - `cea708` + * - `webvtt` + * + * Generated from protobuf field string codec = 1; + */ + protected $codec = ''; + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.TextStream.TextMapping mapping = 3; + */ + private $mapping; + /** + * The name for this particular text stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 4; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $codec + * The codec for this text stream. The default is `webvtt`. + * Supported text codecs: + * - `srt` + * - `ttml` + * - `cea608` + * - `cea708` + * - `webvtt` + * @type string $language_code + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * @type array<\Google\Cloud\Video\Transcoder\V1\TextStream\TextMapping>|\Google\Protobuf\Internal\RepeatedField $mapping + * The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + * @type string $display_name + * The name for this particular text stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The codec for this text stream. The default is `webvtt`. + * Supported text codecs: + * - `srt` + * - `ttml` + * - `cea608` + * - `cea708` + * - `webvtt` + * + * Generated from protobuf field string codec = 1; + * @return string + */ + public function getCodec() + { + return $this->codec; + } + + /** + * The codec for this text stream. The default is `webvtt`. + * Supported text codecs: + * - `srt` + * - `ttml` + * - `cea608` + * - `cea708` + * - `webvtt` + * + * Generated from protobuf field string codec = 1; + * @param string $var + * @return $this + */ + public function setCodec($var) + { + GPBUtil::checkString($var, True); + $this->codec = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as `en-US` or `sr-Latn`. For more + * information, see + * https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not + * supported in MP4 files. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.TextStream.TextMapping mapping = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMapping() + { + return $this->mapping; + } + + /** + * The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + * + * Generated from protobuf field repeated .google.cloud.video.transcoder.v1.TextStream.TextMapping mapping = 3; + * @param array<\Google\Cloud\Video\Transcoder\V1\TextStream\TextMapping>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMapping($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Transcoder\V1\TextStream\TextMapping::class); + $this->mapping = $arr; + + return $this; + } + + /** + * The name for this particular text stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 4; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The name for this particular text stream that + * will be added to the HLS/DASH manifest. Not supported in MP4 files. + * + * Generated from protobuf field string display_name = 4; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream/TextMapping.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream/TextMapping.php new file mode 100644 index 00000000000..c8404457843 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/TextStream/TextMapping.php @@ -0,0 +1,142 @@ +google.cloud.video.transcoder.v1.TextStream.TextMapping + */ +class TextMapping extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The `EditAtom.key` that references atom with text inputs in the + * `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $atom_key = ''; + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_key = ''; + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_track = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $atom_key + * Required. The `EditAtom.key` that references atom with text inputs in the + * `Job.edit_list`. + * @type string $input_key + * Required. The `Input.key` that identifies the input file. + * @type int $input_track + * Required. The zero-based index of the track in the input file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The `EditAtom.key` that references atom with text inputs in the + * `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAtomKey() + { + return $this->atom_key; + } + + /** + * Required. The `EditAtom.key` that references atom with text inputs in the + * `Job.edit_list`. + * + * Generated from protobuf field string atom_key = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAtomKey($var) + { + GPBUtil::checkString($var, True); + $this->atom_key = $var; + + return $this; + } + + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInputKey() + { + return $this->input_key; + } + + /** + * Required. The `Input.key` that identifies the input file. + * + * Generated from protobuf field string input_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInputKey($var) + { + GPBUtil::checkString($var, True); + $this->input_key = $var; + + return $this; + } + + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInputTrack() + { + return $this->input_track; + } + + /** + * Required. The zero-based index of the track in the input file. + * + * Generated from protobuf field int32 input_track = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInputTrack($var) + { + GPBUtil::checkInt32($var); + $this->input_track = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextMapping::class, \Google\Cloud\Video\Transcoder\V1\TextStream_TextMapping::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream.php new file mode 100644 index 00000000000..d3374d958e6 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream.php @@ -0,0 +1,141 @@ +google.cloud.video.transcoder.v1.VideoStream + */ +class VideoStream extends \Google\Protobuf\Internal\Message +{ + protected $codec_settings; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Transcoder\V1\VideoStream\H264CodecSettings $h264 + * H264 codec settings. + * @type \Google\Cloud\Video\Transcoder\V1\VideoStream\H265CodecSettings $h265 + * H265 codec settings. + * @type \Google\Cloud\Video\Transcoder\V1\VideoStream\Vp9CodecSettings $vp9 + * VP9 codec settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * H264 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.H264CodecSettings h264 = 1; + * @return \Google\Cloud\Video\Transcoder\V1\VideoStream\H264CodecSettings|null + */ + public function getH264() + { + return $this->readOneof(1); + } + + public function hasH264() + { + return $this->hasOneof(1); + } + + /** + * H264 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.H264CodecSettings h264 = 1; + * @param \Google\Cloud\Video\Transcoder\V1\VideoStream\H264CodecSettings $var + * @return $this + */ + public function setH264($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\VideoStream\H264CodecSettings::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * H265 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.H265CodecSettings h265 = 2; + * @return \Google\Cloud\Video\Transcoder\V1\VideoStream\H265CodecSettings|null + */ + public function getH265() + { + return $this->readOneof(2); + } + + public function hasH265() + { + return $this->hasOneof(2); + } + + /** + * H265 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.H265CodecSettings h265 = 2; + * @param \Google\Cloud\Video\Transcoder\V1\VideoStream\H265CodecSettings $var + * @return $this + */ + public function setH265($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\VideoStream\H265CodecSettings::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * VP9 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.Vp9CodecSettings vp9 = 3; + * @return \Google\Cloud\Video\Transcoder\V1\VideoStream\Vp9CodecSettings|null + */ + public function getVp9() + { + return $this->readOneof(3); + } + + public function hasVp9() + { + return $this->hasOneof(3); + } + + /** + * VP9 codec settings. + * + * Generated from protobuf field .google.cloud.video.transcoder.v1.VideoStream.Vp9CodecSettings vp9 = 3; + * @param \Google\Cloud\Video\Transcoder\V1\VideoStream\Vp9CodecSettings $var + * @return $this + */ + public function setVp9($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Transcoder\V1\VideoStream\Vp9CodecSettings::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getCodecSettings() + { + return $this->whichOneof("codec_settings"); + } + +} + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H264CodecSettings.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H264CodecSettings.php new file mode 100644 index 00000000000..0474d647aed --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H264CodecSettings.php @@ -0,0 +1,994 @@ +google.cloud.video.transcoder.v1.VideoStream.H264CodecSettings + */ +class H264CodecSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + */ + protected $width_pixels = 0; + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + */ + protected $height_pixels = 0; + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $frame_rate = 0.0; + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + */ + protected $pixel_format = ''; + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + */ + protected $rate_control_mode = ''; + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + */ + protected $crf_level = 0; + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + */ + protected $allow_open_gop = false; + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + */ + protected $enable_two_pass = false; + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + */ + protected $vbv_size_bits = 0; + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + */ + protected $vbv_fullness_bits = 0; + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 14; + */ + protected $entropy_coder = ''; + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 15; + */ + protected $b_pyramid = false; + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 16; + */ + protected $b_frame_count = 0; + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 17; + */ + protected $aq_strength = 0.0; + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` + * * `high` (default) + * The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string profile = 18; + */ + protected $profile = ''; + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string tune = 19; + */ + protected $tune = ''; + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string preset = 20; + */ + protected $preset = ''; + protected $gop_mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $width_pixels + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type int $height_pixels + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type float $frame_rate + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * @type int $bitrate_bps + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * @type string $pixel_format + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * @type string $rate_control_mode + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * @type int $crf_level + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * @type bool $allow_open_gop + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * @type int $gop_frame_count + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * @type \Google\Protobuf\Duration $gop_duration + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * @type bool $enable_two_pass + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * @type int $vbv_size_bits + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * @type int $vbv_fullness_bits + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * @type string $entropy_coder + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * @type bool $b_pyramid + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * @type int $b_frame_count + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * @type float $aq_strength + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * @type string $profile + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` + * * `high` (default) + * The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * @type string $tune + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * @type string $preset + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @return int + */ + public function getWidthPixels() + { + return $this->width_pixels; + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @param int $var + * @return $this + */ + public function setWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->width_pixels = $var; + + return $this; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @return int + */ + public function getHeightPixels() + { + return $this->height_pixels; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @param int $var + * @return $this + */ + public function setHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->height_pixels = $var; + + return $this; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getFrameRate() + { + return $this->frame_rate; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setFrameRate($var) + { + GPBUtil::checkDouble($var); + $this->frame_rate = $var; + + return $this; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @return string + */ + public function getPixelFormat() + { + return $this->pixel_format; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @param string $var + * @return $this + */ + public function setPixelFormat($var) + { + GPBUtil::checkString($var, True); + $this->pixel_format = $var; + + return $this; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + * @return string + */ + public function getRateControlMode() + { + return $this->rate_control_mode; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + * @param string $var + * @return $this + */ + public function setRateControlMode($var) + { + GPBUtil::checkString($var, True); + $this->rate_control_mode = $var; + + return $this; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + * @return int + */ + public function getCrfLevel() + { + return $this->crf_level; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + * @param int $var + * @return $this + */ + public function setCrfLevel($var) + { + GPBUtil::checkInt32($var); + $this->crf_level = $var; + + return $this; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + * @return bool + */ + public function getAllowOpenGop() + { + return $this->allow_open_gop; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + * @param bool $var + * @return $this + */ + public function setAllowOpenGop($var) + { + GPBUtil::checkBool($var); + $this->allow_open_gop = $var; + + return $this; + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 9; + * @return int + */ + public function getGopFrameCount() + { + return $this->readOneof(9); + } + + public function hasGopFrameCount() + { + return $this->hasOneof(9); + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 9; + * @param int $var + * @return $this + */ + public function setGopFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 10; + * @return \Google\Protobuf\Duration|null + */ + public function getGopDuration() + { + return $this->readOneof(10); + } + + public function hasGopDuration() + { + return $this->hasOneof(10); + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 10; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setGopDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + * @return bool + */ + public function getEnableTwoPass() + { + return $this->enable_two_pass; + } + + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + * @param bool $var + * @return $this + */ + public function setEnableTwoPass($var) + { + GPBUtil::checkBool($var); + $this->enable_two_pass = $var; + + return $this; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + * @return int + */ + public function getVbvSizeBits() + { + return $this->vbv_size_bits; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + * @param int $var + * @return $this + */ + public function setVbvSizeBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_size_bits = $var; + + return $this; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + * @return int + */ + public function getVbvFullnessBits() + { + return $this->vbv_fullness_bits; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + * @param int $var + * @return $this + */ + public function setVbvFullnessBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_fullness_bits = $var; + + return $this; + } + + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 14; + * @return string + */ + public function getEntropyCoder() + { + return $this->entropy_coder; + } + + /** + * The entropy coder to use. The default is `cabac`. + * Supported entropy coders: + * - `cavlc` + * - `cabac` + * + * Generated from protobuf field string entropy_coder = 14; + * @param string $var + * @return $this + */ + public function setEntropyCoder($var) + { + GPBUtil::checkString($var, True); + $this->entropy_coder = $var; + + return $this; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 15; + * @return bool + */ + public function getBPyramid() + { + return $this->b_pyramid; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 15; + * @param bool $var + * @return $this + */ + public function setBPyramid($var) + { + GPBUtil::checkBool($var); + $this->b_pyramid = $var; + + return $this; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 16; + * @return int + */ + public function getBFrameCount() + { + return $this->b_frame_count; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 16; + * @param int $var + * @return $this + */ + public function setBFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->b_frame_count = $var; + + return $this; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 17; + * @return float + */ + public function getAqStrength() + { + return $this->aq_strength; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 17; + * @param float $var + * @return $this + */ + public function setAqStrength($var) + { + GPBUtil::checkDouble($var); + $this->aq_strength = $var; + + return $this; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` + * * `high` (default) + * The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string profile = 18; + * @return string + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `baseline` + * * `main` + * * `high` (default) + * The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string profile = 18; + * @param string $var + * @return $this + */ + public function setProfile($var) + { + GPBUtil::checkString($var, True); + $this->profile = $var; + + return $this; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string tune = 19; + * @return string + */ + public function getTune() + { + return $this->tune; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string tune = 19; + * @param string $var + * @return $this + */ + public function setTune($var) + { + GPBUtil::checkString($var, True); + $this->tune = $var; + + return $this; + } + + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string preset = 20; + * @return string + */ + public function getPreset() + { + return $this->preset; + } + + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H264CodecSettings` + * message. + * + * Generated from protobuf field string preset = 20; + * @param string $var + * @return $this + */ + public function setPreset($var) + { + GPBUtil::checkString($var, True); + $this->preset = $var; + + return $this; + } + + /** + * @return string + */ + public function getGopMode() + { + return $this->whichOneof("gop_mode"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(H264CodecSettings::class, \Google\Cloud\Video\Transcoder\V1\VideoStream_H264CodecSettings::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H265CodecSettings.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H265CodecSettings.php new file mode 100644 index 00000000000..e19c5340e52 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/H265CodecSettings.php @@ -0,0 +1,1008 @@ +google.cloud.video.transcoder.v1.VideoStream.H265CodecSettings + */ +class H265CodecSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + */ + protected $width_pixels = 0; + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + */ + protected $height_pixels = 0; + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $frame_rate = 0.0; + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + */ + protected $pixel_format = ''; + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + */ + protected $rate_control_mode = ''; + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + */ + protected $crf_level = 0; + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + */ + protected $allow_open_gop = false; + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + */ + protected $enable_two_pass = false; + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + */ + protected $vbv_size_bits = 0; + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + */ + protected $vbv_fullness_bits = 0; + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 14; + */ + protected $b_pyramid = false; + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 15; + */ + protected $b_frame_count = 0; + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 16; + */ + protected $aq_strength = 0.0; + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * 8-bit profiles + * * `main` (default) + * * `main-intra` + * * `mainstillpicture` + * * 10-bit profiles + * * `main10` (default) + * * `main10-intra` + * * `main422-10` + * * `main422-10-intra` + * * `main444-10` + * * `main444-10-intra` + * * 12-bit profiles + * * `main12` (default) + * * `main12-intra` + * * `main422-12` + * * `main422-12-intra` + * * `main444-12` + * * `main444-12-intra` + * The available options are + * [FFmpeg-compatible](https://x265.readthedocs.io/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string profile = 17; + */ + protected $profile = ''; + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string tune = 18; + */ + protected $tune = ''; + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string preset = 19; + */ + protected $preset = ''; + protected $gop_mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $width_pixels + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type int $height_pixels + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type float $frame_rate + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * @type int $bitrate_bps + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * @type string $pixel_format + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * @type string $rate_control_mode + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * @type int $crf_level + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * @type bool $allow_open_gop + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * @type int $gop_frame_count + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * @type \Google\Protobuf\Duration $gop_duration + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * @type bool $enable_two_pass + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * @type int $vbv_size_bits + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * @type int $vbv_fullness_bits + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * @type bool $b_pyramid + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * @type int $b_frame_count + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * @type float $aq_strength + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * @type string $profile + * Enforces the specified codec profile. The following profiles are + * supported: + * * 8-bit profiles + * * `main` (default) + * * `main-intra` + * * `mainstillpicture` + * * 10-bit profiles + * * `main10` (default) + * * `main10-intra` + * * `main422-10` + * * `main422-10-intra` + * * `main444-10` + * * `main444-10-intra` + * * 12-bit profiles + * * `main12` (default) + * * `main12-intra` + * * `main422-12` + * * `main422-12-intra` + * * `main444-12` + * * `main444-12-intra` + * The available options are + * [FFmpeg-compatible](https://x265.readthedocs.io/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * @type string $tune + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * @type string $preset + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @return int + */ + public function getWidthPixels() + { + return $this->width_pixels; + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @param int $var + * @return $this + */ + public function setWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->width_pixels = $var; + + return $this; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @return int + */ + public function getHeightPixels() + { + return $this->height_pixels; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @param int $var + * @return $this + */ + public function setHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->height_pixels = $var; + + return $this; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getFrameRate() + { + return $this->frame_rate; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setFrameRate($var) + { + GPBUtil::checkDouble($var); + $this->frame_rate = $var; + + return $this; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 800,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @return string + */ + public function getPixelFormat() + { + return $this->pixel_format; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @param string $var + * @return $this + */ + public function setPixelFormat($var) + { + GPBUtil::checkString($var, True); + $this->pixel_format = $var; + + return $this; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + * @return string + */ + public function getRateControlMode() + { + return $this->rate_control_mode; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * - `crf` - constant rate factor + * + * Generated from protobuf field string rate_control_mode = 6; + * @param string $var + * @return $this + */ + public function setRateControlMode($var) + { + GPBUtil::checkString($var, True); + $this->rate_control_mode = $var; + + return $this; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + * @return int + */ + public function getCrfLevel() + { + return $this->crf_level; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * + * Generated from protobuf field int32 crf_level = 7; + * @param int $var + * @return $this + */ + public function setCrfLevel($var) + { + GPBUtil::checkInt32($var); + $this->crf_level = $var; + + return $this; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + * @return bool + */ + public function getAllowOpenGop() + { + return $this->allow_open_gop; + } + + /** + * Specifies whether an open Group of Pictures (GOP) structure should be + * allowed or not. The default is `false`. + * + * Generated from protobuf field bool allow_open_gop = 8; + * @param bool $var + * @return $this + */ + public function setAllowOpenGop($var) + { + GPBUtil::checkBool($var); + $this->allow_open_gop = $var; + + return $this; + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 9; + * @return int + */ + public function getGopFrameCount() + { + return $this->readOneof(9); + } + + public function hasGopFrameCount() + { + return $this->hasOneof(9); + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 9; + * @param int $var + * @return $this + */ + public function setGopFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 10; + * @return \Google\Protobuf\Duration|null + */ + public function getGopDuration() + { + return $this->readOneof(10); + } + + public function hasGopDuration() + { + return $this->hasOneof(10); + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 10; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setGopDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + * @return bool + */ + public function getEnableTwoPass() + { + return $this->enable_two_pass; + } + + /** + * Use two-pass encoding strategy to achieve better video quality. + * `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + * + * Generated from protobuf field bool enable_two_pass = 11; + * @param bool $var + * @return $this + */ + public function setEnableTwoPass($var) + { + GPBUtil::checkBool($var); + $this->enable_two_pass = $var; + + return $this; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + * @return int + */ + public function getVbvSizeBits() + { + return $this->vbv_size_bits; + } + + /** + * Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + * greater than zero. The default is equal to `VideoStream.bitrate_bps`. + * + * Generated from protobuf field int32 vbv_size_bits = 12; + * @param int $var + * @return $this + */ + public function setVbvSizeBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_size_bits = $var; + + return $this; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + * @return int + */ + public function getVbvFullnessBits() + { + return $this->vbv_fullness_bits; + } + + /** + * Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + * Must be greater than zero. The default is equal to 90% of + * `VideoStream.vbv_size_bits`. + * + * Generated from protobuf field int32 vbv_fullness_bits = 13; + * @param int $var + * @return $this + */ + public function setVbvFullnessBits($var) + { + GPBUtil::checkInt32($var); + $this->vbv_fullness_bits = $var; + + return $this; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 14; + * @return bool + */ + public function getBPyramid() + { + return $this->b_pyramid; + } + + /** + * Allow B-pyramid for reference frame selection. This may not be supported + * on all decoders. The default is `false`. + * + * Generated from protobuf field bool b_pyramid = 14; + * @param bool $var + * @return $this + */ + public function setBPyramid($var) + { + GPBUtil::checkBool($var); + $this->b_pyramid = $var; + + return $this; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 15; + * @return int + */ + public function getBFrameCount() + { + return $this->b_frame_count; + } + + /** + * The number of consecutive B-frames. Must be greater than or equal to + * zero. Must be less than `VideoStream.gop_frame_count` if set. The default + * is 0. + * + * Generated from protobuf field int32 b_frame_count = 15; + * @param int $var + * @return $this + */ + public function setBFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->b_frame_count = $var; + + return $this; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 16; + * @return float + */ + public function getAqStrength() + { + return $this->aq_strength; + } + + /** + * Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + * and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + * higher value equals a lower bitrate but smoother image. The default is 0. + * + * Generated from protobuf field double aq_strength = 16; + * @param float $var + * @return $this + */ + public function setAqStrength($var) + { + GPBUtil::checkDouble($var); + $this->aq_strength = $var; + + return $this; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * 8-bit profiles + * * `main` (default) + * * `main-intra` + * * `mainstillpicture` + * * 10-bit profiles + * * `main10` (default) + * * `main10-intra` + * * `main422-10` + * * `main422-10-intra` + * * `main444-10` + * * `main444-10-intra` + * * 12-bit profiles + * * `main12` (default) + * * `main12-intra` + * * `main422-12` + * * `main422-12-intra` + * * `main444-12` + * * `main444-12-intra` + * The available options are + * [FFmpeg-compatible](https://x265.readthedocs.io/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string profile = 17; + * @return string + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * 8-bit profiles + * * `main` (default) + * * `main-intra` + * * `mainstillpicture` + * * 10-bit profiles + * * `main10` (default) + * * `main10-intra` + * * `main422-10` + * * `main422-10-intra` + * * `main444-10` + * * `main444-10-intra` + * * 12-bit profiles + * * `main12` (default) + * * `main12-intra` + * * `main422-12` + * * `main422-12-intra` + * * `main444-12` + * * `main444-12-intra` + * The available options are + * [FFmpeg-compatible](https://x265.readthedocs.io/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string profile = 17; + * @param string $var + * @return $this + */ + public function setProfile($var) + { + GPBUtil::checkString($var, True); + $this->profile = $var; + + return $this; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string tune = 18; + * @return string + */ + public function getTune() + { + return $this->tune; + } + + /** + * Enforces the specified codec tune. The available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string tune = 18; + * @param string $var + * @return $this + */ + public function setTune($var) + { + GPBUtil::checkString($var, True); + $this->tune = $var; + + return $this; + } + + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string preset = 19; + * @return string + */ + public function getPreset() + { + return $this->preset; + } + + /** + * Enforces the specified codec preset. The default is `veryfast`. The + * available options are + * [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `H265CodecSettings` + * message. + * + * Generated from protobuf field string preset = 19; + * @param string $var + * @return $this + */ + public function setPreset($var) + { + GPBUtil::checkString($var, True); + $this->preset = $var; + + return $this; + } + + /** + * @return string + */ + public function getGopMode() + { + return $this->whichOneof("gop_mode"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(H265CodecSettings::class, \Google\Cloud\Video\Transcoder\V1\VideoStream_H265CodecSettings::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/Vp9CodecSettings.php b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/Vp9CodecSettings.php new file mode 100644 index 00000000000..f062f31d764 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/proto/src/Google/Cloud/Video/Transcoder/V1/VideoStream/Vp9CodecSettings.php @@ -0,0 +1,570 @@ +google.cloud.video.transcoder.v1.VideoStream.Vp9CodecSettings + */ +class Vp9CodecSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + */ + protected $width_pixels = 0; + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + */ + protected $height_pixels = 0; + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $frame_rate = 0.0; + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 480,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $bitrate_bps = 0; + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + */ + protected $pixel_format = ''; + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * + * Generated from protobuf field string rate_control_mode = 6; + */ + protected $rate_control_mode = ''; + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * **Note:** This field is not supported. + * + * Generated from protobuf field int32 crf_level = 7; + */ + protected $crf_level = 0; + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `profile0` (default) + * * `profile1` + * * `profile2` + * * `profile3` + * The available options are + * [WebM-compatible](https://www.webmproject.org/vp9/profiles/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `Vp9CodecSettings` + * message. + * + * Generated from protobuf field string profile = 10; + */ + protected $profile = ''; + protected $gop_mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $width_pixels + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type int $height_pixels + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * @type float $frame_rate + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * @type int $bitrate_bps + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 480,000,000. + * @type string $pixel_format + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * @type string $rate_control_mode + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * @type int $crf_level + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * **Note:** This field is not supported. + * @type int $gop_frame_count + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * @type \Google\Protobuf\Duration $gop_duration + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * @type string $profile + * Enforces the specified codec profile. The following profiles are + * supported: + * * `profile0` (default) + * * `profile1` + * * `profile2` + * * `profile3` + * The available options are + * [WebM-compatible](https://www.webmproject.org/vp9/profiles/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `Vp9CodecSettings` + * message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Transcoder\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @return int + */ + public function getWidthPixels() + { + return $this->width_pixels; + } + + /** + * The width of the video in pixels. Must be an even integer. + * When not specified, the width is adjusted to match the specified height + * and input aspect ratio. If both are omitted, the input width is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the width, in pixels, per the horizontal ASR. The API calculates + * the height per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 width_pixels = 1; + * @param int $var + * @return $this + */ + public function setWidthPixels($var) + { + GPBUtil::checkInt32($var); + $this->width_pixels = $var; + + return $this; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @return int + */ + public function getHeightPixels() + { + return $this->height_pixels; + } + + /** + * The height of the video in pixels. Must be an even integer. + * When not specified, the height is adjusted to match the specified width + * and input aspect ratio. If both are omitted, the input height is used. + * For portrait videos that contain horizontal ASR and rotation metadata, + * provide the height, in pixels, per the horizontal ASR. The API calculates + * the width per the horizontal ASR. The API detects any rotation metadata + * and swaps the requested height and width for the output. + * + * Generated from protobuf field int32 height_pixels = 2; + * @param int $var + * @return $this + */ + public function setHeightPixels($var) + { + GPBUtil::checkInt32($var); + $this->height_pixels = $var; + + return $this; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getFrameRate() + { + return $this->frame_rate; + } + + /** + * Required. The target video frame rate in frames per second (FPS). Must be + * less than or equal to 120. Will default to the input frame rate if larger + * than the input frame rate. The API will generate an output FPS that is + * divisible by the input FPS, and smaller or equal to the target FPS. See + * [Calculating frame + * rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + * more information. + * + * Generated from protobuf field double frame_rate = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setFrameRate($var) + { + GPBUtil::checkDouble($var); + $this->frame_rate = $var; + + return $this; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 480,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getBitrateBps() + { + return $this->bitrate_bps; + } + + /** + * Required. The video bitrate in bits per second. The minimum value is + * 1,000. The maximum value is 480,000,000. + * + * Generated from protobuf field int32 bitrate_bps = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setBitrateBps($var) + { + GPBUtil::checkInt32($var); + $this->bitrate_bps = $var; + + return $this; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @return string + */ + public function getPixelFormat() + { + return $this->pixel_format; + } + + /** + * Pixel format to use. The default is `yuv420p`. + * Supported pixel formats: + * - `yuv420p` pixel format + * - `yuv422p` pixel format + * - `yuv444p` pixel format + * - `yuv420p10` 10-bit HDR pixel format + * - `yuv422p10` 10-bit HDR pixel format + * - `yuv444p10` 10-bit HDR pixel format + * - `yuv420p12` 12-bit HDR pixel format + * - `yuv422p12` 12-bit HDR pixel format + * - `yuv444p12` 12-bit HDR pixel format + * + * Generated from protobuf field string pixel_format = 5; + * @param string $var + * @return $this + */ + public function setPixelFormat($var) + { + GPBUtil::checkString($var, True); + $this->pixel_format = $var; + + return $this; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * + * Generated from protobuf field string rate_control_mode = 6; + * @return string + */ + public function getRateControlMode() + { + return $this->rate_control_mode; + } + + /** + * Specify the `rate_control_mode`. The default is `vbr`. + * Supported rate control modes: + * - `vbr` - variable bitrate + * + * Generated from protobuf field string rate_control_mode = 6; + * @param string $var + * @return $this + */ + public function setRateControlMode($var) + { + GPBUtil::checkString($var, True); + $this->rate_control_mode = $var; + + return $this; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * **Note:** This field is not supported. + * + * Generated from protobuf field int32 crf_level = 7; + * @return int + */ + public function getCrfLevel() + { + return $this->crf_level; + } + + /** + * Target CRF level. Must be between 10 and 36, where 10 is the highest + * quality and 36 is the most efficient compression. The default is 21. + * **Note:** This field is not supported. + * + * Generated from protobuf field int32 crf_level = 7; + * @param int $var + * @return $this + */ + public function setCrfLevel($var) + { + GPBUtil::checkInt32($var); + $this->crf_level = $var; + + return $this; + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 8; + * @return int + */ + public function getGopFrameCount() + { + return $this->readOneof(8); + } + + public function hasGopFrameCount() + { + return $this->hasOneof(8); + } + + /** + * Select the GOP size based on the specified frame count. Must be greater + * than zero. + * + * Generated from protobuf field int32 gop_frame_count = 8; + * @param int $var + * @return $this + */ + public function setGopFrameCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 9; + * @return \Google\Protobuf\Duration|null + */ + public function getGopDuration() + { + return $this->readOneof(9); + } + + public function hasGopDuration() + { + return $this->hasOneof(9); + } + + /** + * Select the GOP size based on the specified duration. The default is + * `3s`. Note that `gopDuration` must be less than or equal to + * [`segmentDuration`](#SegmentSettings), and + * [`segmentDuration`](#SegmentSettings) must be divisible by + * `gopDuration`. + * + * Generated from protobuf field .google.protobuf.Duration gop_duration = 9; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setGopDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `profile0` (default) + * * `profile1` + * * `profile2` + * * `profile3` + * The available options are + * [WebM-compatible](https://www.webmproject.org/vp9/profiles/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `Vp9CodecSettings` + * message. + * + * Generated from protobuf field string profile = 10; + * @return string + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Enforces the specified codec profile. The following profiles are + * supported: + * * `profile0` (default) + * * `profile1` + * * `profile2` + * * `profile3` + * The available options are + * [WebM-compatible](https://www.webmproject.org/vp9/profiles/). + * Note that certain values for this field may cause the + * transcoder to override other fields you set in the `Vp9CodecSettings` + * message. + * + * Generated from protobuf field string profile = 10; + * @param string $var + * @return $this + */ + public function setProfile($var) + { + GPBUtil::checkString($var, True); + $this->profile = $var; + + return $this; + } + + /** + * @return string + */ + public function getGopMode() + { + return $this->whichOneof("gop_mode"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Vp9CodecSettings::class, \Google\Cloud\Video\Transcoder\V1\VideoStream_Vp9CodecSettings::class); + diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job.php new file mode 100644 index 00000000000..76ef88e0d8a --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setJob($job); + + // Call the API and handle any network failures. + try { + /** @var Job $response */ + $response = $transcoderServiceClient->createJob($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranscoderServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_job_sample($formattedParent); +} +// [END transcoder_v1_generated_TranscoderService_CreateJob_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job_template.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job_template.php new file mode 100644 index 00000000000..5e799c73eee --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/create_job_template.php @@ -0,0 +1,81 @@ +setParent($formattedParent) + ->setJobTemplate($jobTemplate) + ->setJobTemplateId($jobTemplateId); + + // Call the API and handle any network failures. + try { + /** @var JobTemplate $response */ + $response = $transcoderServiceClient->createJobTemplate($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranscoderServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $jobTemplateId = '[JOB_TEMPLATE_ID]'; + + create_job_template_sample($formattedParent, $jobTemplateId); +} +// [END transcoder_v1_generated_TranscoderService_CreateJobTemplate_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job.php new file mode 100644 index 00000000000..0c39038a6a0 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $transcoderServiceClient->deleteJob($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranscoderServiceClient::jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + + delete_job_sample($formattedName); +} +// [END transcoder_v1_generated_TranscoderService_DeleteJob_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job_template.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job_template.php new file mode 100644 index 00000000000..36d0c221fba --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/delete_job_template.php @@ -0,0 +1,74 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $transcoderServiceClient->deleteJobTemplate($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranscoderServiceClient::jobTemplateName( + '[PROJECT]', + '[LOCATION]', + '[JOB_TEMPLATE]' + ); + + delete_job_template_sample($formattedName); +} +// [END transcoder_v1_generated_TranscoderService_DeleteJobTemplate_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job.php new file mode 100644 index 00000000000..440b93574b4 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Job $response */ + $response = $transcoderServiceClient->getJob($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranscoderServiceClient::jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + + get_job_sample($formattedName); +} +// [END transcoder_v1_generated_TranscoderService_GetJob_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job_template.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job_template.php new file mode 100644 index 00000000000..713e96f0a4d --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/get_job_template.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var JobTemplate $response */ + $response = $transcoderServiceClient->getJobTemplate($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TranscoderServiceClient::jobTemplateName( + '[PROJECT]', + '[LOCATION]', + '[JOB_TEMPLATE]' + ); + + get_job_template_sample($formattedName); +} +// [END transcoder_v1_generated_TranscoderService_GetJobTemplate_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_job_templates.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_job_templates.php new file mode 100644 index 00000000000..b031446bb98 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_job_templates.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $transcoderServiceClient->listJobTemplates($request); + + /** @var JobTemplate $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranscoderServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_job_templates_sample($formattedParent); +} +// [END transcoder_v1_generated_TranscoderService_ListJobTemplates_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_jobs.php b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_jobs.php new file mode 100644 index 00000000000..ff6f16808a0 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/samples/V1/TranscoderServiceClient/list_jobs.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $transcoderServiceClient->listJobs($request); + + /** @var Job $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TranscoderServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_jobs_sample($formattedParent); +} +// [END transcoder_v1_generated_TranscoderService_ListJobs_sync] diff --git a/owl-bot-staging/VideoTranscoder/v1/src/V1/Client/TranscoderServiceClient.php b/owl-bot-staging/VideoTranscoder/v1/src/V1/Client/TranscoderServiceClient.php new file mode 100644 index 00000000000..624603b3e54 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/src/V1/Client/TranscoderServiceClient.php @@ -0,0 +1,476 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/transcoder_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/transcoder_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/transcoder_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/transcoder_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a job + * resource. + * + * @param string $project + * @param string $location + * @param string $job + * + * @return string The formatted job resource. + */ + public static function jobName(string $project, string $location, string $job): string + { + return self::getPathTemplate('job')->render([ + 'project' => $project, + 'location' => $location, + 'job' => $job, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a job_template + * resource. + * + * @param string $project + * @param string $location + * @param string $jobTemplate + * + * @return string The formatted job_template resource. + */ + public static function jobTemplateName(string $project, string $location, string $jobTemplate): string + { + return self::getPathTemplate('jobTemplate')->render([ + 'project' => $project, + 'location' => $location, + 'job_template' => $jobTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - job: projects/{project}/locations/{location}/jobs/{job} + * - jobTemplate: projects/{project}/locations/{location}/jobTemplates/{job_template} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'transcoder.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a job in the specified region. + * + * The async variant is {@see TranscoderServiceClient::createJobAsync()} . + * + * @example samples/V1/TranscoderServiceClient/create_job.php + * + * @param CreateJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Job + * + * @throws ApiException Thrown if the API call fails. + */ + public function createJob(CreateJobRequest $request, array $callOptions = []): Job + { + return $this->startApiCall('CreateJob', $request, $callOptions)->wait(); + } + + /** + * Creates a job template in the specified region. + * + * The async variant is {@see TranscoderServiceClient::createJobTemplateAsync()} . + * + * @example samples/V1/TranscoderServiceClient/create_job_template.php + * + * @param CreateJobTemplateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 JobTemplate + * + * @throws ApiException Thrown if the API call fails. + */ + public function createJobTemplate(CreateJobTemplateRequest $request, array $callOptions = []): JobTemplate + { + return $this->startApiCall('CreateJobTemplate', $request, $callOptions)->wait(); + } + + /** + * Deletes a job. + * + * The async variant is {@see TranscoderServiceClient::deleteJobAsync()} . + * + * @example samples/V1/TranscoderServiceClient/delete_job.php + * + * @param DeleteJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteJob(DeleteJobRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteJob', $request, $callOptions)->wait(); + } + + /** + * Deletes a job template. + * + * The async variant is {@see TranscoderServiceClient::deleteJobTemplateAsync()} . + * + * @example samples/V1/TranscoderServiceClient/delete_job_template.php + * + * @param DeleteJobTemplateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteJobTemplate(DeleteJobTemplateRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteJobTemplate', $request, $callOptions)->wait(); + } + + /** + * Returns the job data. + * + * The async variant is {@see TranscoderServiceClient::getJobAsync()} . + * + * @example samples/V1/TranscoderServiceClient/get_job.php + * + * @param GetJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Job + * + * @throws ApiException Thrown if the API call fails. + */ + public function getJob(GetJobRequest $request, array $callOptions = []): Job + { + return $this->startApiCall('GetJob', $request, $callOptions)->wait(); + } + + /** + * Returns the job template data. + * + * The async variant is {@see TranscoderServiceClient::getJobTemplateAsync()} . + * + * @example samples/V1/TranscoderServiceClient/get_job_template.php + * + * @param GetJobTemplateRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 JobTemplate + * + * @throws ApiException Thrown if the API call fails. + */ + public function getJobTemplate(GetJobTemplateRequest $request, array $callOptions = []): JobTemplate + { + return $this->startApiCall('GetJobTemplate', $request, $callOptions)->wait(); + } + + /** + * Lists job templates in the specified region. + * + * The async variant is {@see TranscoderServiceClient::listJobTemplatesAsync()} . + * + * @example samples/V1/TranscoderServiceClient/list_job_templates.php + * + * @param ListJobTemplatesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listJobTemplates(ListJobTemplatesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListJobTemplates', $request, $callOptions); + } + + /** + * Lists jobs in the specified region. + * + * The async variant is {@see TranscoderServiceClient::listJobsAsync()} . + * + * @example samples/V1/TranscoderServiceClient/list_jobs.php + * + * @param ListJobsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listJobs(ListJobsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListJobs', $request, $callOptions); + } +} diff --git a/owl-bot-staging/VideoTranscoder/v1/src/V1/Gapic/TranscoderServiceGapicClient.php b/owl-bot-staging/VideoTranscoder/v1/src/V1/Gapic/TranscoderServiceGapicClient.php new file mode 100644 index 00000000000..e8ed297d763 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/src/V1/Gapic/TranscoderServiceGapicClient.php @@ -0,0 +1,760 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $job = new Job(); + * $response = $transcoderServiceClient->createJob($formattedParent, $job); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Video\Transcoder\V1\Client\TranscoderServiceClient}. + */ +class TranscoderServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.video.transcoder.v1.TranscoderService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'transcoder.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'transcoder.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 static $jobNameTemplate; + + private static $jobTemplateNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/transcoder_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/transcoder_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/transcoder_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/transcoder_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getJobNameTemplate() + { + if (self::$jobNameTemplate == null) { + self::$jobNameTemplate = new PathTemplate('projects/{project}/locations/{location}/jobs/{job}'); + } + + return self::$jobNameTemplate; + } + + private static function getJobTemplateNameTemplate() + { + if (self::$jobTemplateNameTemplate == null) { + self::$jobTemplateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/jobTemplates/{job_template}'); + } + + return self::$jobTemplateNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'job' => self::getJobNameTemplate(), + 'jobTemplate' => self::getJobTemplateNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a job + * resource. + * + * @param string $project + * @param string $location + * @param string $job + * + * @return string The formatted job resource. + */ + public static function jobName($project, $location, $job) + { + return self::getJobNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'job' => $job, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a job_template + * resource. + * + * @param string $project + * @param string $location + * @param string $jobTemplate + * + * @return string The formatted job_template resource. + */ + public static function jobTemplateName($project, $location, $jobTemplate) + { + return self::getJobTemplateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'job_template' => $jobTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - job: projects/{project}/locations/{location}/jobs/{job} + * - jobTemplate: projects/{project}/locations/{location}/jobTemplates/{job_template} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'transcoder.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); + } + + /** + * Creates a job in the specified region. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedParent = $transcoderServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $job = new Job(); + * $response = $transcoderServiceClient->createJob($formattedParent, $job); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * @param Job $job Required. Parameters for creating transcoding job. + * @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\Cloud\Video\Transcoder\V1\Job + * + * @throws ApiException if the remote call fails + */ + public function createJob($parent, $job, array $optionalArgs = []) + { + $request = new CreateJobRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setJob($job); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateJob', Job::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a job template in the specified region. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedParent = $transcoderServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $jobTemplate = new JobTemplate(); + * $jobTemplateId = 'job_template_id'; + * $response = $transcoderServiceClient->createJobTemplate($formattedParent, $jobTemplate, $jobTemplateId); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * @param JobTemplate $jobTemplate Required. Parameters for creating job template. + * @param string $jobTemplateId Required. The ID to use for the job template, which will become the final + * component of the job template's resource name. + * + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + * @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\Cloud\Video\Transcoder\V1\JobTemplate + * + * @throws ApiException if the remote call fails + */ + public function createJobTemplate($parent, $jobTemplate, $jobTemplateId, array $optionalArgs = []) + { + $request = new CreateJobTemplateRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setJobTemplate($jobTemplate); + $request->setJobTemplateId($jobTemplateId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateJobTemplate', JobTemplate::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a job. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedName = $transcoderServiceClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + * $transcoderServiceClient->deleteJob($formattedName); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * @param array $optionalArgs { + * Optional. + * + * @type bool $allowMissing + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteJob($name, array $optionalArgs = []) + { + $request = new DeleteJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteJob', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a job template. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedName = $transcoderServiceClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + * $transcoderServiceClient->deleteJobTemplate($formattedName); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * @param array $optionalArgs { + * Optional. + * + * @type bool $allowMissing + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteJobTemplate($name, array $optionalArgs = []) + { + $request = new DeleteJobTemplateRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteJobTemplate', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the job data. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedName = $transcoderServiceClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + * $response = $transcoderServiceClient->getJob($formattedName); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * @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\Cloud\Video\Transcoder\V1\Job + * + * @throws ApiException if the remote call fails + */ + public function getJob($name, array $optionalArgs = []) + { + $request = new GetJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetJob', Job::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the job template data. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedName = $transcoderServiceClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + * $response = $transcoderServiceClient->getJobTemplate($formattedName); + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * @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\Cloud\Video\Transcoder\V1\JobTemplate + * + * @throws ApiException if the remote call fails + */ + public function getJobTemplate($name, array $optionalArgs = []) + { + $request = new GetJobTemplateRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetJobTemplate', JobTemplate::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists job templates in the specified region. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedParent = $transcoderServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $transcoderServiceClient->listJobTemplates($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $transcoderServiceClient->listJobTemplates($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent location from which to retrieve the collection of job + * templates. Format: `projects/{project}/locations/{location}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listJobTemplates($parent, array $optionalArgs = []) + { + $request = new ListJobTemplatesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListJobTemplates', $optionalArgs, ListJobTemplatesResponse::class, $request); + } + + /** + * Lists jobs in the specified region. + * + * Sample code: + * ``` + * $transcoderServiceClient = new TranscoderServiceClient(); + * try { + * $formattedParent = $transcoderServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $transcoderServiceClient->listJobs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $transcoderServiceClient->listJobs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $transcoderServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. Format: `projects/{project}/locations/{location}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @type string $orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listJobs($parent, array $optionalArgs = []) + { + $request = new ListJobsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListJobs', $optionalArgs, ListJobsResponse::class, $request); + } +} diff --git a/owl-bot-staging/VideoTranscoder/v1/src/V1/TranscoderServiceClient.php b/owl-bot-staging/VideoTranscoder/v1/src/V1/TranscoderServiceClient.php new file mode 100644 index 00000000000..94482cab70c --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/src/V1/TranscoderServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.video.transcoder.v1.TranscoderService' => [ + 'CreateJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\Job', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateJobTemplate' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\JobTemplate', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteJobTemplate' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\Job', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetJobTemplate' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\JobTemplate', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListJobTemplates' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getJobTemplates', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\ListJobTemplatesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListJobs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getJobs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Video\Transcoder\V1\ListJobsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'job' => 'projects/{project}/locations/{location}/jobs/{job}', + 'jobTemplate' => 'projects/{project}/locations/{location}/jobTemplates/{job_template}', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VideoTranscoder/v1/src/V1/resources/transcoder_service_rest_client_config.php b/owl-bot-staging/VideoTranscoder/v1/src/V1/resources/transcoder_service_rest_client_config.php new file mode 100644 index 00000000000..bedf0d6bda0 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/src/V1/resources/transcoder_service_rest_client_config.php @@ -0,0 +1,102 @@ + [ + 'google.cloud.video.transcoder.v1.TranscoderService' => [ + 'CreateJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/jobs', + 'body' => 'job', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateJobTemplate' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/jobTemplates', + 'body' => 'job_template', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'job_template_id', + ], + ], + 'DeleteJob' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/jobs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteJobTemplate' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/jobTemplates/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetJob' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/jobs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetJobTemplate' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/jobTemplates/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListJobTemplates' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/jobTemplates', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListJobs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/jobs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/Client/TranscoderServiceClientTest.php b/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/Client/TranscoderServiceClientTest.php new file mode 100644 index 00000000000..b5a2c2b81a2 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/Client/TranscoderServiceClientTest.php @@ -0,0 +1,676 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TranscoderServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TranscoderServiceClient($options); + } + + /** @test */ + public function createJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $inputUri = 'inputUri1707300727'; + $outputUri = 'outputUri-1273518802'; + $templateId = 'templateId1769642752'; + $ttlAfterCompletionDays = 107576420; + $batchModePriority = 2137003131; + $expectedResponse = new Job(); + $expectedResponse->setName($name); + $expectedResponse->setInputUri($inputUri); + $expectedResponse->setOutputUri($outputUri); + $expectedResponse->setTemplateId($templateId); + $expectedResponse->setTtlAfterCompletionDays($ttlAfterCompletionDays); + $expectedResponse->setBatchModePriority($batchModePriority); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $job = new Job(); + $request = (new CreateJobRequest()) + ->setParent($formattedParent) + ->setJob($job); + $response = $gapicClient->createJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/CreateJob', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJob(); + $this->assertProtobufEquals($job, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createJobExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $job = new Job(); + $request = (new CreateJobRequest()) + ->setParent($formattedParent) + ->setJob($job); + try { + $gapicClient->createJob($request); + // 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()); + } + + /** @test */ + public function createJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new JobTemplate(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $jobTemplate = new JobTemplate(); + $jobTemplateId = 'jobTemplateId-1231822466'; + $request = (new CreateJobTemplateRequest()) + ->setParent($formattedParent) + ->setJobTemplate($jobTemplate) + ->setJobTemplateId($jobTemplateId); + $response = $gapicClient->createJobTemplate($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/CreateJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJobTemplate(); + $this->assertProtobufEquals($jobTemplate, $actualValue); + $actualValue = $actualRequestObject->getJobTemplateId(); + $this->assertProtobufEquals($jobTemplateId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createJobTemplateExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $jobTemplate = new JobTemplate(); + $jobTemplateId = 'jobTemplateId-1231822466'; + $request = (new CreateJobTemplateRequest()) + ->setParent($formattedParent) + ->setJobTemplate($jobTemplate) + ->setJobTemplateId($jobTemplateId); + try { + $gapicClient->createJobTemplate($request); + // 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()); + } + + /** @test */ + public function deleteJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $request = (new DeleteJobRequest()) + ->setName($formattedName); + $gapicClient->deleteJob($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/DeleteJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteJobExceptionTest() + { + $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 + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $request = (new DeleteJobRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteJob($request); + // 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()); + } + + /** @test */ + public function deleteJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $request = (new DeleteJobTemplateRequest()) + ->setName($formattedName); + $gapicClient->deleteJobTemplate($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/DeleteJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteJobTemplateExceptionTest() + { + $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 + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $request = (new DeleteJobTemplateRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteJobTemplate($request); + // 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()); + } + + /** @test */ + public function getJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $inputUri = 'inputUri1707300727'; + $outputUri = 'outputUri-1273518802'; + $templateId = 'templateId1769642752'; + $ttlAfterCompletionDays = 107576420; + $batchModePriority = 2137003131; + $expectedResponse = new Job(); + $expectedResponse->setName($name2); + $expectedResponse->setInputUri($inputUri); + $expectedResponse->setOutputUri($outputUri); + $expectedResponse->setTemplateId($templateId); + $expectedResponse->setTtlAfterCompletionDays($ttlAfterCompletionDays); + $expectedResponse->setBatchModePriority($batchModePriority); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $request = (new GetJobRequest()) + ->setName($formattedName); + $response = $gapicClient->getJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/GetJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobExceptionTest() + { + $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 + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $request = (new GetJobRequest()) + ->setName($formattedName); + try { + $gapicClient->getJob($request); + // 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()); + } + + /** @test */ + public function getJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new JobTemplate(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $request = (new GetJobTemplateRequest()) + ->setName($formattedName); + $response = $gapicClient->getJobTemplate($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/GetJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobTemplateExceptionTest() + { + $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 + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $request = (new GetJobTemplateRequest()) + ->setName($formattedName); + try { + $gapicClient->getJobTemplate($request); + // 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()); + } + + /** @test */ + public function listJobTemplatesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobTemplatesElement = new JobTemplate(); + $jobTemplates = [ + $jobTemplatesElement, + ]; + $expectedResponse = new ListJobTemplatesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobTemplates($jobTemplates); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListJobTemplatesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listJobTemplates($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobTemplates()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/ListJobTemplates', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobTemplatesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListJobTemplatesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listJobTemplates($request); + // 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()); + } + + /** @test */ + public function listJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobsElement = new Job(); + $jobs = [ + $jobsElement, + ]; + $expectedResponse = new ListJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobs($jobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListJobsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listJobs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/ListJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListJobsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listJobs($request); + // 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()); + } + + /** @test */ + public function createJobAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $inputUri = 'inputUri1707300727'; + $outputUri = 'outputUri-1273518802'; + $templateId = 'templateId1769642752'; + $ttlAfterCompletionDays = 107576420; + $batchModePriority = 2137003131; + $expectedResponse = new Job(); + $expectedResponse->setName($name); + $expectedResponse->setInputUri($inputUri); + $expectedResponse->setOutputUri($outputUri); + $expectedResponse->setTemplateId($templateId); + $expectedResponse->setTtlAfterCompletionDays($ttlAfterCompletionDays); + $expectedResponse->setBatchModePriority($batchModePriority); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $job = new Job(); + $request = (new CreateJobRequest()) + ->setParent($formattedParent) + ->setJob($job); + $response = $gapicClient->createJobAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/CreateJob', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJob(); + $this->assertProtobufEquals($job, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/TranscoderServiceClientTest.php b/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/TranscoderServiceClientTest.php new file mode 100644 index 00000000000..d631031cc42 --- /dev/null +++ b/owl-bot-staging/VideoTranscoder/v1/tests/Unit/V1/TranscoderServiceClientTest.php @@ -0,0 +1,587 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return TranscoderServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new TranscoderServiceClient($options); + } + + /** @test */ + public function createJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $inputUri = 'inputUri1707300727'; + $outputUri = 'outputUri-1273518802'; + $templateId = 'templateId1769642752'; + $ttlAfterCompletionDays = 107576420; + $batchModePriority = 2137003131; + $expectedResponse = new Job(); + $expectedResponse->setName($name); + $expectedResponse->setInputUri($inputUri); + $expectedResponse->setOutputUri($outputUri); + $expectedResponse->setTemplateId($templateId); + $expectedResponse->setTtlAfterCompletionDays($ttlAfterCompletionDays); + $expectedResponse->setBatchModePriority($batchModePriority); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $job = new Job(); + $response = $gapicClient->createJob($formattedParent, $job); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/CreateJob', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJob(); + $this->assertProtobufEquals($job, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createJobExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $job = new Job(); + try { + $gapicClient->createJob($formattedParent, $job); + // 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()); + } + + /** @test */ + public function createJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new JobTemplate(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $jobTemplate = new JobTemplate(); + $jobTemplateId = 'jobTemplateId-1231822466'; + $response = $gapicClient->createJobTemplate($formattedParent, $jobTemplate, $jobTemplateId); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/CreateJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJobTemplate(); + $this->assertProtobufEquals($jobTemplate, $actualValue); + $actualValue = $actualRequestObject->getJobTemplateId(); + $this->assertProtobufEquals($jobTemplateId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createJobTemplateExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $jobTemplate = new JobTemplate(); + $jobTemplateId = 'jobTemplateId-1231822466'; + try { + $gapicClient->createJobTemplate($formattedParent, $jobTemplate, $jobTemplateId); + // 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()); + } + + /** @test */ + public function deleteJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $gapicClient->deleteJob($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/DeleteJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteJobExceptionTest() + { + $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 + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + try { + $gapicClient->deleteJob($formattedName); + // 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()); + } + + /** @test */ + public function deleteJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $gapicClient->deleteJobTemplate($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/DeleteJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteJobTemplateExceptionTest() + { + $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 + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + try { + $gapicClient->deleteJobTemplate($formattedName); + // 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()); + } + + /** @test */ + public function getJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $inputUri = 'inputUri1707300727'; + $outputUri = 'outputUri-1273518802'; + $templateId = 'templateId1769642752'; + $ttlAfterCompletionDays = 107576420; + $batchModePriority = 2137003131; + $expectedResponse = new Job(); + $expectedResponse->setName($name2); + $expectedResponse->setInputUri($inputUri); + $expectedResponse->setOutputUri($outputUri); + $expectedResponse->setTemplateId($templateId); + $expectedResponse->setTtlAfterCompletionDays($ttlAfterCompletionDays); + $expectedResponse->setBatchModePriority($batchModePriority); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + $response = $gapicClient->getJob($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/GetJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobExceptionTest() + { + $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 + $formattedName = $gapicClient->jobName('[PROJECT]', '[LOCATION]', '[JOB]'); + try { + $gapicClient->getJob($formattedName); + // 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()); + } + + /** @test */ + public function getJobTemplateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new JobTemplate(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + $response = $gapicClient->getJobTemplate($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/GetJobTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getJobTemplateExceptionTest() + { + $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 + $formattedName = $gapicClient->jobTemplateName('[PROJECT]', '[LOCATION]', '[JOB_TEMPLATE]'); + try { + $gapicClient->getJobTemplate($formattedName); + // 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()); + } + + /** @test */ + public function listJobTemplatesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobTemplatesElement = new JobTemplate(); + $jobTemplates = [ + $jobTemplatesElement, + ]; + $expectedResponse = new ListJobTemplatesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobTemplates($jobTemplates); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listJobTemplates($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobTemplates()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/ListJobTemplates', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobTemplatesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listJobTemplates($formattedParent); + // 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()); + } + + /** @test */ + public function listJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $jobsElement = new Job(); + $jobs = [ + $jobsElement, + ]; + $expectedResponse = new ListJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setJobs($jobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listJobs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.transcoder.v1.TranscoderService/ListJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listJobs($formattedParent); + // 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()); + } +} diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/Geometry.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/Geometry.php new file mode 100644 index 00000000000..e1e49658923 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/Geometry.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile( + ' + +%google/cloud/vision/v1/geometry.protogoogle.cloud.vision.v1" +Vertex +x ( +y ("( +NormalizedVertex +x ( +y (" + BoundingPoly0 +vertices ( 2.google.cloud.vision.v1.VertexE +normalized_vertices ( 2(.google.cloud.vision.v1.NormalizedVertex"+ +Position +x ( +y ( +z (Bn +com.google.cloud.vision.v1B GeometryProtoPZ5cloud.google.com/go/vision/v2/apiv1/visionpb;visionpbGCVNbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ImageAnnotator.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ImageAnnotator.php new file mode 100644 index 00000000000..bfad39b3938 Binary files /dev/null and b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ImageAnnotator.php differ diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearch.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearch.php new file mode 100644 index 00000000000..802d4d50d76 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearch.php @@ -0,0 +1,55 @@ +internalAddGeneratedFile( + ' + ++google/cloud/vision/v1/product_search.protogoogle.cloud.vision.v1%google/cloud/vision/v1/geometry.proto3google/cloud/vision/v1/product_search_service.protogoogle/protobuf/timestamp.proto" +ProductSearchParams; + bounding_poly ( 2$.google.cloud.vision.v1.BoundingPoly: + product_set ( B%A" + vision.googleapis.com/ProductSet +product_categories (  +filter ( " +ProductSearchResults. + +index_time ( 2.google.protobuf.TimestampD +results ( 23.google.cloud.vision.v1.ProductSearchResults.Result[ +product_grouped_results ( 2:.google.cloud.vision.v1.ProductSearchResults.GroupedResultX +Result0 +product ( 2.google.cloud.vision.v1.Product +score ( +image ( S +ObjectAnnotation +mid (  + language_code (  +name (  +score ( + GroupedResult; + bounding_poly ( 2$.google.cloud.vision.v1.BoundingPolyD +results ( 23.google.cloud.vision.v1.ProductSearchResults.ResultY +object_annotations ( 2=.google.cloud.vision.v1.ProductSearchResults.ObjectAnnotationBs +com.google.cloud.vision.v1BProductSearchProtoPZ5cloud.google.com/go/vision/v2/apiv1/visionpb;visionpbGCVNbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearchService.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearchService.php new file mode 100644 index 00000000000..a2052af7103 Binary files /dev/null and b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/ProductSearchService.php differ diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/TextAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/TextAnnotation.php new file mode 100644 index 00000000000..3499c9a9494 Binary files /dev/null and b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/TextAnnotation.php differ diff --git a/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/WebDetection.php b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/WebDetection.php new file mode 100644 index 00000000000..c63ae05fb41 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/GPBMetadata/Google/Cloud/Vision/V1/WebDetection.php @@ -0,0 +1,51 @@ +internalAddGeneratedFile( + ' + +*google/cloud/vision/v1/web_detection.protogoogle.cloud.vision.v1" + WebDetectionD + web_entities ( 2..google.cloud.vision.v1.WebDetection.WebEntityK +full_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageN +partial_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageP +pages_with_matching_images ( 2,.google.cloud.vision.v1.WebDetection.WebPageN +visually_similar_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageH +best_guess_labels ( 2-.google.cloud.vision.v1.WebDetection.WebLabelB + WebEntity + entity_id (  +score ( + description ( & +WebImage +url (  +score ( +WebPage +url (  +score ( + +page_title ( K +full_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImageN +partial_matching_images ( 2-.google.cloud.vision.v1.WebDetection.WebImage0 +WebLabel +label (  + language_code ( Br +com.google.cloud.vision.v1BWebDetectionProtoPZ5cloud.google.com/go/vision/v2/apiv1/visionpb;visionpbGCVNbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AddProductToProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AddProductToProductSetRequest.php new file mode 100644 index 00000000000..576f4d539fe --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AddProductToProductSetRequest.php @@ -0,0 +1,140 @@ +google.cloud.vision.v1.AddProductToProductSetRequest + */ +class AddProductToProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $product = ''; + + /** + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * Please see {@see ProductSearchClient::productSetName()} for help formatting this field. + * @param string $product Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * Please see {@see ProductSearchClient::productName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\AddProductToProductSetRequest + * + * @experimental + */ + public static function build(string $name, string $product): self + { + return (new self()) + ->setName($name) + ->setProduct($product); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Required. The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileRequest.php new file mode 100644 index 00000000000..99467c0d102 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileRequest.php @@ -0,0 +1,225 @@ +google.cloud.vision.v1.AnnotateFileRequest + */ +class AnnotateFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + protected $input_config = null; + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + protected $image_context = null; + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + */ + private $pages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Required. Information about the input file. + * @type array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image(s) in the file. + * @type array|\Google\Protobuf\Internal\RepeatedField $pages + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * Pages of the file to perform image annotation. + * Pages starts from 1, we assume the first page of the file is page 1. + * At most 5 pages are supported per request. Pages can be negative. + * Page 1 means the first page. + * Page 2 means the second page. + * Page -1 means the last page. + * Page -2 means the second to the last page. + * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. + * If this field is empty, by default the service performs image annotation + * for the first 5 pages of the file. + * + * Generated from protobuf field repeated int32 pages = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->pages = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileResponse.php new file mode 100644 index 00000000000..92682231fc1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateFileResponse.php @@ -0,0 +1,198 @@ +google.cloud.vision.v1.AnnotateFileResponse + */ +class AnnotateFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + protected $input_config = null; + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + */ + private $responses; + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + */ + protected $total_pages = 0; + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + */ + protected $error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Information about the file for which this response is generated. + * @type array<\Google\Cloud\Vision\V1\AnnotateImageResponse>|\Google\Protobuf\Internal\RepeatedField $responses + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * @type int $total_pages + * This field gives the total number of pages in the file. + * @type \Google\Rpc\Status $error + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Information about the file for which this response is generated. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * Individual responses to images found within the file. This field will be + * empty if the `error` field is set. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 2; + * @param array<\Google\Cloud\Vision\V1\AnnotateImageResponse>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageResponse::class); + $this->responses = $arr; + + return $this; + } + + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + * @return int + */ + public function getTotalPages() + { + return $this->total_pages; + } + + /** + * This field gives the total number of pages in the file. + * + * Generated from protobuf field int32 total_pages = 3; + * @param int $var + * @return $this + */ + public function setTotalPages($var) + { + GPBUtil::checkInt32($var); + $this->total_pages = $var; + + return $this; + } + + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, represents the error message for the failed request. The + * `responses` field will not be set in this case. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageRequest.php new file mode 100644 index 00000000000..87da32a59c9 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageRequest.php @@ -0,0 +1,156 @@ +google.cloud.vision.v1.AnnotateImageRequest + */ +class AnnotateImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + */ + protected $image = null; + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + protected $image_context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Image $image + * The image to be processed. + * @type array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $features + * Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + * @return \Google\Cloud\Vision\V1\Image|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * The image to be processed. + * + * Generated from protobuf field .google.cloud.vision.v1.Image image = 1; + * @param \Google\Cloud\Vision\V1\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Image::class); + $this->image = $var; + + return $this; + } + + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageResponse.php new file mode 100644 index 00000000000..5da36729806 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AnnotateImageResponse.php @@ -0,0 +1,617 @@ +google.cloud.vision.v1.AnnotateImageResponse + */ +class AnnotateImageResponse extends \Google\Protobuf\Internal\Message +{ + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + */ + private $face_annotations; + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + */ + private $landmark_annotations; + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + */ + private $logo_annotations; + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + */ + private $label_annotations; + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + */ + private $localized_object_annotations; + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + */ + private $text_annotations; + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + */ + protected $full_text_annotation = null; + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + */ + protected $safe_search_annotation = null; + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + */ + protected $image_properties_annotation = null; + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + */ + protected $crop_hints_annotation = null; + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + */ + protected $web_detection = null; + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + */ + protected $product_search_results = null; + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + */ + protected $error = null; + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + */ + protected $context = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $face_annotations + * If present, face detection has completed successfully. + * @type array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $landmark_annotations + * If present, landmark detection has completed successfully. + * @type array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $logo_annotations + * If present, logo detection has completed successfully. + * @type array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $label_annotations + * If present, label detection has completed successfully. + * @type array<\Google\Cloud\Vision\V1\LocalizedObjectAnnotation>|\Google\Protobuf\Internal\RepeatedField $localized_object_annotations + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * @type array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $text_annotations + * If present, text (OCR) detection has completed successfully. + * @type \Google\Cloud\Vision\V1\TextAnnotation $full_text_annotation + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * @type \Google\Cloud\Vision\V1\SafeSearchAnnotation $safe_search_annotation + * If present, safe-search annotation has completed successfully. + * @type \Google\Cloud\Vision\V1\ImageProperties $image_properties_annotation + * If present, image properties were extracted successfully. + * @type \Google\Cloud\Vision\V1\CropHintsAnnotation $crop_hints_annotation + * If present, crop hints have completed successfully. + * @type \Google\Cloud\Vision\V1\WebDetection $web_detection + * If present, web detection has completed successfully. + * @type \Google\Cloud\Vision\V1\ProductSearchResults $product_search_results + * If present, product search has completed successfully. + * @type \Google\Rpc\Status $error + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * @type \Google\Cloud\Vision\V1\ImageAnnotationContext $context + * If present, contextual information is needed to understand where this image + * comes from. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFaceAnnotations() + { + return $this->face_annotations; + } + + /** + * If present, face detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation face_annotations = 1; + * @param array<\Google\Cloud\Vision\V1\FaceAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFaceAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation::class); + $this->face_annotations = $arr; + + return $this; + } + + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLandmarkAnnotations() + { + return $this->landmark_annotations; + } + + /** + * If present, landmark detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation landmark_annotations = 2; + * @param array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLandmarkAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->landmark_annotations = $arr; + + return $this; + } + + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLogoAnnotations() + { + return $this->logo_annotations; + } + + /** + * If present, logo detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation logo_annotations = 3; + * @param array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLogoAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->logo_annotations = $arr; + + return $this; + } + + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelAnnotations() + { + return $this->label_annotations; + } + + /** + * If present, label detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation label_annotations = 4; + * @param array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->label_annotations = $arr; + + return $this; + } + + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocalizedObjectAnnotations() + { + return $this->localized_object_annotations; + } + + /** + * If present, localized object detection has completed successfully. + * This will be sorted descending by confidence score. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocalizedObjectAnnotation localized_object_annotations = 22; + * @param array<\Google\Cloud\Vision\V1\LocalizedObjectAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocalizedObjectAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocalizedObjectAnnotation::class); + $this->localized_object_annotations = $arr; + + return $this; + } + + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextAnnotations() + { + return $this->text_annotations; + } + + /** + * If present, text (OCR) detection has completed successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.EntityAnnotation text_annotations = 5; + * @param array<\Google\Cloud\Vision\V1\EntityAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\EntityAnnotation::class); + $this->text_annotations = $arr; + + return $this; + } + + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + * @return \Google\Cloud\Vision\V1\TextAnnotation|null + */ + public function getFullTextAnnotation() + { + return $this->full_text_annotation; + } + + public function hasFullTextAnnotation() + { + return isset($this->full_text_annotation); + } + + public function clearFullTextAnnotation() + { + unset($this->full_text_annotation); + } + + /** + * If present, text (OCR) detection or document (OCR) text detection has + * completed successfully. + * This annotation provides the structural hierarchy for the OCR detected + * text. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation full_text_annotation = 12; + * @param \Google\Cloud\Vision\V1\TextAnnotation $var + * @return $this + */ + public function setFullTextAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation::class); + $this->full_text_annotation = $var; + + return $this; + } + + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + * @return \Google\Cloud\Vision\V1\SafeSearchAnnotation|null + */ + public function getSafeSearchAnnotation() + { + return $this->safe_search_annotation; + } + + public function hasSafeSearchAnnotation() + { + return isset($this->safe_search_annotation); + } + + public function clearSafeSearchAnnotation() + { + unset($this->safe_search_annotation); + } + + /** + * If present, safe-search annotation has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.SafeSearchAnnotation safe_search_annotation = 6; + * @param \Google\Cloud\Vision\V1\SafeSearchAnnotation $var + * @return $this + */ + public function setSafeSearchAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\SafeSearchAnnotation::class); + $this->safe_search_annotation = $var; + + return $this; + } + + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + * @return \Google\Cloud\Vision\V1\ImageProperties|null + */ + public function getImagePropertiesAnnotation() + { + return $this->image_properties_annotation; + } + + public function hasImagePropertiesAnnotation() + { + return isset($this->image_properties_annotation); + } + + public function clearImagePropertiesAnnotation() + { + unset($this->image_properties_annotation); + } + + /** + * If present, image properties were extracted successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageProperties image_properties_annotation = 8; + * @param \Google\Cloud\Vision\V1\ImageProperties $var + * @return $this + */ + public function setImagePropertiesAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageProperties::class); + $this->image_properties_annotation = $var; + + return $this; + } + + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + * @return \Google\Cloud\Vision\V1\CropHintsAnnotation|null + */ + public function getCropHintsAnnotation() + { + return $this->crop_hints_annotation; + } + + public function hasCropHintsAnnotation() + { + return isset($this->crop_hints_annotation); + } + + public function clearCropHintsAnnotation() + { + unset($this->crop_hints_annotation); + } + + /** + * If present, crop hints have completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsAnnotation crop_hints_annotation = 11; + * @param \Google\Cloud\Vision\V1\CropHintsAnnotation $var + * @return $this + */ + public function setCropHintsAnnotation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsAnnotation::class); + $this->crop_hints_annotation = $var; + + return $this; + } + + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + * @return \Google\Cloud\Vision\V1\WebDetection|null + */ + public function getWebDetection() + { + return $this->web_detection; + } + + public function hasWebDetection() + { + return isset($this->web_detection); + } + + public function clearWebDetection() + { + unset($this->web_detection); + } + + /** + * If present, web detection has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; + * @param \Google\Cloud\Vision\V1\WebDetection $var + * @return $this + */ + public function setWebDetection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetection::class); + $this->web_detection = $var; + + return $this; + } + + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @return \Google\Cloud\Vision\V1\ProductSearchResults|null + */ + public function getProductSearchResults() + { + return $this->product_search_results; + } + + public function hasProductSearchResults() + { + return isset($this->product_search_results); + } + + public function clearProductSearchResults() + { + unset($this->product_search_results); + } + + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @param \Google\Cloud\Vision\V1\ProductSearchResults $var + * @return $this + */ + public function setProductSearchResults($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchResults::class); + $this->product_search_results = $var; + + return $this; + } + + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * If set, represents the error message for the operation. + * Note that filled-in image annotations are guaranteed to be + * correct, even when `error` is set. + * + * Generated from protobuf field .google.rpc.Status error = 9; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + * @return \Google\Cloud\Vision\V1\ImageAnnotationContext|null + */ + public function getContext() + { + return $this->context; + } + + public function hasContext() + { + return isset($this->context); + } + + public function clearContext() + { + unset($this->context); + } + + /** + * If present, contextual information is needed to understand where this image + * comes from. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageAnnotationContext context = 21; + * @param \Google\Cloud\Vision\V1\ImageAnnotationContext $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageAnnotationContext::class); + $this->context = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileRequest.php new file mode 100644 index 00000000000..c1ebfd6cc6d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileRequest.php @@ -0,0 +1,199 @@ +google.cloud.vision.v1.AsyncAnnotateFileRequest + */ +class AsyncAnnotateFileRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + */ + protected $input_config = null; + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + */ + private $features; + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + */ + protected $image_context = null; + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + */ + protected $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\InputConfig $input_config + * Required. Information about the input file. + * @type array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $features + * Required. Requested features. + * @type \Google\Cloud\Vision\V1\ImageContext $image_context + * Additional context that may accompany the image(s) in the file. + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * Required. The desired output location and metadata (e.g. format). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @return \Google\Cloud\Vision\V1\InputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. Information about the input file. + * + * Generated from protobuf field .google.cloud.vision.v1.InputConfig input_config = 1; + * @param \Google\Cloud\Vision\V1\InputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\InputConfig::class); + $this->input_config = $var; + + return $this; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFeatures() + { + return $this->features; + } + + /** + * Required. Requested features. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Feature features = 2; + * @param array<\Google\Cloud\Vision\V1\Feature>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFeatures($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Feature::class); + $this->features = $arr; + + return $this; + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @return \Google\Cloud\Vision\V1\ImageContext|null + */ + public function getImageContext() + { + return $this->image_context; + } + + public function hasImageContext() + { + return isset($this->image_context); + } + + public function clearImageContext() + { + unset($this->image_context); + } + + /** + * Additional context that may accompany the image(s) in the file. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageContext image_context = 3; + * @param \Google\Cloud\Vision\V1\ImageContext $var + * @return $this + */ + public function setImageContext($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageContext::class); + $this->image_context = $var; + + return $this; + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 4; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileResponse.php new file mode 100644 index 00000000000..1dbad5e843d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncAnnotateFileResponse.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.AsyncAnnotateFileResponse + */ +class AsyncAnnotateFileResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + */ + protected $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * The output location and metadata from AsyncAnnotateFileRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * The output location and metadata from AsyncAnnotateFileRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesRequest.php new file mode 100644 index 00000000000..c67b7e2781f --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesRequest.php @@ -0,0 +1,193 @@ +google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + */ +class AsyncBatchAnnotateFilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + protected $parent = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param \Google\Cloud\Vision\V1\AsyncAnnotateFileRequest[] $requests Required. Individual async file annotation requests for this batch. + * + * @return \Google\Cloud\Vision\V1\AsyncBatchAnnotateFilesRequest + * + * @experimental + */ + public static function build(array $requests): self + { + return (new self()) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AsyncAnnotateFileRequest>|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual async file annotation requests for this batch. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual async file annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Vision\V1\AsyncAnnotateFileRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesResponse.php new file mode 100644 index 00000000000..475b70528ee --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateFilesResponse.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + */ +class AsyncBatchAnnotateFilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AsyncAnnotateFileResponse>|\Google\Protobuf\Internal\RepeatedField $responses + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * The list of file annotation responses, one for each request in + * AsyncBatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AsyncAnnotateFileResponse responses = 1; + * @param array<\Google\Cloud\Vision\V1\AsyncAnnotateFileResponse>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AsyncAnnotateFileResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesRequest.php new file mode 100644 index 00000000000..e94ee1855b9 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesRequest.php @@ -0,0 +1,238 @@ +google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + */ +class AsyncBatchAnnotateImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $output_config = null; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + protected $parent = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param \Google\Cloud\Vision\V1\AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * @param \Google\Cloud\Vision\V1\OutputConfig $outputConfig Required. The desired output location and metadata (e.g. format). + * + * @return \Google\Cloud\Vision\V1\AsyncBatchAnnotateImagesRequest + * + * @experimental + */ + public static function build(array $requests, \Google\Cloud\Vision\V1\OutputConfig $outputConfig): self + { + return (new self()) + ->setRequests($requests) + ->setOutputConfig($outputConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AnnotateImageRequest>|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual image annotation requests for this batch. + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * Required. The desired output location and metadata (e.g. format). + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Vision\V1\AnnotateImageRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * Required. The desired output location and metadata (e.g. format). + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesResponse.php new file mode 100644 index 00000000000..6a424d1a37c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/AsyncBatchAnnotateImagesResponse.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + */ +class AsyncBatchAnnotateImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + */ + protected $output_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\OutputConfig $output_config + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @return \Google\Cloud\Vision\V1\OutputConfig|null + */ + public function getOutputConfig() + { + return $this->output_config; + } + + public function hasOutputConfig() + { + return isset($this->output_config); + } + + public function clearOutputConfig() + { + unset($this->output_config); + } + + /** + * The output location and metadata from AsyncBatchAnnotateImagesRequest. + * + * Generated from protobuf field .google.cloud.vision.v1.OutputConfig output_config = 1; + * @param \Google\Cloud\Vision\V1\OutputConfig $var + * @return $this + */ + public function setOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\OutputConfig::class); + $this->output_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesRequest.php new file mode 100644 index 00000000000..320d89e0dca --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesRequest.php @@ -0,0 +1,197 @@ +google.cloud.vision.v1.BatchAnnotateFilesRequest + */ +class BatchAnnotateFilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + */ + protected $parent = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param \Google\Cloud\Vision\V1\AnnotateFileRequest[] $requests Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * @return \Google\Cloud\Vision\V1\BatchAnnotateFilesRequest + * + * @experimental + */ + public static function build(array $requests): self + { + return (new self()) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AnnotateFileRequest>|\Google\Protobuf\Internal\RepeatedField $requests + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Vision\V1\AnnotateFileRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateFileRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 3; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesResponse.php new file mode 100644 index 00000000000..2a6384a5d6a --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateFilesResponse.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.BatchAnnotateFilesResponse + */ +class BatchAnnotateFilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AnnotateFileResponse>|\Google\Protobuf\Internal\RepeatedField $responses + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * The list of file annotation responses, each response corresponding to each + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateFileResponse responses = 1; + * @param array<\Google\Cloud\Vision\V1\AnnotateFileResponse>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateFileResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesRequest.php new file mode 100644 index 00000000000..33b0dd8968c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesRequest.php @@ -0,0 +1,192 @@ +google.cloud.vision.v1.BatchAnnotateImagesRequest + */ +class BatchAnnotateImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + */ + protected $parent = ''; + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $labels; + + /** + * @param \Google\Cloud\Vision\V1\AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * + * @return \Google\Cloud\Vision\V1\BatchAnnotateImagesRequest + * + * @experimental + */ + public static function build(array $requests): self + { + return (new self()) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AnnotateImageRequest>|\Google\Protobuf\Internal\RepeatedField $requests + * Required. Individual image annotation requests for this batch. + * @type string $parent + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Individual image annotation requests for this batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Vision\V1\AnnotateImageRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageRequest::class); + $this->requests = $arr; + + return $this; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Optional. Target project and location to make a call. + * Format: `projects/{project-id}/locations/{location-id}`. + * If no parent is specified, a region will be chosen automatically. + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * Example: `projects/project-A/locations/eu`. + * + * Generated from protobuf field string parent = 4; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Optional. The labels with user-defined metadata for the request. + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * + * Generated from protobuf field map labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesResponse.php new file mode 100644 index 00000000000..94a35240ca6 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchAnnotateImagesResponse.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.BatchAnnotateImagesResponse + */ +class BatchAnnotateImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + */ + private $responses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\AnnotateImageResponse>|\Google\Protobuf\Internal\RepeatedField $responses + * Individual responses to image annotation requests within the batch. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponses() + { + return $this->responses; + } + + /** + * Individual responses to image annotation requests within the batch. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.AnnotateImageResponse responses = 1; + * @param array<\Google\Cloud\Vision\V1\AnnotateImageResponse>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\AnnotateImageResponse::class); + $this->responses = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata.php new file mode 100644 index 00000000000..e9dd818df67 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.BatchOperationMetadata + */ +class BatchOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + */ + protected $state = 0; + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + */ + protected $submit_time = null; + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of the batch operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the batch request was submitted to the server. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\BatchOperationMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + public function hasSubmitTime() + { + return isset($this->submit_time); + } + + public function clearSubmitTime() + { + unset($this->submit_time); + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is + * set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata/State.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata/State.php new file mode 100644 index 00000000000..cba5eccd484 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BatchOperationMetadata/State.php @@ -0,0 +1,81 @@ +google.cloud.vision.v1.BatchOperationMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is actively being processed. + * + * Generated from protobuf enum PROCESSING = 1; + */ + const PROCESSING = 1; + /** + * The request is done and at least one item has been successfully + * processed. + * + * Generated from protobuf enum SUCCESSFUL = 2; + */ + const SUCCESSFUL = 2; + /** + * The request is done and no item has been successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The request is done after the longrunning.Operations.CancelOperation has + * been called by the user. Any records that were processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PROCESSING => 'PROCESSING', + self::SUCCESSFUL => 'SUCCESSFUL', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Vision\V1\BatchOperationMetadata_State::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block.php new file mode 100644 index 00000000000..d53227721f6 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block.php @@ -0,0 +1,279 @@ +google.cloud.vision.v1.Block + */ +class Block extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + protected $property = null; + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + protected $bounding_box = null; + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + */ + private $paragraphs; + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + */ + protected $block_type = 0; + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the block. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type array<\Google\Cloud\Vision\V1\Paragraph>|\Google\Protobuf\Internal\RepeatedField $paragraphs + * List of paragraphs in this block (if this blocks is of type text). + * @type int $block_type + * Detected block type (text, image etc) for this block. + * @type float $confidence + * Confidence of the OCR results on the block. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the block. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the block. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParagraphs() + { + return $this->paragraphs; + } + + /** + * List of paragraphs in this block (if this blocks is of type text). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Paragraph paragraphs = 3; + * @param array<\Google\Cloud\Vision\V1\Paragraph>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParagraphs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Paragraph::class); + $this->paragraphs = $arr; + + return $this; + } + + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + * @return int + */ + public function getBlockType() + { + return $this->block_type; + } + + /** + * Detected block type (text, image etc) for this block. + * + * Generated from protobuf field .google.cloud.vision.v1.Block.BlockType block_type = 4; + * @param int $var + * @return $this + */ + public function setBlockType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Block\BlockType::class); + $this->block_type = $var; + + return $this; + } + + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results on the block. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block/BlockType.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block/BlockType.php new file mode 100644 index 00000000000..eefde91942e --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Block/BlockType.php @@ -0,0 +1,85 @@ +google.cloud.vision.v1.Block.BlockType + */ +class BlockType +{ + /** + * Unknown block type. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Regular text block. + * + * Generated from protobuf enum TEXT = 1; + */ + const TEXT = 1; + /** + * Table block. + * + * Generated from protobuf enum TABLE = 2; + */ + const TABLE = 2; + /** + * Image block. + * + * Generated from protobuf enum PICTURE = 3; + */ + const PICTURE = 3; + /** + * Horizontal/vertical line box. + * + * Generated from protobuf enum RULER = 4; + */ + const RULER = 4; + /** + * Barcode block. + * + * Generated from protobuf enum BARCODE = 5; + */ + const BARCODE = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::TEXT => 'TEXT', + self::TABLE => 'TABLE', + self::PICTURE => 'PICTURE', + self::RULER => 'RULER', + self::BARCODE => 'BARCODE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BlockType::class, \Google\Cloud\Vision\V1\Block_BlockType::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BoundingPoly.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BoundingPoly.php new file mode 100644 index 00000000000..7bc296abfa8 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/BoundingPoly.php @@ -0,0 +1,101 @@ +google.cloud.vision.v1.BoundingPoly + */ +class BoundingPoly extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + */ + private $vertices; + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + */ + private $normalized_vertices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\Vertex>|\Google\Protobuf\Internal\RepeatedField $vertices + * The bounding polygon vertices. + * @type array<\Google\Cloud\Vision\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $normalized_vertices + * The bounding polygon normalized vertices. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVertices() + { + return $this->vertices; + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Vertex vertices = 1; + * @param array<\Google\Cloud\Vision\V1\Vertex>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Vertex::class); + $this->vertices = $arr; + + return $this; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNormalizedVertices() + { + return $this->normalized_vertices; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.NormalizedVertex normalized_vertices = 2; + * @param array<\Google\Cloud\Vision\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNormalizedVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\NormalizedVertex::class); + $this->normalized_vertices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ColorInfo.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ColorInfo.php new file mode 100644 index 00000000000..545a5de76ac --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ColorInfo.php @@ -0,0 +1,150 @@ +google.cloud.vision.v1.ColorInfo + */ +class ColorInfo extends \Google\Protobuf\Internal\Message +{ + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + */ + protected $color = null; + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + */ + protected $score = 0.0; + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + */ + protected $pixel_fraction = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\Color $color + * RGB components of the color. + * @type float $score + * Image-specific score for this color. Value in range [0, 1]. + * @type float $pixel_fraction + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + * @return \Google\Type\Color|null + */ + public function getColor() + { + return $this->color; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * RGB components of the color. + * + * Generated from protobuf field .google.type.Color color = 1; + * @param \Google\Type\Color $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->color = $var; + + return $this; + } + + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Image-specific score for this color. Value in range [0, 1]. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + * @return float + */ + public function getPixelFraction() + { + return $this->pixel_fraction; + } + + /** + * The fraction of pixels the color occupies in the image. + * Value in range [0, 1]. + * + * Generated from protobuf field float pixel_fraction = 3; + * @param float $var + * @return $this + */ + public function setPixelFraction($var) + { + GPBUtil::checkFloat($var); + $this->pixel_fraction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductRequest.php new file mode 100644 index 00000000000..fbb905a23ca --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductRequest.php @@ -0,0 +1,189 @@ +google.cloud.vision.v1.CreateProductRequest + */ +class CreateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product = null; + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + */ + protected $product_id = ''; + + /** + * @param string $parent Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. Please see + * {@see ProductSearchClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Vision\V1\Product $product Required. The product to create. + * @param string $productId A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * @return \Google\Cloud\Vision\V1\CreateProductRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Vision\V1\Product $product, string $productId): self + { + return (new self()) + ->setParent($parent) + ->setProduct($product) + ->setProductId($productId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\Product $product + * Required. The product to create. + * @type string $product_id + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * Required. The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + * @return string + */ + public function getProductId() + { + return $this->product_id; + } + + /** + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_id = 3; + * @param string $var + * @return $this + */ + public function setProductId($var) + { + GPBUtil::checkString($var, True); + $this->product_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductSetRequest.php new file mode 100644 index 00000000000..06f5ef2cf0c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateProductSetRequest.php @@ -0,0 +1,184 @@ +google.cloud.vision.v1.CreateProductSetRequest + */ +class CreateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product_set = null; + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + */ + protected $product_set_id = ''; + + /** + * @param string $parent Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. Please see + * {@see ProductSearchClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Vision\V1\ProductSet $productSet Required. The ProductSet to create. + * @param string $productSetId A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * @return \Google\Cloud\Vision\V1\CreateProductSetRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Vision\V1\ProductSet $productSet, string $productSetId): self + { + return (new self()) + ->setParent($parent) + ->setProductSet($productSet) + ->setProductSetId($productSetId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * Required. The ProductSet to create. + * @type string $product_set_id + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ProductSet|null + */ + public function getProductSet() + { + return $this->product_set; + } + + public function hasProductSet() + { + return isset($this->product_set); + } + + public function clearProductSet() + { + unset($this->product_set); + } + + /** + * Required. The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @return string + */ + public function getProductSetId() + { + return $this->product_set_id; + } + + /** + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @param string $var + * @return $this + */ + public function setProductSetId($var) + { + GPBUtil::checkString($var, True); + $this->product_set_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateReferenceImageRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateReferenceImageRequest.php new file mode 100644 index 00000000000..ccc3b85c92a --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CreateReferenceImageRequest.php @@ -0,0 +1,199 @@ +google.cloud.vision.v1.CreateReferenceImageRequest + */ +class CreateReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the product in which to create the reference + * image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $reference_image = null; + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + */ + protected $reference_image_id = ''; + + /** + * @param string $parent Required. Resource name of the product in which to create the reference + * image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. Please see + * {@see ProductSearchClient::productName()} for help formatting this field. + * @param \Google\Cloud\Vision\V1\ReferenceImage $referenceImage Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param string $referenceImageId A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * @return \Google\Cloud\Vision\V1\CreateReferenceImageRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Vision\V1\ReferenceImage $referenceImage, string $referenceImageId): self + { + return (new self()) + ->setParent($parent) + ->setReferenceImage($referenceImage) + ->setReferenceImageId($referenceImageId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the product in which to create the reference + * image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type \Google\Cloud\Vision\V1\ReferenceImage $reference_image + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @type string $reference_image_id + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the product in which to create the reference + * image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the product in which to create the reference + * image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ReferenceImage|null + */ + public function getReferenceImage() + { + return $this->reference_image; + } + + public function hasReferenceImage() + { + return isset($this->reference_image); + } + + public function clearReferenceImage() + { + unset($this->reference_image); + } + + /** + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ReferenceImage $var + * @return $this + */ + public function setReferenceImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_image = $var; + + return $this; + } + + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @return string + */ + public function getReferenceImageId() + { + return $this->reference_image_id; + } + + /** + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @param string $var + * @return $this + */ + public function setReferenceImageId($var) + { + GPBUtil::checkString($var, True); + $this->reference_image_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHint.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHint.php new file mode 100644 index 00000000000..34593cd6e19 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHint.php @@ -0,0 +1,153 @@ +google.cloud.vision.v1.CropHint + */ +class CropHint extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + protected $bounding_poly = null; + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + */ + protected $importance_fraction = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * @type float $confidence + * Confidence of this being a salient region. Range [0, 1]. + * @type float $importance_fraction + * Fraction of importance of this salient region with respect to the original + * image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon for the crop region. The coordinates of the bounding + * box are in the original image's scale. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of this being a salient region. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + * @return float + */ + public function getImportanceFraction() + { + return $this->importance_fraction; + } + + /** + * Fraction of importance of this salient region with respect to the original + * image. + * + * Generated from protobuf field float importance_fraction = 3; + * @param float $var + * @return $this + */ + public function setImportanceFraction($var) + { + GPBUtil::checkFloat($var); + $this->importance_fraction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsAnnotation.php new file mode 100644 index 00000000000..7edebe86ec0 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsAnnotation.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.CropHintsAnnotation + */ +class CropHintsAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + */ + private $crop_hints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\CropHint>|\Google\Protobuf\Internal\RepeatedField $crop_hints + * Crop hint results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCropHints() + { + return $this->crop_hints; + } + + /** + * Crop hint results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.CropHint crop_hints = 1; + * @param array<\Google\Cloud\Vision\V1\CropHint>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCropHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\CropHint::class); + $this->crop_hints = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsParams.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsParams.php new file mode 100644 index 00000000000..a1cc403bdb2 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/CropHintsParams.php @@ -0,0 +1,87 @@ +google.cloud.vision.v1.CropHintsParams + */ +class CropHintsParams extends \Google\Protobuf\Internal\Message +{ + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + */ + private $aspect_ratios; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $aspect_ratios + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAspectRatios() + { + return $this->aspect_ratios; + } + + /** + * Aspect ratios in floats, representing the ratio of the width to the height + * of the image. For example, if the desired aspect ratio is 4/3, the + * corresponding float value should be 1.33333. If not specified, the + * best possible crop is returned. The number of provided aspect ratios is + * limited to a maximum of 16; any aspect ratios provided after the 16th are + * ignored. + * + * Generated from protobuf field repeated float aspect_ratios = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAspectRatios($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::FLOAT); + $this->aspect_ratios = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductRequest.php new file mode 100644 index 00000000000..744dae5b262 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.DeleteProductRequest + */ +class DeleteProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * Please see {@see ProductSearchClient::productName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\DeleteProductRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductSetRequest.php new file mode 100644 index 00000000000..aa0ce3fb5ab --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteProductSetRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.DeleteProductSetRequest + */ +class DeleteProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * Please see {@see ProductSearchClient::productSetName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\DeleteProductSetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteReferenceImageRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteReferenceImageRequest.php new file mode 100644 index 00000000000..f40ed15cd65 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DeleteReferenceImageRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.DeleteReferenceImageRequest + */ +class DeleteReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the reference image to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * Please see {@see ProductSearchClient::referenceImageName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\DeleteReferenceImageRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DominantColorsAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DominantColorsAnnotation.php new file mode 100644 index 00000000000..ed9d31ab00c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/DominantColorsAnnotation.php @@ -0,0 +1,67 @@ +google.cloud.vision.v1.DominantColorsAnnotation + */ +class DominantColorsAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + */ + private $colors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\ColorInfo>|\Google\Protobuf\Internal\RepeatedField $colors + * RGB color values with their score and pixel fraction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColors() + { + return $this->colors; + } + + /** + * RGB color values with their score and pixel fraction. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ColorInfo colors = 1; + * @param array<\Google\Cloud\Vision\V1\ColorInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ColorInfo::class); + $this->colors = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/EntityAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/EntityAnnotation.php new file mode 100644 index 00000000000..4ea1b12e776 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/EntityAnnotation.php @@ -0,0 +1,422 @@ +google.cloud.vision.v1.EntityAnnotation + */ +class EntityAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + */ + protected $mid = ''; + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + */ + protected $locale = ''; + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + protected $score = 0.0; + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @deprecated + */ + protected $confidence = 0.0; + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + */ + protected $topicality = 0.0; + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + */ + protected $bounding_poly = null; + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + */ + private $locations; + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + */ + private $properties; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * @type string $locale + * The language code for the locale in which the entity textual + * `description` is expressed. + * @type string $description + * Entity textual description, expressed in its `locale` language. + * @type float $score + * Overall score of the result. Range [0, 1]. + * @type float $confidence + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * @type float $topicality + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * @type array<\Google\Cloud\Vision\V1\LocationInfo>|\Google\Protobuf\Internal\RepeatedField $locations + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * @type array<\Google\Cloud\Vision\V1\Property>|\Google\Protobuf\Internal\RepeatedField $properties + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Opaque entity ID. Some IDs may be available in + * [Google Knowledge Graph Search + * API](https://developers.google.com/knowledge-graph/). + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * The language code for the locale in which the entity textual + * `description` is expressed. + * + * Generated from protobuf field string locale = 2; + * @param string $var + * @return $this + */ + public function setLocale($var) + { + GPBUtil::checkString($var, True); + $this->locale = $var; + + return $this; + } + + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Entity textual description, expressed in its `locale` language. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Overall score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @return float + * @deprecated + */ + public function getConfidence() + { + @trigger_error('confidence is deprecated.', E_USER_DEPRECATED); + return $this->confidence; + } + + /** + * **Deprecated. Use `score` instead.** + * The accuracy of the entity detection in an image. + * For example, for an image in which the "Eiffel Tower" entity is detected, + * this field represents the confidence that there is a tower in the query + * image. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setConfidence($var) + { + @trigger_error('confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + * @return float + */ + public function getTopicality() + { + return $this->topicality; + } + + /** + * The relevancy of the ICA (Image Content Annotation) label to the + * image. For example, the relevancy of "tower" is likely higher to an image + * containing the detected "Eiffel Tower" than to an image containing a + * detected distant towering building, even though the confidence that + * there is a tower in each image may be the same. Range [0, 1]. + * + * Generated from protobuf field float topicality = 6; + * @param float $var + * @return $this + */ + public function setTopicality($var) + { + GPBUtil::checkFloat($var); + $this->topicality = $var; + + return $this; + } + + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * Image region to which this entity belongs. Not produced + * for `LABEL_DETECTION` features. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 7; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLocations() + { + return $this->locations; + } + + /** + * The location information for the detected entity. Multiple + * `LocationInfo` elements can be present because one location may + * indicate the location of the scene in the image, and another location + * may indicate the location of the place where the image was taken. + * Location information is usually present for landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.LocationInfo locations = 8; + * @param array<\Google\Cloud\Vision\V1\LocationInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\LocationInfo::class); + $this->locations = $arr; + + return $this; + } + + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Some entities may have optional user-supplied `Property` (name/value) + * fields, such a score or string that qualifies the entity. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Property properties = 9; + * @param array<\Google\Cloud\Vision\V1\Property>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Property::class); + $this->properties = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation.php new file mode 100644 index 00000000000..b9af007fead --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation.php @@ -0,0 +1,627 @@ +google.cloud.vision.v1.FaceAnnotation + */ +class FaceAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + protected $bounding_poly = null; + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + */ + protected $fd_bounding_poly = null; + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + */ + private $landmarks; + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + */ + protected $roll_angle = 0.0; + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + */ + protected $pan_angle = 0.0; + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + */ + protected $tilt_angle = 0.0; + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + */ + protected $detection_confidence = 0.0; + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + */ + protected $landmarking_confidence = 0.0; + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + */ + protected $joy_likelihood = 0; + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + */ + protected $sorrow_likelihood = 0; + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + */ + protected $anger_likelihood = 0; + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + */ + protected $surprise_likelihood = 0; + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + */ + protected $under_exposed_likelihood = 0; + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + */ + protected $blurred_likelihood = 0; + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + */ + protected $headwear_likelihood = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * @type \Google\Cloud\Vision\V1\BoundingPoly $fd_bounding_poly + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * @type array<\Google\Cloud\Vision\V1\FaceAnnotation\Landmark>|\Google\Protobuf\Internal\RepeatedField $landmarks + * Detected face landmarks. + * @type float $roll_angle + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * @type float $pan_angle + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * @type float $tilt_angle + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * @type float $detection_confidence + * Detection confidence. Range [0, 1]. + * @type float $landmarking_confidence + * Face landmarking confidence. Range [0, 1]. + * @type int $joy_likelihood + * Joy likelihood. + * @type int $sorrow_likelihood + * Sorrow likelihood. + * @type int $anger_likelihood + * Anger likelihood. + * @type int $surprise_likelihood + * Surprise likelihood. + * @type int $under_exposed_likelihood + * Under-exposed likelihood. + * @type int $blurred_likelihood + * Blurred likelihood. + * @type int $headwear_likelihood + * Headwear likelihood. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the face. The coordinates of the bounding box + * are in the original image's scale. + * The bounding box is computed to "frame" the face in accordance with human + * expectations. It is based on the landmarker results. + * Note that one or more x and/or y coordinates may not be generated in the + * `BoundingPoly` (the polygon will be unbounded) if only a partial face + * appears in the image to be annotated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getFdBoundingPoly() + { + return $this->fd_bounding_poly; + } + + public function hasFdBoundingPoly() + { + return isset($this->fd_bounding_poly); + } + + public function clearFdBoundingPoly() + { + unset($this->fd_bounding_poly); + } + + /** + * The `fd_bounding_poly` bounding polygon is tighter than the + * `boundingPoly`, and encloses only the skin part of the face. Typically, it + * is used to eliminate the face from any image analysis that detects the + * "amount of skin" visible in an image. It is not based on the + * landmarker results, only on the initial face detection, hence + * the fd (face detection) prefix. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly fd_bounding_poly = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setFdBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->fd_bounding_poly = $var; + + return $this; + } + + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLandmarks() + { + return $this->landmarks; + } + + /** + * Detected face landmarks. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.FaceAnnotation.Landmark landmarks = 3; + * @param array<\Google\Cloud\Vision\V1\FaceAnnotation\Landmark>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLandmarks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark::class); + $this->landmarks = $arr; + + return $this; + } + + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + * @return float + */ + public function getRollAngle() + { + return $this->roll_angle; + } + + /** + * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation + * of the face relative to the image vertical about the axis perpendicular to + * the face. Range [-180,180]. + * + * Generated from protobuf field float roll_angle = 4; + * @param float $var + * @return $this + */ + public function setRollAngle($var) + { + GPBUtil::checkFloat($var); + $this->roll_angle = $var; + + return $this; + } + + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + * @return float + */ + public function getPanAngle() + { + return $this->pan_angle; + } + + /** + * Yaw angle, which indicates the leftward/rightward angle that the face is + * pointing relative to the vertical plane perpendicular to the image. Range + * [-180,180]. + * + * Generated from protobuf field float pan_angle = 5; + * @param float $var + * @return $this + */ + public function setPanAngle($var) + { + GPBUtil::checkFloat($var); + $this->pan_angle = $var; + + return $this; + } + + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + * @return float + */ + public function getTiltAngle() + { + return $this->tilt_angle; + } + + /** + * Pitch angle, which indicates the upwards/downwards angle that the face is + * pointing relative to the image's horizontal plane. Range [-180,180]. + * + * Generated from protobuf field float tilt_angle = 6; + * @param float $var + * @return $this + */ + public function setTiltAngle($var) + { + GPBUtil::checkFloat($var); + $this->tilt_angle = $var; + + return $this; + } + + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + * @return float + */ + public function getDetectionConfidence() + { + return $this->detection_confidence; + } + + /** + * Detection confidence. Range [0, 1]. + * + * Generated from protobuf field float detection_confidence = 7; + * @param float $var + * @return $this + */ + public function setDetectionConfidence($var) + { + GPBUtil::checkFloat($var); + $this->detection_confidence = $var; + + return $this; + } + + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + * @return float + */ + public function getLandmarkingConfidence() + { + return $this->landmarking_confidence; + } + + /** + * Face landmarking confidence. Range [0, 1]. + * + * Generated from protobuf field float landmarking_confidence = 8; + * @param float $var + * @return $this + */ + public function setLandmarkingConfidence($var) + { + GPBUtil::checkFloat($var); + $this->landmarking_confidence = $var; + + return $this; + } + + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + * @return int + */ + public function getJoyLikelihood() + { + return $this->joy_likelihood; + } + + /** + * Joy likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood joy_likelihood = 9; + * @param int $var + * @return $this + */ + public function setJoyLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->joy_likelihood = $var; + + return $this; + } + + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + * @return int + */ + public function getSorrowLikelihood() + { + return $this->sorrow_likelihood; + } + + /** + * Sorrow likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood sorrow_likelihood = 10; + * @param int $var + * @return $this + */ + public function setSorrowLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->sorrow_likelihood = $var; + + return $this; + } + + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + * @return int + */ + public function getAngerLikelihood() + { + return $this->anger_likelihood; + } + + /** + * Anger likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood anger_likelihood = 11; + * @param int $var + * @return $this + */ + public function setAngerLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->anger_likelihood = $var; + + return $this; + } + + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + * @return int + */ + public function getSurpriseLikelihood() + { + return $this->surprise_likelihood; + } + + /** + * Surprise likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood surprise_likelihood = 12; + * @param int $var + * @return $this + */ + public function setSurpriseLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->surprise_likelihood = $var; + + return $this; + } + + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + * @return int + */ + public function getUnderExposedLikelihood() + { + return $this->under_exposed_likelihood; + } + + /** + * Under-exposed likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood under_exposed_likelihood = 13; + * @param int $var + * @return $this + */ + public function setUnderExposedLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->under_exposed_likelihood = $var; + + return $this; + } + + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + * @return int + */ + public function getBlurredLikelihood() + { + return $this->blurred_likelihood; + } + + /** + * Blurred likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood blurred_likelihood = 14; + * @param int $var + * @return $this + */ + public function setBlurredLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->blurred_likelihood = $var; + + return $this; + } + + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + * @return int + */ + public function getHeadwearLikelihood() + { + return $this->headwear_likelihood; + } + + /** + * Headwear likelihood. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood headwear_likelihood = 15; + * @param int $var + * @return $this + */ + public function setHeadwearLikelihood($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->headwear_likelihood = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark.php new file mode 100644 index 00000000000..060f8f4295d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark.php @@ -0,0 +1,114 @@ +google.cloud.vision.v1.FaceAnnotation.Landmark + */ +class Landmark extends \Google\Protobuf\Internal\Message +{ + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + */ + protected $type = 0; + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + */ + protected $position = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Face landmark type. + * @type \Google\Cloud\Vision\V1\Position $position + * Face landmark position. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Face landmark type. + * + * Generated from protobuf field .google.cloud.vision.v1.FaceAnnotation.Landmark.Type type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\FaceAnnotation\Landmark\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + * @return \Google\Cloud\Vision\V1\Position|null + */ + public function getPosition() + { + return $this->position; + } + + public function hasPosition() + { + return isset($this->position); + } + + public function clearPosition() + { + unset($this->position); + } + + /** + * Face landmark position. + * + * Generated from protobuf field .google.cloud.vision.v1.Position position = 4; + * @param \Google\Cloud\Vision\V1\Position $var + * @return $this + */ + public function setPosition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Position::class); + $this->position = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Landmark::class, \Google\Cloud\Vision\V1\FaceAnnotation_Landmark::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark/Type.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark/Type.php new file mode 100644 index 00000000000..7aabc19d2a6 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/FaceAnnotation/Landmark/Type.php @@ -0,0 +1,305 @@ +google.cloud.vision.v1.FaceAnnotation.Landmark.Type + */ +class Type +{ + /** + * Unknown face landmark detected. Should not be filled. + * + * Generated from protobuf enum UNKNOWN_LANDMARK = 0; + */ + const UNKNOWN_LANDMARK = 0; + /** + * Left eye. + * + * Generated from protobuf enum LEFT_EYE = 1; + */ + const LEFT_EYE = 1; + /** + * Right eye. + * + * Generated from protobuf enum RIGHT_EYE = 2; + */ + const RIGHT_EYE = 2; + /** + * Left of left eyebrow. + * + * Generated from protobuf enum LEFT_OF_LEFT_EYEBROW = 3; + */ + const LEFT_OF_LEFT_EYEBROW = 3; + /** + * Right of left eyebrow. + * + * Generated from protobuf enum RIGHT_OF_LEFT_EYEBROW = 4; + */ + const RIGHT_OF_LEFT_EYEBROW = 4; + /** + * Left of right eyebrow. + * + * Generated from protobuf enum LEFT_OF_RIGHT_EYEBROW = 5; + */ + const LEFT_OF_RIGHT_EYEBROW = 5; + /** + * Right of right eyebrow. + * + * Generated from protobuf enum RIGHT_OF_RIGHT_EYEBROW = 6; + */ + const RIGHT_OF_RIGHT_EYEBROW = 6; + /** + * Midpoint between eyes. + * + * Generated from protobuf enum MIDPOINT_BETWEEN_EYES = 7; + */ + const MIDPOINT_BETWEEN_EYES = 7; + /** + * Nose tip. + * + * Generated from protobuf enum NOSE_TIP = 8; + */ + const NOSE_TIP = 8; + /** + * Upper lip. + * + * Generated from protobuf enum UPPER_LIP = 9; + */ + const UPPER_LIP = 9; + /** + * Lower lip. + * + * Generated from protobuf enum LOWER_LIP = 10; + */ + const LOWER_LIP = 10; + /** + * Mouth left. + * + * Generated from protobuf enum MOUTH_LEFT = 11; + */ + const MOUTH_LEFT = 11; + /** + * Mouth right. + * + * Generated from protobuf enum MOUTH_RIGHT = 12; + */ + const MOUTH_RIGHT = 12; + /** + * Mouth center. + * + * Generated from protobuf enum MOUTH_CENTER = 13; + */ + const MOUTH_CENTER = 13; + /** + * Nose, bottom right. + * + * Generated from protobuf enum NOSE_BOTTOM_RIGHT = 14; + */ + const NOSE_BOTTOM_RIGHT = 14; + /** + * Nose, bottom left. + * + * Generated from protobuf enum NOSE_BOTTOM_LEFT = 15; + */ + const NOSE_BOTTOM_LEFT = 15; + /** + * Nose, bottom center. + * + * Generated from protobuf enum NOSE_BOTTOM_CENTER = 16; + */ + const NOSE_BOTTOM_CENTER = 16; + /** + * Left eye, top boundary. + * + * Generated from protobuf enum LEFT_EYE_TOP_BOUNDARY = 17; + */ + const LEFT_EYE_TOP_BOUNDARY = 17; + /** + * Left eye, right corner. + * + * Generated from protobuf enum LEFT_EYE_RIGHT_CORNER = 18; + */ + const LEFT_EYE_RIGHT_CORNER = 18; + /** + * Left eye, bottom boundary. + * + * Generated from protobuf enum LEFT_EYE_BOTTOM_BOUNDARY = 19; + */ + const LEFT_EYE_BOTTOM_BOUNDARY = 19; + /** + * Left eye, left corner. + * + * Generated from protobuf enum LEFT_EYE_LEFT_CORNER = 20; + */ + const LEFT_EYE_LEFT_CORNER = 20; + /** + * Right eye, top boundary. + * + * Generated from protobuf enum RIGHT_EYE_TOP_BOUNDARY = 21; + */ + const RIGHT_EYE_TOP_BOUNDARY = 21; + /** + * Right eye, right corner. + * + * Generated from protobuf enum RIGHT_EYE_RIGHT_CORNER = 22; + */ + const RIGHT_EYE_RIGHT_CORNER = 22; + /** + * Right eye, bottom boundary. + * + * Generated from protobuf enum RIGHT_EYE_BOTTOM_BOUNDARY = 23; + */ + const RIGHT_EYE_BOTTOM_BOUNDARY = 23; + /** + * Right eye, left corner. + * + * Generated from protobuf enum RIGHT_EYE_LEFT_CORNER = 24; + */ + const RIGHT_EYE_LEFT_CORNER = 24; + /** + * Left eyebrow, upper midpoint. + * + * Generated from protobuf enum LEFT_EYEBROW_UPPER_MIDPOINT = 25; + */ + const LEFT_EYEBROW_UPPER_MIDPOINT = 25; + /** + * Right eyebrow, upper midpoint. + * + * Generated from protobuf enum RIGHT_EYEBROW_UPPER_MIDPOINT = 26; + */ + const RIGHT_EYEBROW_UPPER_MIDPOINT = 26; + /** + * Left ear tragion. + * + * Generated from protobuf enum LEFT_EAR_TRAGION = 27; + */ + const LEFT_EAR_TRAGION = 27; + /** + * Right ear tragion. + * + * Generated from protobuf enum RIGHT_EAR_TRAGION = 28; + */ + const RIGHT_EAR_TRAGION = 28; + /** + * Left eye pupil. + * + * Generated from protobuf enum LEFT_EYE_PUPIL = 29; + */ + const LEFT_EYE_PUPIL = 29; + /** + * Right eye pupil. + * + * Generated from protobuf enum RIGHT_EYE_PUPIL = 30; + */ + const RIGHT_EYE_PUPIL = 30; + /** + * Forehead glabella. + * + * Generated from protobuf enum FOREHEAD_GLABELLA = 31; + */ + const FOREHEAD_GLABELLA = 31; + /** + * Chin gnathion. + * + * Generated from protobuf enum CHIN_GNATHION = 32; + */ + const CHIN_GNATHION = 32; + /** + * Chin left gonion. + * + * Generated from protobuf enum CHIN_LEFT_GONION = 33; + */ + const CHIN_LEFT_GONION = 33; + /** + * Chin right gonion. + * + * Generated from protobuf enum CHIN_RIGHT_GONION = 34; + */ + const CHIN_RIGHT_GONION = 34; + /** + * Left cheek center. + * + * Generated from protobuf enum LEFT_CHEEK_CENTER = 35; + */ + const LEFT_CHEEK_CENTER = 35; + /** + * Right cheek center. + * + * Generated from protobuf enum RIGHT_CHEEK_CENTER = 36; + */ + const RIGHT_CHEEK_CENTER = 36; + + private static $valueToName = [ + self::UNKNOWN_LANDMARK => 'UNKNOWN_LANDMARK', + self::LEFT_EYE => 'LEFT_EYE', + self::RIGHT_EYE => 'RIGHT_EYE', + self::LEFT_OF_LEFT_EYEBROW => 'LEFT_OF_LEFT_EYEBROW', + self::RIGHT_OF_LEFT_EYEBROW => 'RIGHT_OF_LEFT_EYEBROW', + self::LEFT_OF_RIGHT_EYEBROW => 'LEFT_OF_RIGHT_EYEBROW', + self::RIGHT_OF_RIGHT_EYEBROW => 'RIGHT_OF_RIGHT_EYEBROW', + self::MIDPOINT_BETWEEN_EYES => 'MIDPOINT_BETWEEN_EYES', + self::NOSE_TIP => 'NOSE_TIP', + self::UPPER_LIP => 'UPPER_LIP', + self::LOWER_LIP => 'LOWER_LIP', + self::MOUTH_LEFT => 'MOUTH_LEFT', + self::MOUTH_RIGHT => 'MOUTH_RIGHT', + self::MOUTH_CENTER => 'MOUTH_CENTER', + self::NOSE_BOTTOM_RIGHT => 'NOSE_BOTTOM_RIGHT', + self::NOSE_BOTTOM_LEFT => 'NOSE_BOTTOM_LEFT', + self::NOSE_BOTTOM_CENTER => 'NOSE_BOTTOM_CENTER', + self::LEFT_EYE_TOP_BOUNDARY => 'LEFT_EYE_TOP_BOUNDARY', + self::LEFT_EYE_RIGHT_CORNER => 'LEFT_EYE_RIGHT_CORNER', + self::LEFT_EYE_BOTTOM_BOUNDARY => 'LEFT_EYE_BOTTOM_BOUNDARY', + self::LEFT_EYE_LEFT_CORNER => 'LEFT_EYE_LEFT_CORNER', + self::RIGHT_EYE_TOP_BOUNDARY => 'RIGHT_EYE_TOP_BOUNDARY', + self::RIGHT_EYE_RIGHT_CORNER => 'RIGHT_EYE_RIGHT_CORNER', + self::RIGHT_EYE_BOTTOM_BOUNDARY => 'RIGHT_EYE_BOTTOM_BOUNDARY', + self::RIGHT_EYE_LEFT_CORNER => 'RIGHT_EYE_LEFT_CORNER', + self::LEFT_EYEBROW_UPPER_MIDPOINT => 'LEFT_EYEBROW_UPPER_MIDPOINT', + self::RIGHT_EYEBROW_UPPER_MIDPOINT => 'RIGHT_EYEBROW_UPPER_MIDPOINT', + self::LEFT_EAR_TRAGION => 'LEFT_EAR_TRAGION', + self::RIGHT_EAR_TRAGION => 'RIGHT_EAR_TRAGION', + self::LEFT_EYE_PUPIL => 'LEFT_EYE_PUPIL', + self::RIGHT_EYE_PUPIL => 'RIGHT_EYE_PUPIL', + self::FOREHEAD_GLABELLA => 'FOREHEAD_GLABELLA', + self::CHIN_GNATHION => 'CHIN_GNATHION', + self::CHIN_LEFT_GONION => 'CHIN_LEFT_GONION', + self::CHIN_RIGHT_GONION => 'CHIN_RIGHT_GONION', + self::LEFT_CHEEK_CENTER => 'LEFT_CHEEK_CENTER', + self::RIGHT_CHEEK_CENTER => 'RIGHT_CHEEK_CENTER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Vision\V1\FaceAnnotation_Landmark_Type::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature.php new file mode 100644 index 00000000000..ac1b22a40aa --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature.php @@ -0,0 +1,153 @@ +google.cloud.vision.v1.Feature + */ +class Feature extends \Google\Protobuf\Internal\Message +{ + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + */ + protected $type = 0; + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + */ + protected $max_results = 0; + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also + * support "builtin/weekly" for the bleeding edge release updated weekly. + * + * Generated from protobuf field string model = 3; + */ + protected $model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The feature type. + * @type int $max_results + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * @type string $model + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also + * support "builtin/weekly" for the bleeding edge release updated weekly. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The feature type. + * + * Generated from protobuf field .google.cloud.vision.v1.Feature.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Feature\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + * @return int + */ + public function getMaxResults() + { + return $this->max_results; + } + + /** + * Maximum number of results of this type. Does not apply to + * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. + * + * Generated from protobuf field int32 max_results = 2; + * @param int $var + * @return $this + */ + public function setMaxResults($var) + { + GPBUtil::checkInt32($var); + $this->max_results = $var; + + return $this; + } + + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also + * support "builtin/weekly" for the bleeding edge release updated weekly. + * + * Generated from protobuf field string model = 3; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Model to use for the feature. + * Supported values: "builtin/stable" (the default if unset) and + * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also + * support "builtin/weekly" for the bleeding edge release updated weekly. + * + * Generated from protobuf field string model = 3; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature/Type.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature/Type.php new file mode 100644 index 00000000000..d905c7320a4 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Feature/Type.php @@ -0,0 +1,139 @@ +google.cloud.vision.v1.Feature.Type + */ +class Type +{ + /** + * Unspecified feature type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Run face detection. + * + * Generated from protobuf enum FACE_DETECTION = 1; + */ + const FACE_DETECTION = 1; + /** + * Run landmark detection. + * + * Generated from protobuf enum LANDMARK_DETECTION = 2; + */ + const LANDMARK_DETECTION = 2; + /** + * Run logo detection. + * + * Generated from protobuf enum LOGO_DETECTION = 3; + */ + const LOGO_DETECTION = 3; + /** + * Run label detection. + * + * Generated from protobuf enum LABEL_DETECTION = 4; + */ + const LABEL_DETECTION = 4; + /** + * Run text detection / optical character recognition (OCR). Text detection + * is optimized for areas of text within a larger image; if the image is + * a document, use `DOCUMENT_TEXT_DETECTION` instead. + * + * Generated from protobuf enum TEXT_DETECTION = 5; + */ + const TEXT_DETECTION = 5; + /** + * Run dense text document OCR. Takes precedence when both + * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. + * + * Generated from protobuf enum DOCUMENT_TEXT_DETECTION = 11; + */ + const DOCUMENT_TEXT_DETECTION = 11; + /** + * Run Safe Search to detect potentially unsafe + * or undesirable content. + * + * Generated from protobuf enum SAFE_SEARCH_DETECTION = 6; + */ + const SAFE_SEARCH_DETECTION = 6; + /** + * Compute a set of image properties, such as the + * image's dominant colors. + * + * Generated from protobuf enum IMAGE_PROPERTIES = 7; + */ + const IMAGE_PROPERTIES = 7; + /** + * Run crop hints. + * + * Generated from protobuf enum CROP_HINTS = 9; + */ + const CROP_HINTS = 9; + /** + * Run web detection. + * + * Generated from protobuf enum WEB_DETECTION = 10; + */ + const WEB_DETECTION = 10; + /** + * Run Product Search. + * + * Generated from protobuf enum PRODUCT_SEARCH = 12; + */ + const PRODUCT_SEARCH = 12; + /** + * Run localizer for object detection. + * + * Generated from protobuf enum OBJECT_LOCALIZATION = 19; + */ + const OBJECT_LOCALIZATION = 19; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::FACE_DETECTION => 'FACE_DETECTION', + self::LANDMARK_DETECTION => 'LANDMARK_DETECTION', + self::LOGO_DETECTION => 'LOGO_DETECTION', + self::LABEL_DETECTION => 'LABEL_DETECTION', + self::TEXT_DETECTION => 'TEXT_DETECTION', + self::DOCUMENT_TEXT_DETECTION => 'DOCUMENT_TEXT_DETECTION', + self::SAFE_SEARCH_DETECTION => 'SAFE_SEARCH_DETECTION', + self::IMAGE_PROPERTIES => 'IMAGE_PROPERTIES', + self::CROP_HINTS => 'CROP_HINTS', + self::WEB_DETECTION => 'WEB_DETECTION', + self::PRODUCT_SEARCH => 'PRODUCT_SEARCH', + self::OBJECT_LOCALIZATION => 'OBJECT_LOCALIZATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Vision\V1\Feature_Type::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsDestination.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsDestination.php new file mode 100644 index 00000000000..5e5f3f520ee --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsDestination.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Google Cloud Storage URI prefix where the results will be stored. Results + * will be in JSON format and preceded by its corresponding input URI prefix. + * This field can either represent a gcs file prefix or gcs directory. In + * either case, the uri should be unique because in order to get all of the + * output files, you will need to do a wildcard gcs search on the uri prefix + * you provide. + * Examples: + * * File Prefix: gs://bucket-name/here/filenameprefix The output files + * will be created in gs://bucket-name/here/ and the names of the + * output files will begin with "filenameprefix". + * * Directory Prefix: gs://bucket-name/some/location/ The output files + * will be created in gs://bucket-name/some/location/ and the names of the + * output files could be anything because there was no filename prefix + * specified. + * If multiple outputs, each response is still AnnotateFileResponse, each of + * which contains some subset of the full list of AnnotateImageResponse. + * Multiple outputs can happen if, for example, the output JSON is too large + * and overflows into multiple sharded files. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsSource.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsSource.php new file mode 100644 index 00000000000..e7c46ae00ad --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GcsSource.php @@ -0,0 +1,71 @@ +google.cloud.vision.v1.GcsSource + */ +class GcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Google Cloud Storage URI for the input file. This must only be a + * Google Cloud Storage object. Wildcards are not currently supported. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductRequest.php new file mode 100644 index 00000000000..8716aa759f1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.GetProductRequest + */ +class GetProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * Please see {@see ProductSearchClient::productName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\GetProductRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductSetRequest.php new file mode 100644 index 00000000000..f133d964a1f --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetProductSetRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.GetProductSetRequest + */ +class GetProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * Please see {@see ProductSearchClient::productSetName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\GetProductSetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetReferenceImageRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetReferenceImageRequest.php new file mode 100644 index 00000000000..87a13da256c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/GetReferenceImageRequest.php @@ -0,0 +1,92 @@ +google.cloud.vision.v1.GetReferenceImageRequest + */ +class GetReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the ReferenceImage to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. Please see + * {@see ProductSearchClient::referenceImageName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\GetReferenceImageRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Image.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Image.php new file mode 100644 index 00000000000..a829768dbbe --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Image.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + */ + protected $content = ''; + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + */ + protected $source = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * @type \Google\Cloud\Vision\V1\ImageSource $source + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Image content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateImages requests. It does + * not work for AsyncBatchAnnotateImages requests. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + * @return \Google\Cloud\Vision\V1\ImageSource|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * Google Cloud Storage image location, or publicly-accessible image + * URL. If both `content` and `source` are provided for an image, `content` + * takes precedence and is used to perform the image annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.ImageSource source = 2; + * @param \Google\Cloud\Vision\V1\ImageSource $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImageSource::class); + $this->source = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageAnnotationContext.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageAnnotationContext.php new file mode 100644 index 00000000000..04aba2e4a1d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageAnnotationContext.php @@ -0,0 +1,106 @@ +google.cloud.vision.v1.ImageAnnotationContext + */ +class ImageAnnotationContext extends \Google\Protobuf\Internal\Message +{ + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + */ + protected $uri = ''; + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + */ + protected $page_number = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * The URI of the file used to produce the image. + * @type int $page_number + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The URI of the file used to produce the image. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + * @return int + */ + public function getPageNumber() + { + return $this->page_number; + } + + /** + * If the file was a PDF or TIFF, this field gives the page number within + * the file used to produce the image. + * + * Generated from protobuf field int32 page_number = 2; + * @param int $var + * @return $this + */ + public function setPageNumber($var) + { + GPBUtil::checkInt32($var); + $this->page_number = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageContext.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageContext.php new file mode 100644 index 00000000000..25a6e9b648c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageContext.php @@ -0,0 +1,315 @@ +google.cloud.vision.v1.ImageContext + */ +class ImageContext extends \Google\Protobuf\Internal\Message +{ + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + */ + protected $lat_long_rect = null; + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + */ + private $language_hints; + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + */ + protected $crop_hints_params = null; + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + */ + protected $product_search_params = null; + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + */ + protected $web_detection_params = null; + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + */ + protected $text_detection_params = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\LatLongRect $lat_long_rect + * Not used. + * @type array|\Google\Protobuf\Internal\RepeatedField $language_hints + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * @type \Google\Cloud\Vision\V1\CropHintsParams $crop_hints_params + * Parameters for crop hints annotation request. + * @type \Google\Cloud\Vision\V1\ProductSearchParams $product_search_params + * Parameters for product search. + * @type \Google\Cloud\Vision\V1\WebDetectionParams $web_detection_params + * Parameters for web detection. + * @type \Google\Cloud\Vision\V1\TextDetectionParams $text_detection_params + * Parameters for text detection and document text detection. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + * @return \Google\Cloud\Vision\V1\LatLongRect|null + */ + public function getLatLongRect() + { + return $this->lat_long_rect; + } + + public function hasLatLongRect() + { + return isset($this->lat_long_rect); + } + + public function clearLatLongRect() + { + unset($this->lat_long_rect); + } + + /** + * Not used. + * + * Generated from protobuf field .google.cloud.vision.v1.LatLongRect lat_long_rect = 1; + * @param \Google\Cloud\Vision\V1\LatLongRect $var + * @return $this + */ + public function setLatLongRect($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\LatLongRect::class); + $this->lat_long_rect = $var; + + return $this; + } + + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageHints() + { + return $this->language_hints; + } + + /** + * List of languages to use for TEXT_DETECTION. In most cases, an empty value + * yields the best results since it enables automatic language detection. For + * languages based on the Latin alphabet, setting `language_hints` is not + * needed. In rare cases, when the language of the text in the image is known, + * setting a hint will help get better results (although it will be a + * significant hindrance if the hint is wrong). Text detection returns an + * error if one or more of the specified languages is not one of the + * [supported languages](https://cloud.google.com/vision/docs/languages). + * + * Generated from protobuf field repeated string language_hints = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_hints = $arr; + + return $this; + } + + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + * @return \Google\Cloud\Vision\V1\CropHintsParams|null + */ + public function getCropHintsParams() + { + return $this->crop_hints_params; + } + + public function hasCropHintsParams() + { + return isset($this->crop_hints_params); + } + + public function clearCropHintsParams() + { + unset($this->crop_hints_params); + } + + /** + * Parameters for crop hints annotation request. + * + * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; + * @param \Google\Cloud\Vision\V1\CropHintsParams $var + * @return $this + */ + public function setCropHintsParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\CropHintsParams::class); + $this->crop_hints_params = $var; + + return $this; + } + + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @return \Google\Cloud\Vision\V1\ProductSearchParams|null + */ + public function getProductSearchParams() + { + return $this->product_search_params; + } + + public function hasProductSearchParams() + { + return isset($this->product_search_params); + } + + public function clearProductSearchParams() + { + unset($this->product_search_params); + } + + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @param \Google\Cloud\Vision\V1\ProductSearchParams $var + * @return $this + */ + public function setProductSearchParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class); + $this->product_search_params = $var; + + return $this; + } + + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + * @return \Google\Cloud\Vision\V1\WebDetectionParams|null + */ + public function getWebDetectionParams() + { + return $this->web_detection_params; + } + + public function hasWebDetectionParams() + { + return isset($this->web_detection_params); + } + + public function clearWebDetectionParams() + { + unset($this->web_detection_params); + } + + /** + * Parameters for web detection. + * + * Generated from protobuf field .google.cloud.vision.v1.WebDetectionParams web_detection_params = 6; + * @param \Google\Cloud\Vision\V1\WebDetectionParams $var + * @return $this + */ + public function setWebDetectionParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\WebDetectionParams::class); + $this->web_detection_params = $var; + + return $this; + } + + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + * @return \Google\Cloud\Vision\V1\TextDetectionParams|null + */ + public function getTextDetectionParams() + { + return $this->text_detection_params; + } + + public function hasTextDetectionParams() + { + return isset($this->text_detection_params); + } + + public function clearTextDetectionParams() + { + unset($this->text_detection_params); + } + + /** + * Parameters for text detection and document text detection. + * + * Generated from protobuf field .google.cloud.vision.v1.TextDetectionParams text_detection_params = 12; + * @param \Google\Cloud\Vision\V1\TextDetectionParams $var + * @return $this + */ + public function setTextDetectionParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextDetectionParams::class); + $this->text_detection_params = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageProperties.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageProperties.php new file mode 100644 index 00000000000..05d082b53f7 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageProperties.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.ImageProperties + */ +class ImageProperties extends \Google\Protobuf\Internal\Message +{ + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + */ + protected $dominant_colors = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\DominantColorsAnnotation $dominant_colors + * If present, dominant colors completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + * @return \Google\Cloud\Vision\V1\DominantColorsAnnotation|null + */ + public function getDominantColors() + { + return $this->dominant_colors; + } + + public function hasDominantColors() + { + return isset($this->dominant_colors); + } + + public function clearDominantColors() + { + unset($this->dominant_colors); + } + + /** + * If present, dominant colors completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.DominantColorsAnnotation dominant_colors = 1; + * @param \Google\Cloud\Vision\V1\DominantColorsAnnotation $var + * @return $this + */ + public function setDominantColors($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\DominantColorsAnnotation::class); + $this->dominant_colors = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageSource.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageSource.php new file mode 100644 index 00000000000..977a6a7406c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImageSource.php @@ -0,0 +1,169 @@ +google.cloud.vision.v1.ImageSource + */ +class ImageSource extends \Google\Protobuf\Internal\Message +{ + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + */ + protected $gcs_image_uri = ''; + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + */ + protected $image_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_image_uri + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * @type string $image_uri + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + * @return string + */ + public function getGcsImageUri() + { + return $this->gcs_image_uri; + } + + /** + * **Use `image_uri` instead.** + * The Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. + * + * Generated from protobuf field string gcs_image_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsImageUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_image_uri = $var; + + return $this; + } + + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + * @return string + */ + public function getImageUri() + { + return $this->image_uri; + } + + /** + * The URI of the source image. Can be either: + * 1. A Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. See + * [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris) for more + * info. + * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + * HTTP/HTTPS URLs, Google cannot guarantee that the request will be + * completed. Your request may fail if the specified host denies the + * request (e.g. due to request throttling or DOS prevention), or if Google + * throttles requests to the site for abuse prevention. You should not + * depend on externally-hosted images for production applications. + * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes + * precedence. + * + * Generated from protobuf field string image_uri = 2; + * @param string $var + * @return $this + */ + public function setImageUri($var) + { + GPBUtil::checkString($var, True); + $this->image_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsGcsSource.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsGcsSource.php new file mode 100644 index 00000000000..b6e1d5818b4 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsGcsSource.php @@ -0,0 +1,260 @@ +google.cloud.vision.v1.ImportProductSetsGcsSource + */ +class ImportProductSetsGcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and + * the `labels` column refers to + * [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field + * for the product to a space (" "). You can update the `display_name` later + * by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + */ + protected $csv_file_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $csv_file_uri + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and + * the `labels` column refers to + * [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field + * for the product to a space (" "). You can update the `display_name` later + * by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and + * the `labels` column refers to + * [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field + * for the product to a space (" "). You can update the `display_name` later + * by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @return string + */ + public function getCsvFileUri() + { + return $this->csv_file_uri; + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and + * the `labels` column refers to + * [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field + * for the product to a space (" "). You can update the `display_name` later + * by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @param string $var + * @return $this + */ + public function setCsvFileUri($var) + { + GPBUtil::checkString($var, True); + $this->csv_file_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsInputConfig.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsInputConfig.php new file mode 100644 index 00000000000..18183627329 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsInputConfig.php @@ -0,0 +1,78 @@ +google.cloud.vision.v1.ImportProductSetsInputConfig + */ +class ImportProductSetsInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $gcs_source + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @return \Google\Cloud\Vision\V1\ImportProductSetsGcsSource|null + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + public function hasGcsSource() + { + return $this->hasOneof(1); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @param \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsGcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsRequest.php new file mode 100644 index 00000000000..24ecfc858ac --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsRequest.php @@ -0,0 +1,133 @@ +google.cloud.vision.v1.ImportProductSetsRequest + */ +class ImportProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $input_config = null; + + /** + * @param string $parent Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. Please see + * {@see ProductSearchClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $inputConfig Required. The input content for the list of requests. + * + * @return \Google\Cloud\Vision\V1\ImportProductSetsRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $inputConfig): self + { + return (new self()) + ->setParent($parent) + ->setInputConfig($inputConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $input_config + * Required. The input content for the list of requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ImportProductSetsInputConfig|null + */ + public function getInputConfig() + { + return $this->input_config; + } + + public function hasInputConfig() + { + return isset($this->input_config); + } + + public function clearInputConfig() + { + unset($this->input_config); + } + + /** + * Required. The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsInputConfig::class); + $this->input_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsResponse.php new file mode 100644 index 00000000000..79c3e8bda87 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ImportProductSetsResponse.php @@ -0,0 +1,122 @@ +google.cloud.vision.v1.ImportProductSetsResponse + */ +class ImportProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + */ + private $statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\ReferenceImage>|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference_images that are imported successfully. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $statuses + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param array<\Google\Cloud\Vision\V1\ReferenceImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatuses() + { + return $this->statuses; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->statuses = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/InputConfig.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/InputConfig.php new file mode 100644 index 00000000000..7fc7ef2d630 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/InputConfig.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.InputConfig + */ +class InputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + */ + protected $gcs_source = null; + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + */ + protected $content = ''; + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\GcsSource $gcs_source + * The Google Cloud Storage location to read the input from. + * @type string $content + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * @type string $mime_type + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + * @return \Google\Cloud\Vision\V1\GcsSource|null + */ + public function getGcsSource() + { + return $this->gcs_source; + } + + public function hasGcsSource() + { + return isset($this->gcs_source); + } + + public function clearGcsSource() + { + unset($this->gcs_source); + } + + /** + * The Google Cloud Storage location to read the input from. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsSource gcs_source = 1; + * @param \Google\Cloud\Vision\V1\GcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\GcsSource::class); + $this->gcs_source = $var; + + return $this; + } + + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * File content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * Currently, this field only works for BatchAnnotateFiles requests. It does + * not work for AsyncBatchAnnotateFiles requests. + * + * Generated from protobuf field bytes content = 3; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * The type of the file. Currently only "application/pdf", "image/tiff" and + * "image/gif" are supported. Wildcards are not supported. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LatLongRect.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LatLongRect.php new file mode 100644 index 00000000000..c582fe6217f --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LatLongRect.php @@ -0,0 +1,121 @@ +google.cloud.vision.v1.LatLongRect + */ +class LatLongRect extends \Google\Protobuf\Internal\Message +{ + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + */ + protected $min_lat_lng = null; + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + */ + protected $max_lat_lng = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $min_lat_lng + * Min lat/long pair. + * @type \Google\Type\LatLng $max_lat_lng + * Max lat/long pair. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getMinLatLng() + { + return $this->min_lat_lng; + } + + public function hasMinLatLng() + { + return isset($this->min_lat_lng); + } + + public function clearMinLatLng() + { + unset($this->min_lat_lng); + } + + /** + * Min lat/long pair. + * + * Generated from protobuf field .google.type.LatLng min_lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setMinLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->min_lat_lng = $var; + + return $this; + } + + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + * @return \Google\Type\LatLng|null + */ + public function getMaxLatLng() + { + return $this->max_lat_lng; + } + + public function hasMaxLatLng() + { + return isset($this->max_lat_lng); + } + + public function clearMaxLatLng() + { + unset($this->max_lat_lng); + } + + /** + * Max lat/long pair. + * + * Generated from protobuf field .google.type.LatLng max_lat_lng = 2; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setMaxLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->max_lat_lng = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Likelihood.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Likelihood.php new file mode 100644 index 00000000000..a38e9ab08c2 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Likelihood.php @@ -0,0 +1,83 @@ +google.cloud.vision.v1.Likelihood + */ +class Likelihood +{ + /** + * Unknown likelihood. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * It is very unlikely. + * + * Generated from protobuf enum VERY_UNLIKELY = 1; + */ + const VERY_UNLIKELY = 1; + /** + * It is unlikely. + * + * Generated from protobuf enum UNLIKELY = 2; + */ + const UNLIKELY = 2; + /** + * It is possible. + * + * Generated from protobuf enum POSSIBLE = 3; + */ + const POSSIBLE = 3; + /** + * It is likely. + * + * Generated from protobuf enum LIKELY = 4; + */ + const LIKELY = 4; + /** + * It is very likely. + * + * Generated from protobuf enum VERY_LIKELY = 5; + */ + const VERY_LIKELY = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::VERY_UNLIKELY => 'VERY_UNLIKELY', + self::UNLIKELY => 'UNLIKELY', + self::POSSIBLE => 'POSSIBLE', + self::LIKELY => 'LIKELY', + self::VERY_LIKELY => 'VERY_LIKELY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsRequest.php new file mode 100644 index 00000000000..c2ca9f793d5 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsRequest.php @@ -0,0 +1,155 @@ +google.cloud.vision.v1.ListProductSetsRequest + */ +class ListProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. Please see + * {@see ProductSearchClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\ListProductSetsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsResponse.php new file mode 100644 index 00000000000..6fb58f3ea6d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductSetsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductSetsResponse + */ +class ListProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + */ + private $product_sets; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\ProductSet>|\Google\Protobuf\Internal\RepeatedField $product_sets + * List of ProductSets. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductSets() + { + return $this->product_sets; + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @param array<\Google\Cloud\Vision\V1\ProductSet>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductSets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_sets = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetRequest.php new file mode 100644 index 00000000000..70a71c26a95 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetRequest.php @@ -0,0 +1,160 @@ +google.cloud.vision.v1.ListProductsInProductSetRequest + */ +class ListProductsInProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $name Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * Please see {@see ProductSearchClient::productSetName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\ListProductsInProductSetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetResponse.php new file mode 100644 index 00000000000..550e51fc19f --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsInProductSetResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsInProductSetResponse + */ +class ListProductsInProductSetResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\Product>|\Google\Protobuf\Internal\RepeatedField $products + * The list of Products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param array<\Google\Cloud\Vision\V1\Product>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsRequest.php new file mode 100644 index 00000000000..e6efb131265 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsRequest.php @@ -0,0 +1,160 @@ +google.cloud.vision.v1.ListProductsRequest + */ +class ListProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * Please see {@see ProductSearchClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\ListProductsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsResponse.php new file mode 100644 index 00000000000..192d6f3a9a1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListProductsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsResponse + */ +class ListProductsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\Product>|\Google\Protobuf\Internal\RepeatedField $products + * List of products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param array<\Google\Cloud\Vision\V1\Product>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesRequest.php new file mode 100644 index 00000000000..fb833ada772 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesRequest.php @@ -0,0 +1,168 @@ +google.cloud.vision.v1.ListReferenceImagesRequest + */ +class ListReferenceImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. Please see + * {@see ProductSearchClient::productName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\ListReferenceImagesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesResponse.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesResponse.php new file mode 100644 index 00000000000..bf552bad802 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ListReferenceImagesResponse.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.ListReferenceImagesResponse + */ +class ListReferenceImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\ReferenceImage>|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference images. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $next_page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param array<\Google\Cloud\Vision\V1\ReferenceImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocalizedObjectAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocalizedObjectAnnotation.php new file mode 100644 index 00000000000..6e85feb7fed --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocalizedObjectAnnotation.php @@ -0,0 +1,221 @@ +google.cloud.vision.v1.LocalizedObjectAnnotation + */ +class LocalizedObjectAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + */ + protected $mid = ''; + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + */ + protected $name = ''; + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + protected $score = 0.0; + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + */ + protected $bounding_poly = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Object ID that should align with EntityAnnotation mid. + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type string $name + * Object name, expressed in its `language_code` language. + * @type float $score + * Score of the result. Range [0, 1]. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * Image region to which this object belongs. This must be populated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * Image region to which this object belongs. This must be populated. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 5; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocationInfo.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocationInfo.php new file mode 100644 index 00000000000..02c79371bf4 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/LocationInfo.php @@ -0,0 +1,77 @@ +google.cloud.vision.v1.LocationInfo + */ +class LocationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + */ + protected $lat_lng = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\LatLng $lat_lng + * lat/long location coordinates. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @return \Google\Type\LatLng|null + */ + public function getLatLng() + { + return $this->lat_lng; + } + + public function hasLatLng() + { + return isset($this->lat_lng); + } + + public function clearLatLng() + { + unset($this->lat_lng); + } + + /** + * lat/long location coordinates. + * + * Generated from protobuf field .google.type.LatLng lat_lng = 1; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setLatLng($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->lat_lng = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/NormalizedVertex.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/NormalizedVertex.php new file mode 100644 index 00000000000..20d663aa3bd --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/NormalizedVertex.php @@ -0,0 +1,103 @@ +google.cloud.vision.v1.NormalizedVertex + */ +class NormalizedVertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + protected $x = 0.0; + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + */ + protected $y = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata.php new file mode 100644 index 00000000000..ae546b7644c --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata.php @@ -0,0 +1,155 @@ +google.cloud.vision.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + */ + protected $state = 0; + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + */ + protected $create_time = null; + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * Current state of the batch operation. + * @type \Google\Protobuf\Timestamp $create_time + * The time when the batch request was received. + * @type \Google\Protobuf\Timestamp $update_time + * The time when the operation result was last updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.OperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\OperationMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time when the batch request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * The time when the operation result was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata/State.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata/State.php new file mode 100644 index 00000000000..345f7bb0a59 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OperationMetadata/State.php @@ -0,0 +1,78 @@ +google.cloud.vision.v1.OperationMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is received. + * + * Generated from protobuf enum CREATED = 1; + */ + const CREATED = 1; + /** + * Request is actively being processed. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The batch processing is done. + * + * Generated from protobuf enum DONE = 3; + */ + const DONE = 3; + /** + * The batch processing was cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATED => 'CREATED', + self::RUNNING => 'RUNNING', + self::DONE => 'DONE', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Vision\V1\OperationMetadata_State::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OutputConfig.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OutputConfig.php new file mode 100644 index 00000000000..4273ce19296 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/OutputConfig.php @@ -0,0 +1,143 @@ +google.cloud.vision.v1.OutputConfig + */ +class OutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + */ + protected $gcs_destination = null; + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + */ + protected $batch_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\GcsDestination $gcs_destination + * The Google Cloud Storage location to write the output(s) to. + * @type int $batch_size + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + * @return \Google\Cloud\Vision\V1\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->gcs_destination; + } + + public function hasGcsDestination() + { + return isset($this->gcs_destination); + } + + public function clearGcsDestination() + { + unset($this->gcs_destination); + } + + /** + * The Google Cloud Storage location to write the output(s) to. + * + * Generated from protobuf field .google.cloud.vision.v1.GcsDestination gcs_destination = 1; + * @param \Google\Cloud\Vision\V1\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\GcsDestination::class); + $this->gcs_destination = $var; + + return $this; + } + + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + * @return int + */ + public function getBatchSize() + { + return $this->batch_size; + } + + /** + * The max number of response protos to put into each output JSON file on + * Google Cloud Storage. + * The valid range is [1, 100]. If not specified, the default value is 20. + * For example, for one pdf file with 100 pages, 100 response protos will + * be generated. If `batch_size` = 20, then 5 json files each + * containing 20 response protos will be written under the prefix + * `gcs_destination`.`uri`. + * Currently, batch_size only applies to GcsDestination, with potential future + * support for other output configurations. + * + * Generated from protobuf field int32 batch_size = 2; + * @param int $var + * @return $this + */ + public function setBatchSize($var) + { + GPBUtil::checkInt32($var); + $this->batch_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Page.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Page.php new file mode 100644 index 00000000000..26020d0280b --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Page.php @@ -0,0 +1,221 @@ +google.cloud.vision.v1.Page + */ +class Page extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + protected $property = null; + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + */ + protected $width = 0; + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + */ + protected $height = 0; + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + */ + private $blocks; + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected on the page. + * @type int $width + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * @type int $height + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * @type array<\Google\Cloud\Vision\V1\Block>|\Google\Protobuf\Internal\RepeatedField $blocks + * List of blocks of text, images etc on this page. + * @type float $confidence + * Confidence of the OCR results on the page. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected on the page. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Page width. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 width = 2; + * @param int $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkInt32($var); + $this->width = $var; + + return $this; + } + + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Page height. For PDFs the unit is points. For images (including + * TIFFs) the unit is pixels. + * + * Generated from protobuf field int32 height = 3; + * @param int $var + * @return $this + */ + public function setHeight($var) + { + GPBUtil::checkInt32($var); + $this->height = $var; + + return $this; + } + + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBlocks() + { + return $this->blocks; + } + + /** + * List of blocks of text, images etc on this page. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Block blocks = 4; + * @param array<\Google\Cloud\Vision\V1\Block>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Block::class); + $this->blocks = $arr; + + return $this; + } + + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results on the page. Range [0, 1]. + * + * Generated from protobuf field float confidence = 5; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Paragraph.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Paragraph.php new file mode 100644 index 00000000000..0dbbb5b4367 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Paragraph.php @@ -0,0 +1,245 @@ +google.cloud.vision.v1.Paragraph + */ +class Paragraph extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + protected $property = null; + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + protected $bounding_box = null; + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + */ + private $words; + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the paragraph. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type array<\Google\Cloud\Vision\V1\Word>|\Google\Protobuf\Internal\RepeatedField $words + * List of all words in this paragraph. + * @type float $confidence + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the paragraph. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the paragraph. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWords() + { + return $this->words; + } + + /** + * List of all words in this paragraph. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Word words = 3; + * @param array<\Google\Cloud\Vision\V1\Word>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Word::class); + $this->words = $arr; + + return $this; + } + + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the paragraph. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Position.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Position.php new file mode 100644 index 00000000000..198ed9067d2 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Position.php @@ -0,0 +1,137 @@ +google.cloud.vision.v1.Position + */ +class Position extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + protected $x = 0.0; + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + */ + protected $y = 0.0; + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + */ + protected $z = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate. + * @type float $z + * Z coordinate (or depth). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + * @return float + */ + public function getZ() + { + return $this->z; + } + + /** + * Z coordinate (or depth). + * + * Generated from protobuf field float z = 3; + * @param float $var + * @return $this + */ + public function setZ($var) + { + GPBUtil::checkFloat($var); + $this->z = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product.php new file mode 100644 index 00000000000..56502e7cfe5 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product.php @@ -0,0 +1,275 @@ +google.cloud.vision.v1.Product + */ +class Product extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Immutable. The category for the product identified by the reference image. + * This should be one of "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1" or "general-v1". The legacy categories "homegoods", + * "apparel", and "toys" are still supported, but these should not be used for + * new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $product_category = ''; + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + */ + private $product_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * @type string $display_name + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * @type string $description + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * @type string $product_category + * Immutable. The category for the product identified by the reference image. + * This should be one of "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1" or "general-v1". The legacy categories "homegoods", + * "apparel", and "toys" are still supported, but these should not be used for + * new products. + * @type array<\Google\Cloud\Vision\V1\Product\KeyValue>|\Google\Protobuf\Internal\RepeatedField $product_labels + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Immutable. The category for the product identified by the reference image. + * This should be one of "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1" or "general-v1". The legacy categories "homegoods", + * "apparel", and "toys" are still supported, but these should not be used for + * new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getProductCategory() + { + return $this->product_category; + } + + /** + * Immutable. The category for the product identified by the reference image. + * This should be one of "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1" or "general-v1". The legacy categories "homegoods", + * "apparel", and "toys" are still supported, but these should not be used for + * new products. + * + * Generated from protobuf field string product_category = 4 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setProductCategory($var) + { + GPBUtil::checkString($var, True); + $this->product_category = $var; + + return $this; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductLabels() + { + return $this->product_labels; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 500 product_labels. + * Notice that the total number of distinct product_labels over all products + * in one ProductSet cannot exceed 1M, otherwise the product search pipeline + * will refuse to work for that ProductSet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @param array<\Google\Cloud\Vision\V1\Product\KeyValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product\KeyValue::class); + $this->product_labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product/KeyValue.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product/KeyValue.php new file mode 100644 index 00000000000..6f977cac6d1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Product/KeyValue.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.Product.KeyValue + */ +class KeyValue extends \Google\Protobuf\Internal\Message +{ + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * @type string $value + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(KeyValue::class, \Google\Cloud\Vision\V1\Product_KeyValue::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchParams.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchParams.php new file mode 100644 index 00000000000..315a68ba9bc --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchParams.php @@ -0,0 +1,243 @@ +google.cloud.vision.v1.ProductSearchParams + */ +class ProductSearchParams extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + */ + protected $bounding_poly = null; + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to + * be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + */ + protected $product_set = ''; + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + */ + private $product_categories; + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + */ + protected $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * @type string $product_set + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to + * be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * @type array|\Google\Protobuf\Internal\RepeatedField $product_categories + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * @type string $filter + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the area of interest in the image. + * If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to + * be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getProductSet() + { + return $this->product_set; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to + * be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkString($var, True); + $this->product_set = $var; + + return $this; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductCategories() + { + return $this->product_categories; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", + * "packagedgoods-v1", or "general-v1" should be specified. The legacy + * categories "homegoods", "apparel", and "toys" are still supported but will + * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", + * or "toys-v2" for better product search accuracy. It is recommended to + * migrate existing products to these categories as well. + * + * Generated from protobuf field repeated string product_categories = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_categories = $arr; + + return $this; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. An + * '=' should be used to connect the key and value. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but "(color = red OR brand = Google)" is not acceptable. + * "color: red" is not acceptable because it uses a ':' instead of an '='. + * + * Generated from protobuf field string filter = 8; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults.php new file mode 100644 index 00000000000..44d025f0d72 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults.php @@ -0,0 +1,165 @@ +google.cloud.vision.v1.ProductSearchResults + */ +class ProductSearchResults extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + */ + protected $index_time = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + */ + private $results; + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + */ + private $product_grouped_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $index_time + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * @type array<\Google\Cloud\Vision\V1\ProductSearchResults\Result>|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * @type array<\Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult>|\Google\Protobuf\Internal\RepeatedField $product_grouped_results + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getIndexTime() + { + return $this->index_time; + } + + public function hasIndexTime() + { + return isset($this->index_time); + } + + public function clearIndexTime() + { + unset($this->index_time); + } + + /** + * Timestamp of the index which provided these results. Products added to the + * product set and products removed from the product set after this time are + * not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @param array<\Google\Cloud\Vision\V1\ProductSearchResults\Result>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductGroupedResults() + { + return $this->product_grouped_results; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @param array<\Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductGroupedResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult::class); + $this->product_grouped_results = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/GroupedResult.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/GroupedResult.php new file mode 100644 index 00000000000..9066aef0cfd --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/GroupedResult.php @@ -0,0 +1,149 @@ +google.cloud.vision.v1.ProductSearchResults.GroupedResult + */ +class GroupedResult extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + protected $bounding_poly = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + */ + private $results; + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + */ + private $object_annotations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the product detected in the query image. + * @type array<\Google\Cloud\Vision\V1\ProductSearchResults\Result>|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * @type array<\Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation>|\Google\Protobuf\Internal\RepeatedField $object_annotations + * List of generic predictions for the object in the bounding box. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @param array<\Google\Cloud\Vision\V1\ProductSearchResults\Result>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getObjectAnnotations() + { + return $this->object_annotations; + } + + /** + * List of generic predictions for the object in the bounding box. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation object_annotations = 3; + * @param array<\Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setObjectAnnotations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\ObjectAnnotation::class); + $this->object_annotations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GroupedResult::class, \Google\Cloud\Vision\V1\ProductSearchResults_GroupedResult::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/ObjectAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/ObjectAnnotation.php new file mode 100644 index 00000000000..a8005c3f6b3 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/ObjectAnnotation.php @@ -0,0 +1,180 @@ +google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation + */ +class ObjectAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + */ + protected $mid = ''; + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + */ + protected $name = ''; + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + */ + protected $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mid + * Object ID that should align with EntityAnnotation mid. + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type string $name + * Object name, expressed in its `language_code` language. + * @type float $score + * Score of the result. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @return string + */ + public function getMid() + { + return $this->mid; + } + + /** + * Object ID that should align with EntityAnnotation mid. + * + * Generated from protobuf field string mid = 1; + * @param string $var + * @return $this + */ + public function setMid($var) + { + GPBUtil::checkString($var, True); + $this->mid = $var; + + return $this; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Object name, expressed in its `language_code` language. + * + * Generated from protobuf field string name = 3; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Score of the result. Range [0, 1]. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ObjectAnnotation::class, \Google\Cloud\Vision\V1\ProductSearchResults_ObjectAnnotation::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/Result.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/Result.php new file mode 100644 index 00000000000..4fa9d2e05b6 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSearchResults/Result.php @@ -0,0 +1,156 @@ +google.cloud.vision.v1.ProductSearchResults.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + */ + protected $product = null; + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + */ + protected $score = 0.0; + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + */ + protected $image = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * The Product. + * @type float $score + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * @type string $image + * The resource name of the image from the product that is the closest match + * to the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @param string $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkString($var, True); + $this->image = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Result::class, \Google\Cloud\Vision\V1\ProductSearchResults_Result::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSet.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSet.php new file mode 100644 index 00000000000..fae1466b47f --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSet.php @@ -0,0 +1,231 @@ +google.cloud.vision.v1.ProductSet + */ +class ProductSet extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $index_time = null; + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $index_error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * @type string $display_name + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * @type \Google\Protobuf\Timestamp $index_time + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * @type \Google\Rpc\Status $index_error + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getIndexTime() + { + return $this->index_time; + } + + public function hasIndexTime() + { + return isset($this->index_time); + } + + public function clearIndexTime() + { + unset($this->index_time); + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this timestamp is the default value + * "1970-01-01T00:00:00Z". + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getIndexError() + { + return $this->index_error; + } + + public function hasIndexError() + { + return isset($this->index_error); + } + + public function clearIndexError() + { + unset($this->index_error); + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setIndexError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->index_error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSetPurgeConfig.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSetPurgeConfig.php new file mode 100644 index 00000000000..b433c625acb --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ProductSetPurgeConfig.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.ProductSetPurgeConfig + */ +class ProductSetPurgeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + */ + protected $product_set_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $product_set_id + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + * @return string + */ + public function getProductSetId() + { + return $this->product_set_id; + } + + /** + * The ProductSet that contains the Products to delete. If a Product is a + * member of product_set_id in addition to other ProductSets, the Product will + * still be deleted. + * + * Generated from protobuf field string product_set_id = 1; + * @param string $var + * @return $this + */ + public function setProductSetId($var) + { + GPBUtil::checkString($var, True); + $this->product_set_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Property.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Property.php new file mode 100644 index 00000000000..3fb9058b77b --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Property.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.Property + */ +class Property extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + */ + protected $uint64_value = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the property. + * @type string $value + * Value of the property. + * @type int|string $uint64_value + * Value of numeric properties. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the property. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Value of the property. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + * @return int|string + */ + public function getUint64Value() + { + return $this->uint64_value; + } + + /** + * Value of numeric properties. + * + * Generated from protobuf field uint64 uint64_value = 3; + * @param int|string $var + * @return $this + */ + public function setUint64Value($var) + { + GPBUtil::checkUint64($var); + $this->uint64_value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/PurgeProductsRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/PurgeProductsRequest.php new file mode 100644 index 00000000000..9633606d667 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/PurgeProductsRequest.php @@ -0,0 +1,203 @@ +google.cloud.vision.v1.PurgeProductsRequest + */ +class PurgeProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + */ + protected $force = false; + protected $target; + + /** + * @param string $parent Required. The project and location in which the Products should be deleted. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. Please see + * {@see ProductSearchClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\PurgeProductsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSetPurgeConfig $product_set_purge_config + * Specify which ProductSet contains the Products to be deleted. + * @type bool $delete_orphan_products + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @type string $parent + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type bool $force + * The default value is false. Override this value to true to actually perform + * the purge. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Specify which ProductSet contains the Products to be deleted. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSetPurgeConfig product_set_purge_config = 2; + * @return \Google\Cloud\Vision\V1\ProductSetPurgeConfig|null + */ + public function getProductSetPurgeConfig() + { + return $this->readOneof(2); + } + + public function hasProductSetPurgeConfig() + { + return $this->hasOneof(2); + } + + /** + * Specify which ProductSet contains the Products to be deleted. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSetPurgeConfig product_set_purge_config = 2; + * @param \Google\Cloud\Vision\V1\ProductSetPurgeConfig $var + * @return $this + */ + public function setProductSetPurgeConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSetPurgeConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * + * Generated from protobuf field bool delete_orphan_products = 3; + * @return bool + */ + public function getDeleteOrphanProducts() + { + return $this->readOneof(3); + } + + public function hasDeleteOrphanProducts() + { + return $this->hasOneof(3); + } + + /** + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * + * Generated from protobuf field bool delete_orphan_products = 3; + * @param bool $var + * @return $this + */ + public function setDeleteOrphanProducts($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location in which the Products should be deleted. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * The default value is false. Override this value to true to actually perform + * the purge. + * + * Generated from protobuf field bool force = 4; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ReferenceImage.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ReferenceImage.php new file mode 100644 index 00000000000..a4371a4149d --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/ReferenceImage.php @@ -0,0 +1,176 @@ +google.cloud.vision.v1.ReferenceImage + */ +class ReferenceImage extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + /** + * Optional. Bounding polygons around the areas of interest in the reference + * image. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $bounding_polys; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * @type string $uri + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * @type array<\Google\Cloud\Vision\V1\BoundingPoly>|\Google\Protobuf\Internal\RepeatedField $bounding_polys + * Optional. Bounding polygons around the areas of interest in the reference + * image. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * + * Generated from protobuf field string uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Optional. Bounding polygons around the areas of interest in the reference + * image. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBoundingPolys() + { + return $this->bounding_polys; + } + + /** + * Optional. Bounding polygons around the areas of interest in the reference + * image. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Vision\V1\BoundingPoly>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBoundingPolys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_polys = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/RemoveProductFromProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/RemoveProductFromProductSetRequest.php new file mode 100644 index 00000000000..344af637ba5 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/RemoveProductFromProductSetRequest.php @@ -0,0 +1,145 @@ +google.cloud.vision.v1.RemoveProductFromProductSetRequest + */ +class RemoveProductFromProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The resource name for the Product to be removed from this + * ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $product = ''; + + /** + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * Please see {@see ProductSearchClient::productSetName()} for help formatting this field. + * @param string $product Required. The resource name for the Product to be removed from this + * ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * Please see {@see ProductSearchClient::productName()} for help formatting this field. + * + * @return \Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest + * + * @experimental + */ + public static function build(string $name, string $product): self + { + return (new self()) + ->setName($name) + ->setProduct($product); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * Required. The resource name for the Product to be removed from this + * ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The resource name for the Product to be removed from this + * ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * Required. The resource name for the Product to be removed from this + * ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/SafeSearchAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/SafeSearchAnnotation.php new file mode 100644 index 00000000000..58c2b95955e --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/SafeSearchAnnotation.php @@ -0,0 +1,241 @@ +google.cloud.vision.v1.SafeSearchAnnotation + */ +class SafeSearchAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + */ + protected $adult = 0; + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + */ + protected $spoof = 0; + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + */ + protected $medical = 0; + /** + * Likelihood that this image contains violent content. Violent content may + * include death, serious harm, or injury to individuals or groups of + * individuals. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + */ + protected $violence = 0; + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + */ + protected $racy = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $adult + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * @type int $spoof + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * @type int $medical + * Likelihood that this is a medical image. + * @type int $violence + * Likelihood that this image contains violent content. Violent content may + * include death, serious harm, or injury to individuals or groups of + * individuals. + * @type int $racy + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + * @return int + */ + public function getAdult() + { + return $this->adult; + } + + /** + * Represents the adult content likelihood for the image. Adult content may + * contain elements such as nudity, pornographic images or cartoons, or + * sexual activities. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood adult = 1; + * @param int $var + * @return $this + */ + public function setAdult($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->adult = $var; + + return $this; + } + + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + * @return int + */ + public function getSpoof() + { + return $this->spoof; + } + + /** + * Spoof likelihood. The likelihood that an modification + * was made to the image's canonical version to make it appear + * funny or offensive. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood spoof = 2; + * @param int $var + * @return $this + */ + public function setSpoof($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->spoof = $var; + + return $this; + } + + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + * @return int + */ + public function getMedical() + { + return $this->medical; + } + + /** + * Likelihood that this is a medical image. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood medical = 3; + * @param int $var + * @return $this + */ + public function setMedical($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->medical = $var; + + return $this; + } + + /** + * Likelihood that this image contains violent content. Violent content may + * include death, serious harm, or injury to individuals or groups of + * individuals. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + * @return int + */ + public function getViolence() + { + return $this->violence; + } + + /** + * Likelihood that this image contains violent content. Violent content may + * include death, serious harm, or injury to individuals or groups of + * individuals. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood violence = 4; + * @param int $var + * @return $this + */ + public function setViolence($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->violence = $var; + + return $this; + } + + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + * @return int + */ + public function getRacy() + { + return $this->racy; + } + + /** + * Likelihood that the request image contains racy content. Racy content may + * include (but is not limited to) skimpy or sheer clothing, strategically + * covered nudity, lewd or provocative poses, or close-ups of sensitive + * body areas. + * + * Generated from protobuf field .google.cloud.vision.v1.Likelihood racy = 9; + * @param int $var + * @return $this + */ + public function setRacy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\Likelihood::class); + $this->racy = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Symbol.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Symbol.php new file mode 100644 index 00000000000..4fe27114775 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Symbol.php @@ -0,0 +1,245 @@ +google.cloud.vision.v1.Symbol + */ +class Symbol extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + protected $property = null; + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + protected $bounding_box = null; + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + */ + protected $text = ''; + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the symbol. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type string $text + * The actual UTF-8 representation of the symbol. + * @type float $confidence + * Confidence of the OCR results for the symbol. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the symbol. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the symbol. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * The actual UTF-8 representation of the symbol. + * + * Generated from protobuf field string text = 3; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the symbol. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation.php new file mode 100644 index 00000000000..e736837aaee --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation.php @@ -0,0 +1,108 @@ + Page -> Block -> Paragraph -> Word -> Symbol + * Each structural component, starting from Page, may further have their own + * properties. Properties describe detected languages, breaks etc.. Please refer + * to the + * [TextAnnotation.TextProperty][google.cloud.vision.v1.TextAnnotation.TextProperty] + * message definition below for more detail. + * + * Generated from protobuf message google.cloud.vision.v1.TextAnnotation + */ +class TextAnnotation extends \Google\Protobuf\Internal\Message +{ + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + */ + private $pages; + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\Page>|\Google\Protobuf\Internal\RepeatedField $pages + * List of pages detected by OCR. + * @type string $text + * UTF-8 text detected on the pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * List of pages detected by OCR. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Page pages = 1; + * @param array<\Google\Cloud\Vision\V1\Page>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Page::class); + $this->pages = $arr; + + return $this; + } + + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * UTF-8 text detected on the pages. + * + * Generated from protobuf field string text = 2; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak.php new file mode 100644 index 00000000000..7844b238708 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak.php @@ -0,0 +1,104 @@ +google.cloud.vision.v1.TextAnnotation.DetectedBreak + */ +class DetectedBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + */ + protected $type = 0; + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + */ + protected $is_prefix = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Detected break type. + * @type bool $is_prefix + * True if break prepends the element. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak\BreakType::class); + $this->type = $var; + + return $this; + } + + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + * @return bool + */ + public function getIsPrefix() + { + return $this->is_prefix; + } + + /** + * True if break prepends the element. + * + * Generated from protobuf field bool is_prefix = 2; + * @param bool $var + * @return $this + */ + public function setIsPrefix($var) + { + GPBUtil::checkBool($var); + $this->is_prefix = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedBreak::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak/BreakType.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak/BreakType.php new file mode 100644 index 00000000000..455626c4854 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedBreak/BreakType.php @@ -0,0 +1,86 @@ +google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType + */ +class BreakType +{ + /** + * Unknown break label type. + * + * Generated from protobuf enum UNKNOWN = 0; + */ + const UNKNOWN = 0; + /** + * Regular space. + * + * Generated from protobuf enum SPACE = 1; + */ + const SPACE = 1; + /** + * Sure space (very wide). + * + * Generated from protobuf enum SURE_SPACE = 2; + */ + const SURE_SPACE = 2; + /** + * Line-wrapping break. + * + * Generated from protobuf enum EOL_SURE_SPACE = 3; + */ + const EOL_SURE_SPACE = 3; + /** + * End-line hyphen that is not present in text; does not co-occur with + * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. + * + * Generated from protobuf enum HYPHEN = 4; + */ + const HYPHEN = 4; + /** + * Line break that ends a paragraph. + * + * Generated from protobuf enum LINE_BREAK = 5; + */ + const LINE_BREAK = 5; + + private static $valueToName = [ + self::UNKNOWN => 'UNKNOWN', + self::SPACE => 'SPACE', + self::SURE_SPACE => 'SURE_SPACE', + self::EOL_SURE_SPACE => 'EOL_SURE_SPACE', + self::HYPHEN => 'HYPHEN', + self::LINE_BREAK => 'LINE_BREAK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BreakType::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedBreak_BreakType::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedLanguage.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedLanguage.php new file mode 100644 index 00000000000..d2c4a762340 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/DetectedLanguage.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.TextAnnotation.DetectedLanguage + */ +class DetectedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * @type float $confidence + * Confidence of detected language. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of detected language. Range [0, 1]. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedLanguage::class, \Google\Cloud\Vision\V1\TextAnnotation_DetectedLanguage::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/TextProperty.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/TextProperty.php new file mode 100644 index 00000000000..3dbed38cafb --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextAnnotation/TextProperty.php @@ -0,0 +1,114 @@ +google.cloud.vision.v1.TextAnnotation.TextProperty + */ +class TextProperty extends \Google\Protobuf\Internal\Message +{ + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + */ + private $detected_languages; + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + */ + protected $detected_break = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak $detected_break + * Detected start or end of a text segment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.TextAnnotation.DetectedLanguage detected_languages = 1; + * @param array<\Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\TextAnnotation\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + * @return \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak|null + */ + public function getDetectedBreak() + { + return $this->detected_break; + } + + public function hasDetectedBreak() + { + return isset($this->detected_break); + } + + public function clearDetectedBreak() + { + unset($this->detected_break); + } + + /** + * Detected start or end of a text segment. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.DetectedBreak detected_break = 2; + * @param \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak $var + * @return $this + */ + public function setDetectedBreak($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\DetectedBreak::class); + $this->detected_break = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextProperty::class, \Google\Cloud\Vision\V1\TextAnnotation_TextProperty::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextDetectionParams.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextDetectionParams.php new file mode 100644 index 00000000000..b61fb377a09 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/TextDetectionParams.php @@ -0,0 +1,130 @@ +google.cloud.vision.v1.TextDetectionParams + */ +class TextDetectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + */ + protected $enable_text_detection_confidence_score = false; + /** + * A list of advanced OCR options to further fine-tune OCR behavior. + * Current valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 11; + */ + private $advanced_ocr_options; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_text_detection_confidence_score + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * @type array|\Google\Protobuf\Internal\RepeatedField $advanced_ocr_options + * A list of advanced OCR options to further fine-tune OCR behavior. + * Current valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + * @return bool + */ + public function getEnableTextDetectionConfidenceScore() + { + return $this->enable_text_detection_confidence_score; + } + + /** + * By default, Cloud Vision API only includes confidence score for + * DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence + * score for TEXT_DETECTION as well. + * + * Generated from protobuf field bool enable_text_detection_confidence_score = 9; + * @param bool $var + * @return $this + */ + public function setEnableTextDetectionConfidenceScore($var) + { + GPBUtil::checkBool($var); + $this->enable_text_detection_confidence_score = $var; + + return $this; + } + + /** + * A list of advanced OCR options to further fine-tune OCR behavior. + * Current valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdvancedOcrOptions() + { + return $this->advanced_ocr_options; + } + + /** + * A list of advanced OCR options to further fine-tune OCR behavior. + * Current valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 11; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdvancedOcrOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->advanced_ocr_options = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductRequest.php new file mode 100644 index 00000000000..91ab72f3f77 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductRequest.php @@ -0,0 +1,161 @@ +google.cloud.vision.v1.UpdateProductRequest + */ +class UpdateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Vision\V1\Product $product Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param \Google\Protobuf\FieldMask $updateMask The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * @return \Google\Cloud\Vision\V1\UpdateProductRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Vision\V1\Product $product, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setProduct($product) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\Product|null + */ + public function getProduct() + { + return $this->product; + } + + public function hasProduct() + { + return isset($this->product); + } + + public function clearProduct() + { + unset($this->product); + } + + /** + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductSetRequest.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductSetRequest.php new file mode 100644 index 00000000000..f3efd0e6405 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/UpdateProductSetRequest.php @@ -0,0 +1,151 @@ +google.cloud.vision.v1.UpdateProductSetRequest + */ +class UpdateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product_set = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Vision\V1\ProductSet $productSet Required. The ProductSet resource which replaces the one on the server. + * @param \Google\Protobuf\FieldMask $updateMask The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * @return \Google\Cloud\Vision\V1\UpdateProductSetRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Vision\V1\ProductSet $productSet, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setProductSet($productSet) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * Required. The ProductSet resource which replaces the one on the server. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Vision\V1\ProductSet|null + */ + public function getProductSet() + { + return $this->product_set; + } + + public function hasProductSet() + { + return isset($this->product_set); + } + + public function clearProductSet() + { + unset($this->product_set); + } + + /** + * Required. The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Vertex.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Vertex.php new file mode 100644 index 00000000000..2944b434c7a --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Vertex.php @@ -0,0 +1,102 @@ +google.cloud.vision.v1.Vertex + */ +class Vertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + */ + protected $x = 0; + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + */ + protected $y = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $x + * X coordinate. + * @type int $y + * Y coordinate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @return int + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @param int $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkInt32($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + * @return int + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate. + * + * Generated from protobuf field int32 y = 2; + * @param int $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkInt32($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection.php new file mode 100644 index 00000000000..7210409bd47 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection.php @@ -0,0 +1,253 @@ +google.cloud.vision.v1.WebDetection + */ +class WebDetection extends \Google\Protobuf\Internal\Message +{ + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + */ + private $web_entities; + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + */ + private $full_matching_images; + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + */ + private $partial_matching_images; + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + */ + private $pages_with_matching_images; + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + */ + private $visually_similar_images; + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + */ + private $best_guess_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebEntity>|\Google\Protobuf\Internal\RepeatedField $web_entities + * Deduced entities from similar images on the Internet. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $full_matching_images + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $partial_matching_images + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebPage>|\Google\Protobuf\Internal\RepeatedField $pages_with_matching_images + * Web pages containing the matching images from the Internet. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $visually_similar_images + * The visually similar image results. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebLabel>|\Google\Protobuf\Internal\RepeatedField $best_guess_labels + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebEntities() + { + return $this->web_entities; + } + + /** + * Deduced entities from similar images on the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebEntity web_entities = 1; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebEntity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebEntity::class); + $this->web_entities = $arr; + + return $this; + } + + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFullMatchingImages() + { + return $this->full_matching_images; + } + + /** + * Fully matching images from the Internet. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 2; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFullMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->full_matching_images = $arr; + + return $this; + } + + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartialMatchingImages() + { + return $this->partial_matching_images; + } + + /** + * Partial matching images from the Internet. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 3; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartialMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->partial_matching_images = $arr; + + return $this; + } + + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPagesWithMatchingImages() + { + return $this->pages_with_matching_images; + } + + /** + * Web pages containing the matching images from the Internet. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebPage pages_with_matching_images = 4; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebPage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPagesWithMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebPage::class); + $this->pages_with_matching_images = $arr; + + return $this; + } + + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisuallySimilarImages() + { + return $this->visually_similar_images; + } + + /** + * The visually similar image results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage visually_similar_images = 6; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisuallySimilarImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->visually_similar_images = $arr; + + return $this; + } + + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBestGuessLabels() + { + return $this->best_guess_labels; + } + + /** + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebLabel>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBestGuessLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebLabel::class); + $this->best_guess_labels = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebEntity.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebEntity.php new file mode 100644 index 00000000000..7ed5190c950 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebEntity.php @@ -0,0 +1,142 @@ +google.cloud.vision.v1.WebDetection.WebEntity + */ +class WebEntity extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + */ + protected $entity_id = ''; + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + */ + protected $score = 0.0; + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $entity_id + * Opaque entity ID. + * @type float $score + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * @type string $description + * Canonical description of the entity, in English. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + * @return string + */ + public function getEntityId() + { + return $this->entity_id; + } + + /** + * Opaque entity ID. + * + * Generated from protobuf field string entity_id = 1; + * @param string $var + * @return $this + */ + public function setEntityId($var) + { + GPBUtil::checkString($var, True); + $this->entity_id = $var; + + return $this; + } + + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Overall relevancy score for the entity. + * Not normalized and not comparable across different image queries. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Canonical description of the entity, in English. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebEntity::class, \Google\Cloud\Vision\V1\WebDetection_WebEntity::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebImage.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebImage.php new file mode 100644 index 00000000000..0a74c6f6392 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebImage.php @@ -0,0 +1,104 @@ +google.cloud.vision.v1.WebDetection.WebImage + */ +class WebImage extends \Google\Protobuf\Internal\Message +{ + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + */ + protected $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The result image URL. + * @type float $score + * (Deprecated) Overall relevancy score for the image. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The result image URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * (Deprecated) Overall relevancy score for the image. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebImage::class, \Google\Cloud\Vision\V1\WebDetection_WebImage::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebLabel.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebLabel.php new file mode 100644 index 00000000000..455b38bf8f9 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebLabel.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.WebDetection.WebLabel + */ +class WebLabel extends \Google\Protobuf\Internal\Message +{ + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + */ + protected $label = ''; + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $label + * Label for extra metadata. + * @type string $language_code + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Label for extra metadata. + * + * Generated from protobuf field string label = 1; + * @param string $var + * @return $this + */ + public function setLabel($var) + { + GPBUtil::checkString($var, True); + $this->label = $var; + + return $this; + } + + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". + * For more information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebLabel::class, \Google\Cloud\Vision\V1\WebDetection_WebLabel::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebPage.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebPage.php new file mode 100644 index 00000000000..a7ebc342245 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetection/WebPage.php @@ -0,0 +1,222 @@ +google.cloud.vision.v1.WebDetection.WebPage + */ +class WebPage extends \Google\Protobuf\Internal\Message +{ + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + */ + protected $url = ''; + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + */ + protected $score = 0.0; + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + */ + protected $page_title = ''; + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + */ + private $full_matching_images; + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + */ + private $partial_matching_images; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $url + * The result web page URL. + * @type float $score + * (Deprecated) Overall relevancy score for the web page. + * @type string $page_title + * Title for the web page, may contain HTML markups. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $full_matching_images + * Fully matching images on the page. + * Can include resized copies of the query image. + * @type array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $partial_matching_images + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); + parent::__construct($data); + } + + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The result web page URL. + * + * Generated from protobuf field string url = 1; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * (Deprecated) Overall relevancy score for the web page. + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + * @return string + */ + public function getPageTitle() + { + return $this->page_title; + } + + /** + * Title for the web page, may contain HTML markups. + * + * Generated from protobuf field string page_title = 3; + * @param string $var + * @return $this + */ + public function setPageTitle($var) + { + GPBUtil::checkString($var, True); + $this->page_title = $var; + + return $this; + } + + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFullMatchingImages() + { + return $this->full_matching_images; + } + + /** + * Fully matching images on the page. + * Can include resized copies of the query image. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage full_matching_images = 4; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFullMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->full_matching_images = $arr; + + return $this; + } + + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartialMatchingImages() + { + return $this->partial_matching_images; + } + + /** + * Partial matching images on the page. + * Those images are similar enough to share some key-point features. For + * example an original image will likely have partial matching for its + * crops. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebImage partial_matching_images = 5; + * @param array<\Google\Cloud\Vision\V1\WebDetection\WebImage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartialMatchingImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\WebDetection\WebImage::class); + $this->partial_matching_images = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WebPage::class, \Google\Cloud\Vision\V1\WebDetection_WebPage::class); + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetectionParams.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetectionParams.php new file mode 100644 index 00000000000..2a5e2e544fa --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/WebDetectionParams.php @@ -0,0 +1,72 @@ +google.cloud.vision.v1.WebDetectionParams + */ +class WebDetectionParams extends \Google\Protobuf\Internal\Message +{ + /** + * This field has no effect on results. + * + * Generated from protobuf field bool include_geo_results = 2 [deprecated = true]; + * @deprecated + */ + protected $include_geo_results = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $include_geo_results + * This field has no effect on results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ImageAnnotator::initOnce(); + parent::__construct($data); + } + + /** + * This field has no effect on results. + * + * Generated from protobuf field bool include_geo_results = 2 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getIncludeGeoResults() + { + @trigger_error('include_geo_results is deprecated.', E_USER_DEPRECATED); + return $this->include_geo_results; + } + + /** + * This field has no effect on results. + * + * Generated from protobuf field bool include_geo_results = 2 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setIncludeGeoResults($var) + { + @trigger_error('include_geo_results is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->include_geo_results = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Word.php b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Word.php new file mode 100644 index 00000000000..e753e377256 --- /dev/null +++ b/owl-bot-staging/Vision/V1/proto/src/Google/Cloud/Vision/V1/Word.php @@ -0,0 +1,249 @@ +google.cloud.vision.v1.Word + */ +class Word extends \Google\Protobuf\Internal\Message +{ + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + */ + protected $property = null; + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + */ + protected $bounding_box = null; + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + */ + private $symbols; + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $property + * Additional information detected for the word. + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_box + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * @type array<\Google\Cloud\Vision\V1\Symbol>|\Google\Protobuf\Internal\RepeatedField $symbols + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * @type float $confidence + * Confidence of the OCR results for the word. Range [0, 1]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); + parent::__construct($data); + } + + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @return \Google\Cloud\Vision\V1\TextAnnotation\TextProperty|null + */ + public function getProperty() + { + return $this->property; + } + + public function hasProperty() + { + return isset($this->property); + } + + public function clearProperty() + { + unset($this->property); + } + + /** + * Additional information detected for the word. + * + * Generated from protobuf field .google.cloud.vision.v1.TextAnnotation.TextProperty property = 1; + * @param \Google\Cloud\Vision\V1\TextAnnotation\TextProperty $var + * @return $this + */ + public function setProperty($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\TextAnnotation\TextProperty::class); + $this->property = $var; + + return $this; + } + + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @return \Google\Cloud\Vision\V1\BoundingPoly|null + */ + public function getBoundingBox() + { + return $this->bounding_box; + } + + public function hasBoundingBox() + { + return isset($this->bounding_box); + } + + public function clearBoundingBox() + { + unset($this->bounding_box); + } + + /** + * The bounding box for the word. + * The vertices are in the order of top-left, top-right, bottom-right, + * bottom-left. When a rotation of the bounding box is detected the rotation + * is represented as around the top-left corner as defined when the text is + * read in the 'natural' orientation. + * For example: + * * when the text is horizontal it might look like: + * 0----1 + * | | + * 3----2 + * * when it's rotated 180 degrees around the top-left corner it becomes: + * 2----3 + * | | + * 1----0 + * and the vertex order will still be (0, 1, 2, 3). + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_box = 2; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingBox($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_box = $var; + + return $this; + } + + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSymbols() + { + return $this->symbols; + } + + /** + * List of symbols in the word. + * The order of the symbols follows the natural reading order. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Symbol symbols = 3; + * @param array<\Google\Cloud\Vision\V1\Symbol>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSymbols($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Symbol::class); + $this->symbols = $arr; + + return $this; + } + + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the OCR results for the word. Range [0, 1]. + * + * Generated from protobuf field float confidence = 4; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_files.php b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_files.php new file mode 100644 index 00000000000..cc350ef5096 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_files.php @@ -0,0 +1,77 @@ +setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $imageAnnotatorClient->asyncBatchAnnotateFiles($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AsyncBatchAnnotateFilesResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_images.php b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_images.php new file mode 100644 index 00000000000..795d3b5d4c7 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/async_batch_annotate_images.php @@ -0,0 +1,83 @@ +setRequests($requests) + ->setOutputConfig($outputConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $imageAnnotatorClient->asyncBatchAnnotateImages($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AsyncBatchAnnotateImagesResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_files.php b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_files.php new file mode 100644 index 00000000000..255a714c1c0 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_files.php @@ -0,0 +1,66 @@ +setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BatchAnnotateFilesResponse $response */ + $response = $imageAnnotatorClient->batchAnnotateFiles($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_images.php b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_images.php new file mode 100644 index 00000000000..8dea45dcd8f --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ImageAnnotatorClient/batch_annotate_images.php @@ -0,0 +1,60 @@ +setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BatchAnnotateImagesResponse $response */ + $response = $imageAnnotatorClient->batchAnnotateImages($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ImageAnnotator_BatchAnnotateImages_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/add_product_to_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/add_product_to_product_set.php new file mode 100644 index 00000000000..3cadb7c9f92 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/add_product_to_product_set.php @@ -0,0 +1,86 @@ +setName($formattedName) + ->setProduct($formattedProduct); + + // Call the API and handle any network failures. + try { + $productSearchClient->addProductToProductSet($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + add_product_to_product_set_sample($formattedName, $formattedProduct); +} +// [END vision_v1_generated_ProductSearch_AddProductToProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product.php new file mode 100644 index 00000000000..c169d9bae9f --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product.php @@ -0,0 +1,83 @@ +setParent($formattedParent) + ->setProduct($product); + + // Call the API and handle any network failures. + try { + /** @var Product $response */ + $response = $productSearchClient->createProduct($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + create_product_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_CreateProduct_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product_set.php new file mode 100644 index 00000000000..640ec3e9e39 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_product_set.php @@ -0,0 +1,80 @@ +setParent($formattedParent) + ->setProductSet($productSet); + + // Call the API and handle any network failures. + try { + /** @var ProductSet $response */ + $response = $productSearchClient->createProductSet($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + create_product_set_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_CreateProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_reference_image.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_reference_image.php new file mode 100644 index 00000000000..a000c147b7d --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/create_reference_image.php @@ -0,0 +1,100 @@ +setUri($referenceImageUri); + $request = (new CreateReferenceImageRequest()) + ->setParent($formattedParent) + ->setReferenceImage($referenceImage); + + // Call the API and handle any network failures. + try { + /** @var ReferenceImage $response */ + $response = $productSearchClient->createReferenceImage($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImageUri = '[URI]'; + + create_reference_image_sample($formattedParent, $referenceImageUri); +} +// [END vision_v1_generated_ProductSearch_CreateReferenceImage_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product.php new file mode 100644 index 00000000000..4db20989da5 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $productSearchClient->deleteProduct($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + delete_product_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_DeleteProduct_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product_set.php new file mode 100644 index 00000000000..915bf3a2a3d --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_product_set.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $productSearchClient->deleteProductSet($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + delete_product_set_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_DeleteProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_reference_image.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_reference_image.php new file mode 100644 index 00000000000..84323a70e32 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/delete_reference_image.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $productSearchClient->deleteReferenceImage($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::referenceImageName( + '[PROJECT]', + '[LOCATION]', + '[PRODUCT]', + '[REFERENCE_IMAGE]' + ); + + delete_reference_image_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_DeleteReferenceImage_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product.php new file mode 100644 index 00000000000..d2c9ed4c5bb --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Product $response */ + $response = $productSearchClient->getProduct($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + get_product_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_GetProduct_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product_set.php new file mode 100644 index 00000000000..67fc8cd72f3 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_product_set.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ProductSet $response */ + $response = $productSearchClient->getProductSet($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + get_product_set_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_GetProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_reference_image.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_reference_image.php new file mode 100644 index 00000000000..74864ce1835 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/get_reference_image.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ReferenceImage $response */ + $response = $productSearchClient->getReferenceImage($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::referenceImageName( + '[PROJECT]', + '[LOCATION]', + '[PRODUCT]', + '[REFERENCE_IMAGE]' + ); + + get_reference_image_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_GetReferenceImage_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/import_product_sets.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/import_product_sets.php new file mode 100644 index 00000000000..d1d8d3a970e --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/import_product_sets.php @@ -0,0 +1,98 @@ +setParent($formattedParent) + ->setInputConfig($inputConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $productSearchClient->importProductSets($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ImportProductSetsResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + import_product_sets_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_ImportProductSets_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_product_sets.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_product_sets.php new file mode 100644 index 00000000000..b1b5b0c77e4 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_product_sets.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $productSearchClient->listProductSets($request); + + /** @var ProductSet $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + list_product_sets_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_ListProductSets_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products.php new file mode 100644 index 00000000000..1591a71fb9c --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $productSearchClient->listProducts($request); + + /** @var Product $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + list_products_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_ListProducts_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products_in_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products_in_product_set.php new file mode 100644 index 00000000000..47fd49c66d4 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_products_in_product_set.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $productSearchClient->listProductsInProductSet($request); + + /** @var Product $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + list_products_in_product_set_sample($formattedName); +} +// [END vision_v1_generated_ProductSearch_ListProductsInProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_reference_images.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_reference_images.php new file mode 100644 index 00000000000..4208bed59fe --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/list_reference_images.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $productSearchClient->listReferenceImages($request); + + /** @var ReferenceImage $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + list_reference_images_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_ListReferenceImages_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/purge_products.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/purge_products.php new file mode 100644 index 00000000000..5fe86aa1254 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/purge_products.php @@ -0,0 +1,105 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $productSearchClient->purgeProducts($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductSearchClient::locationName('[PROJECT]', '[LOCATION]'); + + purge_products_sample($formattedParent); +} +// [END vision_v1_generated_ProductSearch_PurgeProducts_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/remove_product_from_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/remove_product_from_product_set.php new file mode 100644 index 00000000000..f3e8cf70136 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/remove_product_from_product_set.php @@ -0,0 +1,82 @@ +setName($formattedName) + ->setProduct($formattedProduct); + + // Call the API and handle any network failures. + try { + $productSearchClient->removeProductFromProductSet($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductSearchClient::productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = ProductSearchClient::productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + remove_product_from_product_set_sample($formattedName, $formattedProduct); +} +// [END vision_v1_generated_ProductSearch_RemoveProductFromProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product.php new file mode 100644 index 00000000000..7e599bb3ff3 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product.php @@ -0,0 +1,73 @@ +setProduct($product); + + // Call the API and handle any network failures. + try { + /** @var Product $response */ + $response = $productSearchClient->updateProduct($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ProductSearch_UpdateProduct_sync] diff --git a/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product_set.php b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product_set.php new file mode 100644 index 00000000000..9b97120e858 --- /dev/null +++ b/owl-bot-staging/Vision/V1/samples/V1/ProductSearchClient/update_product_set.php @@ -0,0 +1,66 @@ +setProductSet($productSet); + + // Call the API and handle any network failures. + try { + /** @var ProductSet $response */ + $response = $productSearchClient->updateProductSet($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vision_v1_generated_ProductSearch_UpdateProductSet_sync] diff --git a/owl-bot-staging/Vision/V1/src/V1/Client/ImageAnnotatorClient.php b/owl-bot-staging/Vision/V1/src/V1/Client/ImageAnnotatorClient.php new file mode 100644 index 00000000000..63981c507c1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/Client/ImageAnnotatorClient.php @@ -0,0 +1,387 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/image_annotator_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/image_annotator_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/image_annotator_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/image_annotator_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a product_set + * resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + */ + public static function productSetName(string $project, string $location, string $productSet): string + { + return self::getPathTemplate('productSet')->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'vision.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * The async variant is {@see ImageAnnotatorClient::asyncBatchAnnotateFilesAsync()} + * . + * + * @example samples/V1/ImageAnnotatorClient/async_batch_annotate_files.php + * + * @param AsyncBatchAnnotateFilesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function asyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('AsyncBatchAnnotateFiles', $request, $callOptions)->wait(); + } + + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * + * The async variant is + * {@see ImageAnnotatorClient::asyncBatchAnnotateImagesAsync()} . + * + * @example samples/V1/ImageAnnotatorClient/async_batch_annotate_images.php + * + * @param AsyncBatchAnnotateImagesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function asyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('AsyncBatchAnnotateImages', $request, $callOptions)->wait(); + } + + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * + * The async variant is {@see ImageAnnotatorClient::batchAnnotateFilesAsync()} . + * + * @example samples/V1/ImageAnnotatorClient/batch_annotate_files.php + * + * @param BatchAnnotateFilesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 BatchAnnotateFilesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchAnnotateFiles(BatchAnnotateFilesRequest $request, array $callOptions = []): BatchAnnotateFilesResponse + { + return $this->startApiCall('BatchAnnotateFiles', $request, $callOptions)->wait(); + } + + /** + * Run image detection and annotation for a batch of images. + * + * The async variant is {@see ImageAnnotatorClient::batchAnnotateImagesAsync()} . + * + * @example samples/V1/ImageAnnotatorClient/batch_annotate_images.php + * + * @param BatchAnnotateImagesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 BatchAnnotateImagesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchAnnotateImages(BatchAnnotateImagesRequest $request, array $callOptions = []): BatchAnnotateImagesResponse + { + return $this->startApiCall('BatchAnnotateImages', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Vision/V1/src/V1/Client/ProductSearchClient.php b/owl-bot-staging/Vision/V1/src/V1/Client/ProductSearchClient.php new file mode 100644 index 00000000000..39cc936a06f --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/Client/ProductSearchClient.php @@ -0,0 +1,988 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/product_search_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/product_search_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/product_search_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/product_search_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product + * resource. + * + * @param string $project + * @param string $location + * @param string $product + * + * @return string The formatted product resource. + */ + public static function productName(string $project, string $location, string $product): string + { + return self::getPathTemplate('product')->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product_set + * resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + */ + public static function productSetName(string $project, string $location, string $productSet): string + { + return self::getPathTemplate('productSet')->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * reference_image resource. + * + * @param string $project + * @param string $location + * @param string $product + * @param string $referenceImage + * + * @return string The formatted reference_image resource. + */ + public static function referenceImageName(string $project, string $location, string $product, string $referenceImage): string + { + return self::getPathTemplate('referenceImage')->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + 'reference_image' => $referenceImage, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - product: projects/{project}/locations/{location}/products/{product} + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * - referenceImage: projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'vision.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * The async variant is {@see ProductSearchClient::addProductToProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/add_product_to_product_set.php + * + * @param AddProductToProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function addProductToProductSet(AddProductToProductSetRequest $request, array $callOptions = []): void + { + $this->startApiCall('AddProductToProductSet', $request, $callOptions)->wait(); + } + + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * The async variant is {@see ProductSearchClient::createProductAsync()} . + * + * @example samples/V1/ProductSearchClient/create_product.php + * + * @param CreateProductRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Product + * + * @throws ApiException Thrown if the API call fails. + */ + public function createProduct(CreateProductRequest $request, array $callOptions = []): Product + { + return $this->startApiCall('CreateProduct', $request, $callOptions)->wait(); + } + + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * The async variant is {@see ProductSearchClient::createProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/create_product_set.php + * + * @param CreateProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ProductSet + * + * @throws ApiException Thrown if the API call fails. + */ + public function createProductSet(CreateProductSetRequest $request, array $callOptions = []): ProductSet + { + return $this->startApiCall('CreateProductSet', $request, $callOptions)->wait(); + } + + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * The async variant is {@see ProductSearchClient::createReferenceImageAsync()} . + * + * @example samples/V1/ProductSearchClient/create_reference_image.php + * + * @param CreateReferenceImageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ReferenceImage + * + * @throws ApiException Thrown if the API call fails. + */ + public function createReferenceImage(CreateReferenceImageRequest $request, array $callOptions = []): ReferenceImage + { + return $this->startApiCall('CreateReferenceImage', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * The async variant is {@see ProductSearchClient::deleteProductAsync()} . + * + * @example samples/V1/ProductSearchClient/delete_product.php + * + * @param DeleteProductRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteProduct(DeleteProductRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteProduct', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * The async variant is {@see ProductSearchClient::deleteProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/delete_product_set.php + * + * @param DeleteProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteProductSet(DeleteProductSetRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteProductSet', $request, $callOptions)->wait(); + } + + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * The async variant is {@see ProductSearchClient::deleteReferenceImageAsync()} . + * + * @example samples/V1/ProductSearchClient/delete_reference_image.php + * + * @param DeleteReferenceImageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteReferenceImage(DeleteReferenceImageRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteReferenceImage', $request, $callOptions)->wait(); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * The async variant is {@see ProductSearchClient::getProductAsync()} . + * + * @example samples/V1/ProductSearchClient/get_product.php + * + * @param GetProductRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Product + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProduct(GetProductRequest $request, array $callOptions = []): Product + { + return $this->startApiCall('GetProduct', $request, $callOptions)->wait(); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * The async variant is {@see ProductSearchClient::getProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/get_product_set.php + * + * @param GetProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ProductSet + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProductSet(GetProductSetRequest $request, array $callOptions = []): ProductSet + { + return $this->startApiCall('GetProductSet', $request, $callOptions)->wait(); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * The async variant is {@see ProductSearchClient::getReferenceImageAsync()} . + * + * @example samples/V1/ProductSearchClient/get_reference_image.php + * + * @param GetReferenceImageRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ReferenceImage + * + * @throws ApiException Thrown if the API call fails. + */ + public function getReferenceImage(GetReferenceImageRequest $request, array $callOptions = []): ReferenceImage + { + return $this->startApiCall('GetReferenceImage', $request, $callOptions)->wait(); + } + + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * + * The async variant is {@see ProductSearchClient::importProductSetsAsync()} . + * + * @example samples/V1/ProductSearchClient/import_product_sets.php + * + * @param ImportProductSetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function importProductSets(ImportProductSetsRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ImportProductSets', $request, $callOptions)->wait(); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * The async variant is {@see ProductSearchClient::listProductSetsAsync()} . + * + * @example samples/V1/ProductSearchClient/list_product_sets.php + * + * @param ListProductSetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProductSets(ListProductSetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProductSets', $request, $callOptions); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * The async variant is {@see ProductSearchClient::listProductsAsync()} . + * + * @example samples/V1/ProductSearchClient/list_products.php + * + * @param ListProductsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProducts(ListProductsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProducts', $request, $callOptions); + } + + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * The async variant is {@see ProductSearchClient::listProductsInProductSetAsync()} + * . + * + * @example samples/V1/ProductSearchClient/list_products_in_product_set.php + * + * @param ListProductsInProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProductsInProductSet(ListProductsInProductSetRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProductsInProductSet', $request, $callOptions); + } + + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * The async variant is {@see ProductSearchClient::listReferenceImagesAsync()} . + * + * @example samples/V1/ProductSearchClient/list_reference_images.php + * + * @param ListReferenceImagesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listReferenceImages(ListReferenceImagesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListReferenceImages', $request, $callOptions); + } + + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * + * The async variant is {@see ProductSearchClient::purgeProductsAsync()} . + * + * @example samples/V1/ProductSearchClient/purge_products.php + * + * @param PurgeProductsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function purgeProducts(PurgeProductsRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('PurgeProducts', $request, $callOptions)->wait(); + } + + /** + * Removes a Product from the specified ProductSet. + * + * The async variant is + * {@see ProductSearchClient::removeProductFromProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/remove_product_from_product_set.php + * + * @param RemoveProductFromProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function removeProductFromProductSet(RemoveProductFromProductSetRequest $request, array $callOptions = []): void + { + $this->startApiCall('RemoveProductFromProductSet', $request, $callOptions)->wait(); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * The async variant is {@see ProductSearchClient::updateProductAsync()} . + * + * @example samples/V1/ProductSearchClient/update_product.php + * + * @param UpdateProductRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Product + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateProduct(UpdateProductRequest $request, array $callOptions = []): Product + { + return $this->startApiCall('UpdateProduct', $request, $callOptions)->wait(); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * The async variant is {@see ProductSearchClient::updateProductSetAsync()} . + * + * @example samples/V1/ProductSearchClient/update_product_set.php + * + * @param UpdateProductSetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ProductSet + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateProductSet(UpdateProductSetRequest $request, array $callOptions = []): ProductSet + { + return $this->startApiCall('UpdateProductSet', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/Vision/V1/src/V1/Gapic/ImageAnnotatorGapicClient.php b/owl-bot-staging/Vision/V1/src/V1/Gapic/ImageAnnotatorGapicClient.php new file mode 100644 index 00000000000..a7548152ba1 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/Gapic/ImageAnnotatorGapicClient.php @@ -0,0 +1,667 @@ +asyncBatchAnnotateFiles($requests); + * $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 = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateFiles'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Vision\V1\Client\ImageAnnotatorClient}. + */ +class ImageAnnotatorGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.vision.v1.ImageAnnotator'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'vision.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'vision.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', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + + private static $productSetNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/image_annotator_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/image_annotator_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/image_annotator_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/image_annotator_rest_client_config.php', + ], + ], + ]; + } + + private static function getProductSetNameTemplate() + { + if (self::$productSetNameTemplate == null) { + self::$productSetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/productSets/{product_set}'); + } + + return self::$productSetNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'productSet' => self::getProductSetNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a product_set + * resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + */ + public static function productSetName($project, $location, $productSet) + { + return self::getProductSetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'vision.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); + } + + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $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 = $imageAnnotatorClient->asyncBatchAnnotateFiles($requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateFiles'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AsyncAnnotateFileRequest[] $requests Required. Individual async file annotation requests for this batch. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * @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 asyncBatchAnnotateFiles($requests, array $optionalArgs = []) + { + $request = new AsyncBatchAnnotateFilesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('AsyncBatchAnnotateFiles', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $outputConfig = new OutputConfig(); + * $operationResponse = $imageAnnotatorClient->asyncBatchAnnotateImages($requests, $outputConfig); + * $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 = $imageAnnotatorClient->asyncBatchAnnotateImages($requests, $outputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $imageAnnotatorClient->resumeOperation($operationName, 'asyncBatchAnnotateImages'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * @param OutputConfig $outputConfig Required. The desired output location and metadata (e.g. format). + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * @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 asyncBatchAnnotateImages($requests, $outputConfig, array $optionalArgs = []) + { + $request = new AsyncBatchAnnotateImagesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + $request->setOutputConfig($outputConfig); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('AsyncBatchAnnotateImages', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $response = $imageAnnotatorClient->batchAnnotateFiles($requests); + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateFileRequest[] $requests Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * @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\Vision\V1\BatchAnnotateFilesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchAnnotateFiles($requests, array $optionalArgs = []) + { + $request = new BatchAnnotateFilesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchAnnotateFiles', BatchAnnotateFilesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Run image detection and annotation for a batch of images. + * + * Sample code: + * ``` + * $imageAnnotatorClient = new ImageAnnotatorClient(); + * try { + * $requests = []; + * $response = $imageAnnotatorClient->batchAnnotateImages($requests); + * } finally { + * $imageAnnotatorClient->close(); + * } + * ``` + * + * @param AnnotateImageRequest[] $requests Required. Individual image annotation requests for this batch. + * @param array $optionalArgs { + * Optional. + * + * @type string $parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @type array $labels + * Optional. The labels with user-defined metadata for the request. + * + * Label keys and values can be no longer than 63 characters + * (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. + * Label values are optional. Label keys must start with a letter. + * @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\Vision\V1\BatchAnnotateImagesResponse + * + * @throws ApiException if the remote call fails + */ + public function batchAnnotateImages($requests, array $optionalArgs = []) + { + $request = new BatchAnnotateImagesRequest(); + $requestParamHeaders = []; + $request->setRequests($requests); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + $requestParamHeaders['parent'] = $optionalArgs['parent']; + } + + if (isset($optionalArgs['labels'])) { + $request->setLabels($optionalArgs['labels']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchAnnotateImages', BatchAnnotateImagesResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Vision/V1/src/V1/Gapic/ProductSearchGapicClient.php b/owl-bot-staging/Vision/V1/src/V1/Gapic/ProductSearchGapicClient.php new file mode 100644 index 00000000000..07202643245 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/Gapic/ProductSearchGapicClient.php @@ -0,0 +1,1603 @@ +productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->addProductToProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Vision\V1\Client\ProductSearchClient}. + */ +class ProductSearchGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.vision.v1.ProductSearch'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'vision.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'vision.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', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + + private static $locationNameTemplate; + + private static $productNameTemplate; + + private static $productSetNameTemplate; + + private static $referenceImageNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/product_search_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/product_search_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/product_search_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/product_search_rest_client_config.php', + ], + ], + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getProductNameTemplate() + { + if (self::$productNameTemplate == null) { + self::$productNameTemplate = new PathTemplate('projects/{project}/locations/{location}/products/{product}'); + } + + return self::$productNameTemplate; + } + + private static function getProductSetNameTemplate() + { + if (self::$productSetNameTemplate == null) { + self::$productSetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/productSets/{product_set}'); + } + + return self::$productSetNameTemplate; + } + + private static function getReferenceImageNameTemplate() + { + if (self::$referenceImageNameTemplate == null) { + self::$referenceImageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}'); + } + + return self::$referenceImageNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'product' => self::getProductNameTemplate(), + 'productSet' => self::getProductSetNameTemplate(), + 'referenceImage' => self::getReferenceImageNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product + * resource. + * + * @param string $project + * @param string $location + * @param string $product + * + * @return string The formatted product resource. + */ + public static function productName($project, $location, $product) + { + return self::getProductNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a product_set + * resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + */ + public static function productSetName($project, $location, $productSet) + { + return self::getProductSetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * reference_image resource. + * + * @param string $project + * @param string $location + * @param string $product + * @param string $referenceImage + * + * @return string The formatted reference_image resource. + */ + public static function referenceImageName($project, $location, $product, $referenceImage) + { + return self::getReferenceImageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + 'reference_image' => $referenceImage, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - product: projects/{project}/locations/{location}/products/{product} + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * - referenceImage: projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'vision.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); + } + + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->addProductToProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function addProductToProductSet($name, $product, array $optionalArgs = []) + { + $request = new AddProductToProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setProduct($product); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('AddProductToProductSet', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $product = new Product(); + * $response = $productSearchClient->createProduct($formattedParent, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param Product $product Required. The product to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $productId + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @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\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function createProduct($parent, $product, array $optionalArgs = []) + { + $request = new CreateProductRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProduct($product); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productId'])) { + $request->setProductId($optionalArgs['productId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateProduct', Product::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $productSet = new ProductSet(); + * $response = $productSearchClient->createProductSet($formattedParent, $productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ProductSet $productSet Required. The ProductSet to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $productSetId + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @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\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function createProductSet($parent, $productSet, array $optionalArgs = []) + { + $request = new CreateProductSetRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProductSet($productSet); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productSetId'])) { + $request->setProductSetId($optionalArgs['productSetId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateProductSet', ProductSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $referenceImage = new ReferenceImage(); + * $response = $productSearchClient->createReferenceImage($formattedParent, $referenceImage); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the product in which to create the reference + * image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param ReferenceImage $referenceImage Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param array $optionalArgs { + * Optional. + * + * @type string $referenceImageId + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * @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\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + */ + public function createReferenceImage($parent, $referenceImage, array $optionalArgs = []) + { + $request = new CreateReferenceImageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setReferenceImage($referenceImage); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['referenceImageId'])) { + $request->setReferenceImageId($optionalArgs['referenceImageId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateReferenceImage', ReferenceImage::class, $optionalArgs, $request)->wait(); + } + + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->deleteProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteProduct($name, array $optionalArgs = []) + { + $request = new DeleteProductRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteProduct', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $productSearchClient->deleteProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteProductSet($name, array $optionalArgs = []) + { + $request = new DeleteProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteProductSet', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + * $productSearchClient->deleteReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the reference image to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteReferenceImage($name, array $optionalArgs = []) + { + $request = new DeleteReferenceImageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteReferenceImage', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $response = $productSearchClient->getProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @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\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function getProduct($name, array $optionalArgs = []) + { + $request = new GetProductRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProduct', Product::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $response = $productSearchClient->getProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @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\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function getProductSet($name, array $optionalArgs = []) + { + $request = new GetProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProductSet', ProductSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + * $response = $productSearchClient->getReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ReferenceImage to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @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\Cloud\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + */ + public function getReferenceImage($name, array $optionalArgs = []) + { + $request = new GetReferenceImageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetReferenceImage', ReferenceImage::class, $optionalArgs, $request)->wait(); + } + + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $inputConfig = new ImportProductSetsInputConfig(); + * $operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $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 = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $productSearchClient->resumeOperation($operationName, 'importProductSets'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ImportProductSetsInputConfig $inputConfig Required. The input content for the list of requests. + * @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 importProductSets($parent, $inputConfig, array $optionalArgs = []) + { + $request = new ImportProductSetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInputConfig($inputConfig); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportProductSets', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProductSets($parent, array $optionalArgs = []) + { + $request = new ListProductSetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProductSets', $optionalArgs, ListProductSetsResponse::class, $request); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProducts($parent, array $optionalArgs = []) + { + $request = new ListProductsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProducts', $optionalArgs, ListProductsResponse::class, $request); + } + + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProductsInProductSet($name, array $optionalArgs = []) + { + $request = new ListProductsInProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProductsInProductSet', $optionalArgs, ListProductsInProductSetResponse::class, $request); + } + + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listReferenceImages($parent, array $optionalArgs = []) + { + $request = new ListReferenceImagesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListReferenceImages', $optionalArgs, ListReferenceImagesResponse::class, $request); + } + + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $operationResponse = $productSearchClient->purgeProducts($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $productSearchClient->purgeProducts($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $productSearchClient->resumeOperation($operationName, 'purgeProducts'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the Products should be deleted. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type ProductSetPurgeConfig $productSetPurgeConfig + * Specify which ProductSet contains the Products to be deleted. + * @type bool $deleteOrphanProducts + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @type bool $force + * The default value is false. Override this value to true to actually perform + * the purge. + * @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 purgeProducts($parent, array $optionalArgs = []) + { + $request = new PurgeProductsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['productSetPurgeConfig'])) { + $request->setProductSetPurgeConfig($optionalArgs['productSetPurgeConfig']); + } + + if (isset($optionalArgs['deleteOrphanProducts'])) { + $request->setDeleteOrphanProducts($optionalArgs['deleteOrphanProducts']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('PurgeProducts', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Removes a Product from the specified ProductSet. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->removeProductFromProductSet($formattedName, $formattedProduct); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product Required. The resource name for the Product to be removed from this + * ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @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. + * } + * + * @throws ApiException if the remote call fails + */ + public function removeProductFromProductSet($name, $product, array $optionalArgs = []) + { + $request = new RemoveProductFromProductSetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setProduct($product); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('RemoveProductFromProductSet', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $product = new Product(); + * $response = $productSearchClient->updateProduct($product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param Product $product Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @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\Vision\V1\Product + * + * @throws ApiException if the remote call fails + */ + public function updateProduct($product, array $optionalArgs = []) + { + $request = new UpdateProductRequest(); + $requestParamHeaders = []; + $request->setProduct($product); + $requestParamHeaders['product.name'] = $product->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateProduct', Product::class, $optionalArgs, $request)->wait(); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $productSet = new ProductSet(); + * $response = $productSearchClient->updateProductSet($productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param ProductSet $productSet Required. The ProductSet resource which replaces the one on the server. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @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\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + */ + public function updateProductSet($productSet, array $optionalArgs = []) + { + $request = new UpdateProductSetRequest(); + $requestParamHeaders = []; + $request->setProductSet($productSet); + $requestParamHeaders['product_set.name'] = $productSet->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateProductSet', ProductSet::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/Vision/V1/src/V1/ImageAnnotatorClient.php b/owl-bot-staging/Vision/V1/src/V1/ImageAnnotatorClient.php new file mode 100644 index 00000000000..87ab4820cfc --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/ImageAnnotatorClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.vision.v1.ImageAnnotator' => [ + 'AsyncBatchAnnotateFiles' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\AsyncBatchAnnotateFilesResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'AsyncBatchAnnotateImages' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\AsyncBatchAnnotateImagesResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateFiles' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\BatchAnnotateFilesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateImages' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\BatchAnnotateImagesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'productSet' => 'projects/{project}/locations/{location}/productSets/{product_set}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Vision/V1/src/V1/resources/image_annotator_rest_client_config.php b/owl-bot-staging/Vision/V1/src/V1/resources/image_annotator_rest_client_config.php new file mode 100644 index 00000000000..5ca91020825 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/resources/image_annotator_rest_client_config.php @@ -0,0 +1,132 @@ + [ + 'google.cloud.vision.v1.ImageAnnotator' => [ + 'AsyncBatchAnnotateFiles' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/files:asyncBatchAnnotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/files:asyncBatchAnnotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/files:asyncBatchAnnotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'AsyncBatchAnnotateImages' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/images:asyncBatchAnnotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/images:asyncBatchAnnotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/images:asyncBatchAnnotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateFiles' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/files:annotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/files:annotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/files:annotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BatchAnnotateImages' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/images:annotate', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/images:annotate', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/images:annotate', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Vision/V1/src/V1/resources/product_search_client_config.json b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_client_config.json new file mode 100644 index 00000000000..393b5b95128 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_client_config.json @@ -0,0 +1,140 @@ +{ + "interfaces": { + "google.cloud.vision.v1.ProductSearch": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [], + "retry_policy_3_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "retry_policy_3_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AddProductToProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "CreateProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "CreateProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "CreateReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "DeleteProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "DeleteProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "DeleteReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "GetReferenceImage": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ImportProductSets": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "ListProductSets": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListProducts": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListProductsInProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "ListReferenceImages": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "PurgeProducts": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "RemoveProductFromProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "UpdateProduct": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + }, + "UpdateProductSet": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_3_codes", + "retry_params_name": "retry_policy_3_params" + } + } + } + } +} diff --git a/owl-bot-staging/Vision/V1/src/V1/resources/product_search_descriptor_config.php b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_descriptor_config.php new file mode 100644 index 00000000000..62781007ff5 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_descriptor_config.php @@ -0,0 +1,290 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'ImportProductSets' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\ImportProductSetsResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\BatchOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'PurgeProducts' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\BatchOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'AddProductToProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateProduct' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\Product', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ProductSet', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateReferenceImage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ReferenceImage', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteProduct' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReferenceImage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProduct' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\Product', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ProductSet', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetReferenceImage' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ReferenceImage', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListProductSets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProductSets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ListProductSetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProducts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ListProductsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductsInProductSet' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ListProductsInProductSetResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListReferenceImages' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReferenceImages', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ListReferenceImagesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RemoveProductFromProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateProduct' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\Product', + 'headerParams' => [ + [ + 'keyName' => 'product.name', + 'fieldAccessors' => [ + 'getProduct', + 'getName', + ], + ], + ], + ], + 'UpdateProductSet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Vision\V1\ProductSet', + 'headerParams' => [ + [ + 'keyName' => 'product_set.name', + 'fieldAccessors' => [ + 'getProductSet', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'location' => 'projects/{project}/locations/{location}', + 'product' => 'projects/{project}/locations/{location}/products/{product}', + 'productSet' => 'projects/{project}/locations/{location}/productSets/{product_set}', + 'referenceImage' => 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Vision/V1/src/V1/resources/product_search_rest_client_config.php b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_rest_client_config.php new file mode 100644 index 00000000000..9ce3ae04533 --- /dev/null +++ b/owl-bot-staging/Vision/V1/src/V1/resources/product_search_rest_client_config.php @@ -0,0 +1,256 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'AddProductToProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:addProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateProduct' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'body' => 'product', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'body' => 'product_set', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateReferenceImage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'body' => 'reference_image', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteProduct' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProductSet' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReferenceImage' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProduct' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetReferenceImage' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ImportProductSets' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets:import', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductSets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProducts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductsInProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}/products', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListReferenceImages' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'PurgeProducts' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products:purge', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RemoveProductFromProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:removeProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateProduct' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product.name=projects/*/locations/*/products/*}', + 'body' => 'product', + 'placeholders' => [ + 'product.name' => [ + 'getters' => [ + 'getProduct', + 'getName', + ], + ], + ], + ], + 'UpdateProductSet' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product_set.name=projects/*/locations/*/productSets/*}', + 'body' => 'product_set', + 'placeholders' => [ + 'product_set.name' => [ + 'getters' => [ + 'getProductSet', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ImageAnnotatorClientTest.php b/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ImageAnnotatorClientTest.php new file mode 100644 index 00000000000..69e2a69ecfb --- /dev/null +++ b/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ImageAnnotatorClientTest.php @@ -0,0 +1,509 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ImageAnnotatorClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ImageAnnotatorClient($options); + } + + /** @test */ + public function asyncBatchAnnotateFilesTest() + { + $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/asyncBatchAnnotateFilesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AsyncBatchAnnotateFilesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/asyncBatchAnnotateFilesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $requests = []; + $request = (new AsyncBatchAnnotateFilesRequest()) + ->setRequests($requests); + $response = $gapicClient->asyncBatchAnnotateFiles($request); + $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.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateFilesTest'); + $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 asyncBatchAnnotateFilesExceptionTest() + { + $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/asyncBatchAnnotateFilesTest'); + $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 + $requests = []; + $request = (new AsyncBatchAnnotateFilesRequest()) + ->setRequests($requests); + $response = $gapicClient->asyncBatchAnnotateFiles($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateFilesTest'); + 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 asyncBatchAnnotateImagesTest() + { + $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/asyncBatchAnnotateImagesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AsyncBatchAnnotateImagesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/asyncBatchAnnotateImagesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $requests = []; + $outputConfig = new OutputConfig(); + $request = (new AsyncBatchAnnotateImagesRequest()) + ->setRequests($requests) + ->setOutputConfig($outputConfig); + $response = $gapicClient->asyncBatchAnnotateImages($request); + $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.vision.v1.ImageAnnotator/AsyncBatchAnnotateImages', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateImagesTest'); + $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 asyncBatchAnnotateImagesExceptionTest() + { + $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/asyncBatchAnnotateImagesTest'); + $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 + $requests = []; + $outputConfig = new OutputConfig(); + $request = (new AsyncBatchAnnotateImagesRequest()) + ->setRequests($requests) + ->setOutputConfig($outputConfig); + $response = $gapicClient->asyncBatchAnnotateImages($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateImagesTest'); + 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 batchAnnotateFilesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchAnnotateFilesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $requests = []; + $request = (new BatchAnnotateFilesRequest()) + ->setRequests($requests); + $response = $gapicClient->batchAnnotateFiles($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateFiles', $actualFuncCall); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchAnnotateFilesExceptionTest() + { + $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 + $requests = []; + $request = (new BatchAnnotateFilesRequest()) + ->setRequests($requests); + try { + $gapicClient->batchAnnotateFiles($request); + // 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()); + } + + /** @test */ + public function batchAnnotateImagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchAnnotateImagesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $requests = []; + $request = (new BatchAnnotateImagesRequest()) + ->setRequests($requests); + $response = $gapicClient->batchAnnotateImages($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages', $actualFuncCall); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchAnnotateImagesExceptionTest() + { + $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 + $requests = []; + $request = (new BatchAnnotateImagesRequest()) + ->setRequests($requests); + try { + $gapicClient->batchAnnotateImages($request); + // 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()); + } + + /** @test */ + public function asyncBatchAnnotateFilesAsyncTest() + { + $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/asyncBatchAnnotateFilesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AsyncBatchAnnotateFilesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/asyncBatchAnnotateFilesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $requests = []; + $request = (new AsyncBatchAnnotateFilesRequest()) + ->setRequests($requests); + $response = $gapicClient->asyncBatchAnnotateFilesAsync($request)->wait(); + $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.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateFilesTest'); + $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()); + } +} diff --git a/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ProductSearchClientTest.php b/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ProductSearchClientTest.php new file mode 100644 index 00000000000..e5e0383ed73 --- /dev/null +++ b/owl-bot-staging/Vision/V1/tests/Unit/V1/Client/ProductSearchClientTest.php @@ -0,0 +1,1540 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ProductSearchClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ProductSearchClient($options); + } + + /** @test */ + public function addProductToProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new AddProductToProductSetRequest()) + ->setName($formattedName) + ->setProduct($formattedProduct); + $gapicClient->addProductToProductSet($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($formattedProduct, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function addProductToProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new AddProductToProductSetRequest()) + ->setName($formattedName) + ->setProduct($formattedProduct); + try { + $gapicClient->addProductToProductSet($request); + // 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()); + } + + /** @test */ + public function createProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + $request = (new CreateProductRequest()) + ->setParent($formattedParent) + ->setProduct($product); + $response = $gapicClient->createProduct($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($product, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProductExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + $request = (new CreateProductRequest()) + ->setParent($formattedParent) + ->setProduct($product); + try { + $gapicClient->createProduct($request); + // 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()); + } + + /** @test */ + public function createProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + $request = (new CreateProductSetRequest()) + ->setParent($formattedParent) + ->setProductSet($productSet); + $response = $gapicClient->createProductSet($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProductSet(); + $this->assertProtobufEquals($productSet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProductSetExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + $request = (new CreateProductSetRequest()) + ->setParent($formattedParent) + ->setProductSet($productSet); + try { + $gapicClient->createProductSet($request); + // 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()); + } + + /** @test */ + public function createReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + $referenceImageUri = 'referenceImageUri-707360132'; + $referenceImage->setUri($referenceImageUri); + $request = (new CreateReferenceImageRequest()) + ->setParent($formattedParent) + ->setReferenceImage($referenceImage); + $response = $gapicClient->createReferenceImage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getReferenceImage(); + $this->assertProtobufEquals($referenceImage, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createReferenceImageExceptionTest() + { + $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 + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + $referenceImageUri = 'referenceImageUri-707360132'; + $referenceImage->setUri($referenceImageUri); + $request = (new CreateReferenceImageRequest()) + ->setParent($formattedParent) + ->setReferenceImage($referenceImage); + try { + $gapicClient->createReferenceImage($request); + // 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()); + } + + /** @test */ + public function deleteProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new DeleteProductRequest()) + ->setName($formattedName); + $gapicClient->deleteProduct($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProductExceptionTest() + { + $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 + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new DeleteProductRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteProduct($request); + // 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()); + } + + /** @test */ + public function deleteProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new DeleteProductSetRequest()) + ->setName($formattedName); + $gapicClient->deleteProductSet($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new DeleteProductSetRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteProductSet($request); + // 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()); + } + + /** @test */ + public function deleteReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $request = (new DeleteReferenceImageRequest()) + ->setName($formattedName); + $gapicClient->deleteReferenceImage($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteReferenceImageExceptionTest() + { + $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 + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $request = (new DeleteReferenceImageRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteReferenceImage($request); + // 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()); + } + + /** @test */ + public function getProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new GetProductRequest()) + ->setName($formattedName); + $response = $gapicClient->getProduct($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProductExceptionTest() + { + $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 + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new GetProductRequest()) + ->setName($formattedName); + try { + $gapicClient->getProduct($request); + // 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()); + } + + /** @test */ + public function getProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new GetProductSetRequest()) + ->setName($formattedName); + $response = $gapicClient->getProductSet($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new GetProductSetRequest()) + ->setName($formattedName); + try { + $gapicClient->getProductSet($request); + // 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()); + } + + /** @test */ + public function getReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $request = (new GetReferenceImageRequest()) + ->setName($formattedName); + $response = $gapicClient->getReferenceImage($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReferenceImageExceptionTest() + { + $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 + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $request = (new GetReferenceImageRequest()) + ->setName($formattedName); + try { + $gapicClient->getReferenceImage($request); + // 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()); + } + + /** @test */ + public function importProductSetsTest() + { + $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/importProductSetsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ImportProductSetsResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importProductSetsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + $request = (new ImportProductSetsRequest()) + ->setParent($formattedParent) + ->setInputConfig($inputConfig); + $response = $gapicClient->importProductSets($request); + $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.vision.v1.ProductSearch/ImportProductSets', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfig(); + $this->assertProtobufEquals($inputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + $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 importProductSetsExceptionTest() + { + $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/importProductSetsTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + $request = (new ImportProductSetsRequest()) + ->setParent($formattedParent) + ->setInputConfig($inputConfig); + $response = $gapicClient->importProductSets($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + 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 listProductSetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productSetsElement = new ProductSet(); + $productSets = [ + $productSetsElement, + ]; + $expectedResponse = new ListProductSetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProductSets($productSets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProductSetsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listProductSets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProductSets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductSets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductSetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProductSetsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listProductSets($request); + // 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()); + } + + /** @test */ + public function listProductsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [ + $productsElement, + ]; + $expectedResponse = new ListProductsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProductsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listProducts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProducts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProductsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listProducts($request); + // 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()); + } + + /** @test */ + public function listProductsInProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [ + $productsElement, + ]; + $expectedResponse = new ListProductsInProductSetResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new ListProductsInProductSetRequest()) + ->setName($formattedName); + $response = $gapicClient->listProductsInProductSet($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductsInProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $request = (new ListProductsInProductSetRequest()) + ->setName($formattedName); + try { + $gapicClient->listProductsInProductSet($request); + // 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()); + } + + /** @test */ + public function listReferenceImagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $pageSize2 = 1024500956; + $nextPageToken = ''; + $referenceImagesElement = new ReferenceImage(); + $referenceImages = [ + $referenceImagesElement, + ]; + $expectedResponse = new ListReferenceImagesResponse(); + $expectedResponse->setPageSize($pageSize2); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReferenceImages($referenceImages); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new ListReferenceImagesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listReferenceImages($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReferenceImages()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListReferenceImages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReferenceImagesExceptionTest() + { + $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 + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new ListReferenceImagesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listReferenceImages($request); + // 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()); + } + + /** @test */ + public function purgeProductsTest() + { + $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/purgeProductsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/purgeProductsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new PurgeProductsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->purgeProducts($request); + $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.vision.v1.ProductSearch/PurgeProducts', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/purgeProductsTest'); + $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 purgeProductsExceptionTest() + { + $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/purgeProductsTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new PurgeProductsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->purgeProducts($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/purgeProductsTest'); + 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 removeProductFromProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new RemoveProductFromProductSetRequest()) + ->setName($formattedName) + ->setProduct($formattedProduct); + $gapicClient->removeProductFromProductSet($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($formattedProduct, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeProductFromProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new RemoveProductFromProductSetRequest()) + ->setName($formattedName) + ->setProduct($formattedProduct); + try { + $gapicClient->removeProductFromProductSet($request); + // 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()); + } + + /** @test */ + public function updateProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $product = new Product(); + $request = (new UpdateProductRequest()) + ->setProduct($product); + $response = $gapicClient->updateProduct($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($product, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateProductExceptionTest() + { + $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 + $product = new Product(); + $request = (new UpdateProductRequest()) + ->setProduct($product); + try { + $gapicClient->updateProduct($request); + // 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()); + } + + /** @test */ + public function updateProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $productSet = new ProductSet(); + $request = (new UpdateProductSetRequest()) + ->setProductSet($productSet); + $response = $gapicClient->updateProductSet($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getProductSet(); + $this->assertProtobufEquals($productSet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateProductSetExceptionTest() + { + $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 + $productSet = new ProductSet(); + $request = (new UpdateProductSetRequest()) + ->setProductSet($productSet); + try { + $gapicClient->updateProductSet($request); + // 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()); + } + + /** @test */ + public function addProductToProductSetAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $request = (new AddProductToProductSetRequest()) + ->setName($formattedName) + ->setProduct($formattedProduct); + $gapicClient->addProductToProductSetAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($formattedProduct, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Vision/V1/tests/Unit/V1/ImageAnnotatorClientTest.php b/owl-bot-staging/Vision/V1/tests/Unit/V1/ImageAnnotatorClientTest.php new file mode 100644 index 00000000000..9df52eda46b --- /dev/null +++ b/owl-bot-staging/Vision/V1/tests/Unit/V1/ImageAnnotatorClientTest.php @@ -0,0 +1,423 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ImageAnnotatorClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ImageAnnotatorClient($options); + } + + /** @test */ + public function asyncBatchAnnotateFilesTest() + { + $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/asyncBatchAnnotateFilesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AsyncBatchAnnotateFilesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/asyncBatchAnnotateFilesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $requests = []; + $response = $gapicClient->asyncBatchAnnotateFiles($requests); + $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.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateFilesTest'); + $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 asyncBatchAnnotateFilesExceptionTest() + { + $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/asyncBatchAnnotateFilesTest'); + $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 + $requests = []; + $response = $gapicClient->asyncBatchAnnotateFiles($requests); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateFilesTest'); + 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 asyncBatchAnnotateImagesTest() + { + $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/asyncBatchAnnotateImagesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AsyncBatchAnnotateImagesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/asyncBatchAnnotateImagesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $requests = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->asyncBatchAnnotateImages($requests, $outputConfig); + $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.vision.v1.ImageAnnotator/AsyncBatchAnnotateImages', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $actualValue = $actualApiRequestObject->getOutputConfig(); + $this->assertProtobufEquals($outputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateImagesTest'); + $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 asyncBatchAnnotateImagesExceptionTest() + { + $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/asyncBatchAnnotateImagesTest'); + $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 + $requests = []; + $outputConfig = new OutputConfig(); + $response = $gapicClient->asyncBatchAnnotateImages($requests, $outputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/asyncBatchAnnotateImagesTest'); + 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 batchAnnotateFilesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchAnnotateFilesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $requests = []; + $response = $gapicClient->batchAnnotateFiles($requests); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateFiles', $actualFuncCall); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchAnnotateFilesExceptionTest() + { + $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 + $requests = []; + try { + $gapicClient->batchAnnotateFiles($requests); + // 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()); + } + + /** @test */ + public function batchAnnotateImagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchAnnotateImagesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $requests = []; + $response = $gapicClient->batchAnnotateImages($requests); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages', $actualFuncCall); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchAnnotateImagesExceptionTest() + { + $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 + $requests = []; + try { + $gapicClient->batchAnnotateImages($requests); + // 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()); + } +} diff --git a/owl-bot-staging/Vision/V1/tests/Unit/V1/ProductSearchClientTest.php b/owl-bot-staging/Vision/V1/tests/Unit/V1/ProductSearchClientTest.php new file mode 100644 index 00000000000..a95111b861b --- /dev/null +++ b/owl-bot-staging/Vision/V1/tests/Unit/V1/ProductSearchClientTest.php @@ -0,0 +1,1403 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ProductSearchClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ProductSearchClient($options); + } + + /** @test */ + public function addProductToProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $gapicClient->addProductToProductSet($formattedName, $formattedProduct); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($formattedProduct, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function addProductToProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + try { + $gapicClient->addProductToProductSet($formattedName, $formattedProduct); + // 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()); + } + + /** @test */ + public function createProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + $response = $gapicClient->createProduct($formattedParent, $product); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($product, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProductExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + try { + $gapicClient->createProduct($formattedParent, $product); + // 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()); + } + + /** @test */ + public function createProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + $response = $gapicClient->createProductSet($formattedParent, $productSet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProductSet(); + $this->assertProtobufEquals($productSet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProductSetExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + try { + $gapicClient->createProductSet($formattedParent, $productSet); + // 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()); + } + + /** @test */ + public function createReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + $referenceImageUri = 'referenceImageUri-707360132'; + $referenceImage->setUri($referenceImageUri); + $response = $gapicClient->createReferenceImage($formattedParent, $referenceImage); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getReferenceImage(); + $this->assertProtobufEquals($referenceImage, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createReferenceImageExceptionTest() + { + $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 + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + $referenceImageUri = 'referenceImageUri-707360132'; + $referenceImage->setUri($referenceImageUri); + try { + $gapicClient->createReferenceImage($formattedParent, $referenceImage); + // 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()); + } + + /** @test */ + public function deleteProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $gapicClient->deleteProduct($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProductExceptionTest() + { + $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 + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + try { + $gapicClient->deleteProduct($formattedName); + // 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()); + } + + /** @test */ + public function deleteProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $gapicClient->deleteProductSet($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + try { + $gapicClient->deleteProductSet($formattedName); + // 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()); + } + + /** @test */ + public function deleteReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $gapicClient->deleteReferenceImage($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteReferenceImageExceptionTest() + { + $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 + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + try { + $gapicClient->deleteReferenceImage($formattedName); + // 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()); + } + + /** @test */ + public function getProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $response = $gapicClient->getProduct($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProductExceptionTest() + { + $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 + $formattedName = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + try { + $gapicClient->getProduct($formattedName); + // 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()); + } + + /** @test */ + public function getProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $response = $gapicClient->getProductSet($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + try { + $gapicClient->getProductSet($formattedName); + // 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()); + } + + /** @test */ + public function getReferenceImageTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + $response = $gapicClient->getReferenceImage($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetReferenceImage', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReferenceImageExceptionTest() + { + $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 + $formattedName = $gapicClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); + try { + $gapicClient->getReferenceImage($formattedName); + // 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()); + } + + /** @test */ + public function importProductSetsTest() + { + $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/importProductSetsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ImportProductSetsResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importProductSetsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + $response = $gapicClient->importProductSets($formattedParent, $inputConfig); + $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.vision.v1.ProductSearch/ImportProductSets', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfig(); + $this->assertProtobufEquals($inputConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + $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 importProductSetsExceptionTest() + { + $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/importProductSetsTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + $response = $gapicClient->importProductSets($formattedParent, $inputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + 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 listProductSetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productSetsElement = new ProductSet(); + $productSets = [ + $productSetsElement, + ]; + $expectedResponse = new ListProductSetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProductSets($productSets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listProductSets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProductSets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductSets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductSetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listProductSets($formattedParent); + // 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()); + } + + /** @test */ + public function listProductsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [ + $productsElement, + ]; + $expectedResponse = new ListProductsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listProducts($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProducts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listProducts($formattedParent); + // 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()); + } + + /** @test */ + public function listProductsInProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [ + $productsElement, + ]; + $expectedResponse = new ListProductsInProductSetResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $response = $gapicClient->listProductsInProductSet($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductsInProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + try { + $gapicClient->listProductsInProductSet($formattedName); + // 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()); + } + + /** @test */ + public function listReferenceImagesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $pageSize2 = 1024500956; + $nextPageToken = ''; + $referenceImagesElement = new ReferenceImage(); + $referenceImages = [ + $referenceImagesElement, + ]; + $expectedResponse = new ListReferenceImagesResponse(); + $expectedResponse->setPageSize($pageSize2); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReferenceImages($referenceImages); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $response = $gapicClient->listReferenceImages($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReferenceImages()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListReferenceImages', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReferenceImagesExceptionTest() + { + $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 + $formattedParent = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + try { + $gapicClient->listReferenceImages($formattedParent); + // 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()); + } + + /** @test */ + public function purgeProductsTest() + { + $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/purgeProductsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/purgeProductsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->purgeProducts($formattedParent); + $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.vision.v1.ProductSearch/PurgeProducts', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/purgeProductsTest'); + $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 purgeProductsExceptionTest() + { + $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/purgeProductsTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->purgeProducts($formattedParent); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/purgeProductsTest'); + 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 removeProductFromProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $gapicClient->removeProductFromProductSet($formattedName, $formattedProduct); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($formattedProduct, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function removeProductFromProductSetExceptionTest() + { + $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 + $formattedName = $gapicClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $formattedProduct = $gapicClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + try { + $gapicClient->removeProductFromProductSet($formattedName, $formattedProduct); + // 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()); + } + + /** @test */ + public function updateProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + // Mock request + $product = new Product(); + $response = $gapicClient->updateProduct($product); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getProduct(); + $this->assertProtobufEquals($product, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateProductExceptionTest() + { + $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 + $product = new Product(); + try { + $gapicClient->updateProduct($product); + // 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()); + } + + /** @test */ + public function updateProductSetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $productSet = new ProductSet(); + $response = $gapicClient->updateProductSet($productSet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProductSet', $actualFuncCall); + $actualValue = $actualRequestObject->getProductSet(); + $this->assertProtobufEquals($productSet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateProductSetExceptionTest() + { + $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 + $productSet = new ProductSet(); + try { + $gapicClient->updateProductSet($productSet); + // 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()); + } +} diff --git a/owl-bot-staging/VmMigration/v1/proto/src/GPBMetadata/Google/Cloud/Vmmigration/V1/Vmmigration.php b/owl-bot-staging/VmMigration/v1/proto/src/GPBMetadata/Google/Cloud/Vmmigration/V1/Vmmigration.php new file mode 100644 index 00000000000..19f7cd9db63 Binary files /dev/null and b/owl-bot-staging/VmMigration/v1/proto/src/GPBMetadata/Google/Cloud/Vmmigration/V1/Vmmigration.php differ diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AdaptingOSStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AdaptingOSStep.php new file mode 100644 index 00000000000..6fc60a510df --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AdaptingOSStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.AdaptingOSStep + */ +class AdaptingOSStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationRequest.php new file mode 100644 index 00000000000..d4a9f9a19d6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationRequest.php @@ -0,0 +1,115 @@ +google.cloud.vmmigration.v1.AddGroupMigrationRequest + */ +class AddGroupMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full path name of the Group to add to. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $group = ''; + /** + * The full path name of the MigratingVm to add. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * @param string $group Required. The full path name of the Group to add to. Please see + * {@see VmMigrationClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\AddGroupMigrationRequest + * + * @experimental + */ + public static function build(string $group): self + { + return (new self()) + ->setGroup($group); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $group + * Required. The full path name of the Group to add to. + * @type string $migrating_vm + * The full path name of the MigratingVm to add. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full path name of the Group to add to. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getGroup() + { + return $this->group; + } + + /** + * Required. The full path name of the Group to add to. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkString($var, True); + $this->group = $var; + + return $this; + } + + /** + * The full path name of the MigratingVm to add. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * The full path name of the MigratingVm to add. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationResponse.php new file mode 100644 index 00000000000..d1f198d5402 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AddGroupMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.AddGroupMigrationResponse + */ +class AddGroupMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ApplianceVersion.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ApplianceVersion.php new file mode 100644 index 00000000000..da08b27da90 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ApplianceVersion.php @@ -0,0 +1,169 @@ +google.cloud.vmmigration.v1.ApplianceVersion + */ +class ApplianceVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The appliance version. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * A link for downloading the version. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Determine whether it's critical to upgrade the appliance to this version. + * + * Generated from protobuf field bool critical = 3; + */ + protected $critical = false; + /** + * Link to a page that contains the version release notes. + * + * Generated from protobuf field string release_notes_uri = 4; + */ + protected $release_notes_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The appliance version. + * @type string $uri + * A link for downloading the version. + * @type bool $critical + * Determine whether it's critical to upgrade the appliance to this version. + * @type string $release_notes_uri + * Link to a page that contains the version release notes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The appliance version. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The appliance version. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * A link for downloading the version. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * A link for downloading the version. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Determine whether it's critical to upgrade the appliance to this version. + * + * Generated from protobuf field bool critical = 3; + * @return bool + */ + public function getCritical() + { + return $this->critical; + } + + /** + * Determine whether it's critical to upgrade the appliance to this version. + * + * Generated from protobuf field bool critical = 3; + * @param bool $var + * @return $this + */ + public function setCritical($var) + { + GPBUtil::checkBool($var); + $this->critical = $var; + + return $this; + } + + /** + * Link to a page that contains the version release notes. + * + * Generated from protobuf field string release_notes_uri = 4; + * @return string + */ + public function getReleaseNotesUri() + { + return $this->release_notes_uri; + } + + /** + * Link to a page that contains the version release notes. + * + * Generated from protobuf field string release_notes_uri = 4; + * @param string $var + * @return $this + */ + public function setReleaseNotesUri($var) + { + GPBUtil::checkString($var, True); + $this->release_notes_uri = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense.php new file mode 100644 index 00000000000..c015b9cf164 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense.php @@ -0,0 +1,101 @@ +google.cloud.vmmigration.v1.AppliedLicense + */ +class AppliedLicense extends \Google\Protobuf\Internal\Message +{ + /** + * The license type that was used in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense.Type type = 1; + */ + protected $type = 0; + /** + * The OS license returned from the adaptation module's report. + * + * Generated from protobuf field string os_license = 2; + */ + protected $os_license = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * The license type that was used in OS adaptation. + * @type string $os_license + * The OS license returned from the adaptation module's report. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The license type that was used in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The license type that was used in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AppliedLicense\Type::class); + $this->type = $var; + + return $this; + } + + /** + * The OS license returned from the adaptation module's report. + * + * Generated from protobuf field string os_license = 2; + * @return string + */ + public function getOsLicense() + { + return $this->os_license; + } + + /** + * The OS license returned from the adaptation module's report. + * + * Generated from protobuf field string os_license = 2; + * @param string $var + * @return $this + */ + public function setOsLicense($var) + { + GPBUtil::checkString($var, True); + $this->os_license = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense/Type.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense/Type.php new file mode 100644 index 00000000000..27008d8cc57 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AppliedLicense/Type.php @@ -0,0 +1,71 @@ +google.cloud.vmmigration.v1.AppliedLicense.Type + */ +class Type +{ + /** + * Unspecified license for the OS. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * No license available for the OS. + * + * Generated from protobuf enum NONE = 1; + */ + const NONE = 1; + /** + * The license type is Pay As You Go license type. + * + * Generated from protobuf enum PAYG = 2; + */ + const PAYG = 2; + /** + * The license type is Bring Your Own License type. + * + * Generated from protobuf enum BYOL = 3; + */ + const BYOL = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::NONE => 'NONE', + self::PAYG => 'PAYG', + self::BYOL => 'BYOL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VMMigration\V1\AppliedLicense_Type::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AvailableUpdates.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AvailableUpdates.php new file mode 100644 index 00000000000..a32202170f8 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AvailableUpdates.php @@ -0,0 +1,137 @@ +google.cloud.vmmigration.v1.AvailableUpdates + */ +class AvailableUpdates extends \Google\Protobuf\Internal\Message +{ + /** + * The newest deployable version of the appliance. + * The current appliance can't be updated into this version, and the owner + * must manually deploy this OVA to a new appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion new_deployable_appliance = 1; + */ + protected $new_deployable_appliance = null; + /** + * The latest version for in place update. + * The current appliance can be updated to this version using the API or m4c + * CLI. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion in_place_update = 2; + */ + protected $in_place_update = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\ApplianceVersion $new_deployable_appliance + * The newest deployable version of the appliance. + * The current appliance can't be updated into this version, and the owner + * must manually deploy this OVA to a new appliance. + * @type \Google\Cloud\VMMigration\V1\ApplianceVersion $in_place_update + * The latest version for in place update. + * The current appliance can be updated to this version using the API or m4c + * CLI. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The newest deployable version of the appliance. + * The current appliance can't be updated into this version, and the owner + * must manually deploy this OVA to a new appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion new_deployable_appliance = 1; + * @return \Google\Cloud\VMMigration\V1\ApplianceVersion|null + */ + public function getNewDeployableAppliance() + { + return $this->new_deployable_appliance; + } + + public function hasNewDeployableAppliance() + { + return isset($this->new_deployable_appliance); + } + + public function clearNewDeployableAppliance() + { + unset($this->new_deployable_appliance); + } + + /** + * The newest deployable version of the appliance. + * The current appliance can't be updated into this version, and the owner + * must manually deploy this OVA to a new appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion new_deployable_appliance = 1; + * @param \Google\Cloud\VMMigration\V1\ApplianceVersion $var + * @return $this + */ + public function setNewDeployableAppliance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ApplianceVersion::class); + $this->new_deployable_appliance = $var; + + return $this; + } + + /** + * The latest version for in place update. + * The current appliance can be updated to this version using the API or m4c + * CLI. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion in_place_update = 2; + * @return \Google\Cloud\VMMigration\V1\ApplianceVersion|null + */ + public function getInPlaceUpdate() + { + return $this->in_place_update; + } + + public function hasInPlaceUpdate() + { + return isset($this->in_place_update); + } + + public function clearInPlaceUpdate() + { + unset($this->in_place_update); + } + + /** + * The latest version for in place update. + * The current appliance can be updated to this version using the API or m4c + * CLI. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ApplianceVersion in_place_update = 2; + * @param \Google\Cloud\VMMigration\V1\ApplianceVersion $var + * @return $this + */ + public function setInPlaceUpdate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ApplianceVersion::class); + $this->in_place_update = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSecurityGroup.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSecurityGroup.php new file mode 100644 index 00000000000..ee8d6768c50 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSecurityGroup.php @@ -0,0 +1,101 @@ +google.cloud.vmmigration.v1.AwsSecurityGroup + */ +class AwsSecurityGroup extends \Google\Protobuf\Internal\Message +{ + /** + * The AWS security group id. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The AWS security group name. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * The AWS security group id. + * @type string $name + * The AWS security group name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The AWS security group id. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The AWS security group id. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The AWS security group name. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The AWS security group name. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails.php new file mode 100644 index 00000000000..31c465db770 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails.php @@ -0,0 +1,348 @@ +google.cloud.vmmigration.v1.AwsSourceDetails + */ +class AwsSourceDetails extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. The AWS region that the source VMs will be migrated from. + * + * Generated from protobuf field string aws_region = 3 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $aws_region = ''; + /** + * Output only. State of the source as determined by the health check. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Provides details on the state of the Source in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * AWS resource tags to limit the scope of the source inventory. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSourceDetails.Tag inventory_tag_list = 10; + */ + private $inventory_tag_list; + /** + * AWS security group names to limit the scope of the source + * inventory. + * + * Generated from protobuf field repeated string inventory_security_group_names = 7; + */ + private $inventory_security_group_names; + /** + * User specified tags to add to every M2VM generated resource in AWS. + * These tags will be set in addition to the default tags that are set as part + * of the migration process. The tags must not begin with the reserved prefix + * `m2vm`. + * + * Generated from protobuf field map migration_resources_user_tags = 8; + */ + private $migration_resources_user_tags; + /** + * Output only. The source's public IP. All communication initiated by this + * source will originate from this IP. + * + * Generated from protobuf field string public_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $public_ip = ''; + protected $credentials_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\AwsSourceDetails\AccessKeyCredentials $access_key_creds + * AWS Credentials using access key id and secret. + * @type string $aws_region + * Immutable. The AWS region that the source VMs will be migrated from. + * @type int $state + * Output only. State of the source as determined by the health check. + * @type \Google\Rpc\Status $error + * Output only. Provides details on the state of the Source in case of an + * error. + * @type array<\Google\Cloud\VMMigration\V1\AwsSourceDetails\Tag>|\Google\Protobuf\Internal\RepeatedField $inventory_tag_list + * AWS resource tags to limit the scope of the source inventory. + * @type array|\Google\Protobuf\Internal\RepeatedField $inventory_security_group_names + * AWS security group names to limit the scope of the source + * inventory. + * @type array|\Google\Protobuf\Internal\MapField $migration_resources_user_tags + * User specified tags to add to every M2VM generated resource in AWS. + * These tags will be set in addition to the default tags that are set as part + * of the migration process. The tags must not begin with the reserved prefix + * `m2vm`. + * @type string $public_ip + * Output only. The source's public IP. All communication initiated by this + * source will originate from this IP. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * AWS Credentials using access key id and secret. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.AccessKeyCredentials access_key_creds = 11; + * @return \Google\Cloud\VMMigration\V1\AwsSourceDetails\AccessKeyCredentials|null + */ + public function getAccessKeyCreds() + { + return $this->readOneof(11); + } + + public function hasAccessKeyCreds() + { + return $this->hasOneof(11); + } + + /** + * AWS Credentials using access key id and secret. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.AccessKeyCredentials access_key_creds = 11; + * @param \Google\Cloud\VMMigration\V1\AwsSourceDetails\AccessKeyCredentials $var + * @return $this + */ + public function setAccessKeyCreds($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AwsSourceDetails\AccessKeyCredentials::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Immutable. The AWS region that the source VMs will be migrated from. + * + * Generated from protobuf field string aws_region = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getAwsRegion() + { + return $this->aws_region; + } + + /** + * Immutable. The AWS region that the source VMs will be migrated from. + * + * Generated from protobuf field string aws_region = 3 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setAwsRegion($var) + { + GPBUtil::checkString($var, True); + $this->aws_region = $var; + + return $this; + } + + /** + * Output only. State of the source as determined by the health check. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the source as determined by the health check. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsSourceDetails\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Provides details on the state of the Source in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details on the state of the Source in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * AWS resource tags to limit the scope of the source inventory. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSourceDetails.Tag inventory_tag_list = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInventoryTagList() + { + return $this->inventory_tag_list; + } + + /** + * AWS resource tags to limit the scope of the source inventory. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSourceDetails.Tag inventory_tag_list = 10; + * @param array<\Google\Cloud\VMMigration\V1\AwsSourceDetails\Tag>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInventoryTagList($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\AwsSourceDetails\Tag::class); + $this->inventory_tag_list = $arr; + + return $this; + } + + /** + * AWS security group names to limit the scope of the source + * inventory. + * + * Generated from protobuf field repeated string inventory_security_group_names = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInventorySecurityGroupNames() + { + return $this->inventory_security_group_names; + } + + /** + * AWS security group names to limit the scope of the source + * inventory. + * + * Generated from protobuf field repeated string inventory_security_group_names = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInventorySecurityGroupNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->inventory_security_group_names = $arr; + + return $this; + } + + /** + * User specified tags to add to every M2VM generated resource in AWS. + * These tags will be set in addition to the default tags that are set as part + * of the migration process. The tags must not begin with the reserved prefix + * `m2vm`. + * + * Generated from protobuf field map migration_resources_user_tags = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMigrationResourcesUserTags() + { + return $this->migration_resources_user_tags; + } + + /** + * User specified tags to add to every M2VM generated resource in AWS. + * These tags will be set in addition to the default tags that are set as part + * of the migration process. The tags must not begin with the reserved prefix + * `m2vm`. + * + * Generated from protobuf field map migration_resources_user_tags = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMigrationResourcesUserTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->migration_resources_user_tags = $arr; + + return $this; + } + + /** + * Output only. The source's public IP. All communication initiated by this + * source will originate from this IP. + * + * Generated from protobuf field string public_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPublicIp() + { + return $this->public_ip; + } + + /** + * Output only. The source's public IP. All communication initiated by this + * source will originate from this IP. + * + * Generated from protobuf field string public_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPublicIp($var) + { + GPBUtil::checkString($var, True); + $this->public_ip = $var; + + return $this; + } + + /** + * @return string + */ + public function getCredentialsType() + { + return $this->whichOneof("credentials_type"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/AccessKeyCredentials.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/AccessKeyCredentials.php new file mode 100644 index 00000000000..42e4c86fab4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/AccessKeyCredentials.php @@ -0,0 +1,104 @@ +google.cloud.vmmigration.v1.AwsSourceDetails.AccessKeyCredentials + */ +class AccessKeyCredentials extends \Google\Protobuf\Internal\Message +{ + /** + * AWS access key ID. + * + * Generated from protobuf field string access_key_id = 1; + */ + protected $access_key_id = ''; + /** + * Input only. AWS secret access key. + * + * Generated from protobuf field string secret_access_key = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $secret_access_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $access_key_id + * AWS access key ID. + * @type string $secret_access_key + * Input only. AWS secret access key. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * AWS access key ID. + * + * Generated from protobuf field string access_key_id = 1; + * @return string + */ + public function getAccessKeyId() + { + return $this->access_key_id; + } + + /** + * AWS access key ID. + * + * Generated from protobuf field string access_key_id = 1; + * @param string $var + * @return $this + */ + public function setAccessKeyId($var) + { + GPBUtil::checkString($var, True); + $this->access_key_id = $var; + + return $this; + } + + /** + * Input only. AWS secret access key. + * + * Generated from protobuf field string secret_access_key = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getSecretAccessKey() + { + return $this->secret_access_key; + } + + /** + * Input only. AWS secret access key. + * + * Generated from protobuf field string secret_access_key = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setSecretAccessKey($var) + { + GPBUtil::checkString($var, True); + $this->secret_access_key = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AccessKeyCredentials::class, \Google\Cloud\VMMigration\V1\AwsSourceDetails_AccessKeyCredentials::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/State.php new file mode 100644 index 00000000000..64b61a6c73a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/State.php @@ -0,0 +1,74 @@ +google.cloud.vmmigration.v1.AwsSourceDetails.State + */ +class State +{ + /** + * The state is unknown. This is used for API compatibility only and is not + * used by the system. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The state was not sampled by the health checks yet. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The source is available but might not be usable yet due to invalid + * credentials or another reason. + * The error message will contain further details. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * The source exists and its credentials were verified. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::FAILED => 'FAILED', + self::ACTIVE => 'ACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\AwsSourceDetails_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/Tag.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/Tag.php new file mode 100644 index 00000000000..7604d5c1184 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceDetails/Tag.php @@ -0,0 +1,104 @@ +google.cloud.vmmigration.v1.AwsSourceDetails.Tag + */ +class Tag extends \Google\Protobuf\Internal\Message +{ + /** + * Key of tag. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * Value of tag. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * Key of tag. + * @type string $value + * Value of tag. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Key of tag. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Key of tag. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * Value of tag. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Value of tag. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tag::class, \Google\Cloud\VMMigration\V1\AwsSourceDetails_Tag::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails.php new file mode 100644 index 00000000000..b8365eebfd4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails.php @@ -0,0 +1,101 @@ +google.cloud.vmmigration.v1.AwsSourceVmDetails + */ +class AwsSourceVmDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The firmware type of the source VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails.Firmware firmware = 1; + */ + protected $firmware = 0; + /** + * The total size of the disks being migrated in bytes. + * + * Generated from protobuf field int64 committed_storage_bytes = 2; + */ + protected $committed_storage_bytes = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $firmware + * The firmware type of the source VM. + * @type int|string $committed_storage_bytes + * The total size of the disks being migrated in bytes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The firmware type of the source VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails.Firmware firmware = 1; + * @return int + */ + public function getFirmware() + { + return $this->firmware; + } + + /** + * The firmware type of the source VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails.Firmware firmware = 1; + * @param int $var + * @return $this + */ + public function setFirmware($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsSourceVmDetails\Firmware::class); + $this->firmware = $var; + + return $this; + } + + /** + * The total size of the disks being migrated in bytes. + * + * Generated from protobuf field int64 committed_storage_bytes = 2; + * @return int|string + */ + public function getCommittedStorageBytes() + { + return $this->committed_storage_bytes; + } + + /** + * The total size of the disks being migrated in bytes. + * + * Generated from protobuf field int64 committed_storage_bytes = 2; + * @param int|string $var + * @return $this + */ + public function setCommittedStorageBytes($var) + { + GPBUtil::checkInt64($var); + $this->committed_storage_bytes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails/Firmware.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails/Firmware.php new file mode 100644 index 00000000000..5a55b923fe1 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsSourceVmDetails/Firmware.php @@ -0,0 +1,64 @@ +google.cloud.vmmigration.v1.AwsSourceVmDetails.Firmware + */ +class Firmware +{ + /** + * The firmware is unknown. + * + * Generated from protobuf enum FIRMWARE_UNSPECIFIED = 0; + */ + const FIRMWARE_UNSPECIFIED = 0; + /** + * The firmware is EFI. + * + * Generated from protobuf enum EFI = 1; + */ + const EFI = 1; + /** + * The firmware is BIOS. + * + * Generated from protobuf enum BIOS = 2; + */ + const BIOS = 2; + + private static $valueToName = [ + self::FIRMWARE_UNSPECIFIED => 'FIRMWARE_UNSPECIFIED', + self::EFI => 'EFI', + self::BIOS => 'BIOS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Firmware::class, \Google\Cloud\VMMigration\V1\AwsSourceVmDetails_Firmware::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails.php new file mode 100644 index 00000000000..7535504cdd7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails.php @@ -0,0 +1,645 @@ +google.cloud.vmmigration.v1.AwsVmDetails + */ +class AwsVmDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The VM ID in AWS. + * + * Generated from protobuf field string vm_id = 1; + */ + protected $vm_id = ''; + /** + * The display name of the VM. Note that this value is not necessarily unique. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The id of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_id = 3; + */ + protected $source_id = ''; + /** + * The descriptive name of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_description = 4; + */ + protected $source_description = ''; + /** + * Output only. The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.PowerState power_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $power_state = 0; + /** + * The number of cpus the VM has. + * + * Generated from protobuf field int32 cpu_count = 6; + */ + protected $cpu_count = 0; + /** + * The memory size of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 7; + */ + protected $memory_mb = 0; + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 8; + */ + protected $disk_count = 0; + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 9; + */ + protected $committed_storage_mb = 0; + /** + * The VM's OS. + * + * Generated from protobuf field string os_description = 10; + */ + protected $os_description = ''; + /** + * The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.BootOption boot_option = 11; + */ + protected $boot_option = 0; + /** + * The instance type of the VM. + * + * Generated from protobuf field string instance_type = 12; + */ + protected $instance_type = ''; + /** + * The VPC ID the VM belongs to. + * + * Generated from protobuf field string vpc_id = 13; + */ + protected $vpc_id = ''; + /** + * The security groups the VM belongs to. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSecurityGroup security_groups = 14; + */ + private $security_groups; + /** + * The tags of the VM. + * + * Generated from protobuf field map tags = 15; + */ + private $tags; + /** + * The AWS zone of the VM. + * + * Generated from protobuf field string zone = 16; + */ + protected $zone = ''; + /** + * The virtualization type. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmVirtualizationType virtualization_type = 17; + */ + protected $virtualization_type = 0; + /** + * The CPU architecture. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmArchitecture architecture = 18; + */ + protected $architecture = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vm_id + * The VM ID in AWS. + * @type string $display_name + * The display name of the VM. Note that this value is not necessarily unique. + * @type string $source_id + * The id of the AWS's source this VM is connected to. + * @type string $source_description + * The descriptive name of the AWS's source this VM is connected to. + * @type int $power_state + * Output only. The power state of the VM at the moment list was taken. + * @type int $cpu_count + * The number of cpus the VM has. + * @type int $memory_mb + * The memory size of the VM in MB. + * @type int $disk_count + * The number of disks the VM has. + * @type int|string $committed_storage_mb + * The total size of the storage allocated to the VM in MB. + * @type string $os_description + * The VM's OS. + * @type int $boot_option + * The VM Boot Option. + * @type string $instance_type + * The instance type of the VM. + * @type string $vpc_id + * The VPC ID the VM belongs to. + * @type array<\Google\Cloud\VMMigration\V1\AwsSecurityGroup>|\Google\Protobuf\Internal\RepeatedField $security_groups + * The security groups the VM belongs to. + * @type array|\Google\Protobuf\Internal\MapField $tags + * The tags of the VM. + * @type string $zone + * The AWS zone of the VM. + * @type int $virtualization_type + * The virtualization type. + * @type int $architecture + * The CPU architecture. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The VM ID in AWS. + * + * Generated from protobuf field string vm_id = 1; + * @return string + */ + public function getVmId() + { + return $this->vm_id; + } + + /** + * The VM ID in AWS. + * + * Generated from protobuf field string vm_id = 1; + * @param string $var + * @return $this + */ + public function setVmId($var) + { + GPBUtil::checkString($var, True); + $this->vm_id = $var; + + return $this; + } + + /** + * The display name of the VM. Note that this value is not necessarily unique. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the VM. Note that this value is not necessarily unique. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The id of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_id = 3; + * @return string + */ + public function getSourceId() + { + return $this->source_id; + } + + /** + * The id of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_id = 3; + * @param string $var + * @return $this + */ + public function setSourceId($var) + { + GPBUtil::checkString($var, True); + $this->source_id = $var; + + return $this; + } + + /** + * The descriptive name of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_description = 4; + * @return string + */ + public function getSourceDescription() + { + return $this->source_description; + } + + /** + * The descriptive name of the AWS's source this VM is connected to. + * + * Generated from protobuf field string source_description = 4; + * @param string $var + * @return $this + */ + public function setSourceDescription($var) + { + GPBUtil::checkString($var, True); + $this->source_description = $var; + + return $this; + } + + /** + * Output only. The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.PowerState power_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getPowerState() + { + return $this->power_state; + } + + /** + * Output only. The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.PowerState power_state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setPowerState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsVmDetails\PowerState::class); + $this->power_state = $var; + + return $this; + } + + /** + * The number of cpus the VM has. + * + * Generated from protobuf field int32 cpu_count = 6; + * @return int + */ + public function getCpuCount() + { + return $this->cpu_count; + } + + /** + * The number of cpus the VM has. + * + * Generated from protobuf field int32 cpu_count = 6; + * @param int $var + * @return $this + */ + public function setCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->cpu_count = $var; + + return $this; + } + + /** + * The memory size of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 7; + * @return int + */ + public function getMemoryMb() + { + return $this->memory_mb; + } + + /** + * The memory size of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 7; + * @param int $var + * @return $this + */ + public function setMemoryMb($var) + { + GPBUtil::checkInt32($var); + $this->memory_mb = $var; + + return $this; + } + + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 8; + * @return int + */ + public function getDiskCount() + { + return $this->disk_count; + } + + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 8; + * @param int $var + * @return $this + */ + public function setDiskCount($var) + { + GPBUtil::checkInt32($var); + $this->disk_count = $var; + + return $this; + } + + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 9; + * @return int|string + */ + public function getCommittedStorageMb() + { + return $this->committed_storage_mb; + } + + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 9; + * @param int|string $var + * @return $this + */ + public function setCommittedStorageMb($var) + { + GPBUtil::checkInt64($var); + $this->committed_storage_mb = $var; + + return $this; + } + + /** + * The VM's OS. + * + * Generated from protobuf field string os_description = 10; + * @return string + */ + public function getOsDescription() + { + return $this->os_description; + } + + /** + * The VM's OS. + * + * Generated from protobuf field string os_description = 10; + * @param string $var + * @return $this + */ + public function setOsDescription($var) + { + GPBUtil::checkString($var, True); + $this->os_description = $var; + + return $this; + } + + /** + * The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.BootOption boot_option = 11; + * @return int + */ + public function getBootOption() + { + return $this->boot_option; + } + + /** + * The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.BootOption boot_option = 11; + * @param int $var + * @return $this + */ + public function setBootOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsVmDetails\BootOption::class); + $this->boot_option = $var; + + return $this; + } + + /** + * The instance type of the VM. + * + * Generated from protobuf field string instance_type = 12; + * @return string + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * The instance type of the VM. + * + * Generated from protobuf field string instance_type = 12; + * @param string $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkString($var, True); + $this->instance_type = $var; + + return $this; + } + + /** + * The VPC ID the VM belongs to. + * + * Generated from protobuf field string vpc_id = 13; + * @return string + */ + public function getVpcId() + { + return $this->vpc_id; + } + + /** + * The VPC ID the VM belongs to. + * + * Generated from protobuf field string vpc_id = 13; + * @param string $var + * @return $this + */ + public function setVpcId($var) + { + GPBUtil::checkString($var, True); + $this->vpc_id = $var; + + return $this; + } + + /** + * The security groups the VM belongs to. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSecurityGroup security_groups = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecurityGroups() + { + return $this->security_groups; + } + + /** + * The security groups the VM belongs to. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsSecurityGroup security_groups = 14; + * @param array<\Google\Cloud\VMMigration\V1\AwsSecurityGroup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecurityGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\AwsSecurityGroup::class); + $this->security_groups = $arr; + + return $this; + } + + /** + * The tags of the VM. + * + * Generated from protobuf field map tags = 15; + * @return \Google\Protobuf\Internal\MapField + */ + public function getTags() + { + return $this->tags; + } + + /** + * The tags of the VM. + * + * Generated from protobuf field map tags = 15; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setTags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->tags = $arr; + + return $this; + } + + /** + * The AWS zone of the VM. + * + * Generated from protobuf field string zone = 16; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * The AWS zone of the VM. + * + * Generated from protobuf field string zone = 16; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + + /** + * The virtualization type. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmVirtualizationType virtualization_type = 17; + * @return int + */ + public function getVirtualizationType() + { + return $this->virtualization_type; + } + + /** + * The virtualization type. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmVirtualizationType virtualization_type = 17; + * @param int $var + * @return $this + */ + public function setVirtualizationType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsVmDetails\VmVirtualizationType::class); + $this->virtualization_type = $var; + + return $this; + } + + /** + * The CPU architecture. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmArchitecture architecture = 18; + * @return int + */ + public function getArchitecture() + { + return $this->architecture; + } + + /** + * The CPU architecture. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmDetails.VmArchitecture architecture = 18; + * @param int $var + * @return $this + */ + public function setArchitecture($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\AwsVmDetails\VmArchitecture::class); + $this->architecture = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/BootOption.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/BootOption.php new file mode 100644 index 00000000000..208852fafad --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/BootOption.php @@ -0,0 +1,64 @@ +google.cloud.vmmigration.v1.AwsVmDetails.BootOption + */ +class BootOption +{ + /** + * The boot option is unknown. + * + * Generated from protobuf enum BOOT_OPTION_UNSPECIFIED = 0; + */ + const BOOT_OPTION_UNSPECIFIED = 0; + /** + * The boot option is UEFI. + * + * Generated from protobuf enum EFI = 1; + */ + const EFI = 1; + /** + * The boot option is LEGACY-BIOS. + * + * Generated from protobuf enum BIOS = 2; + */ + const BIOS = 2; + + private static $valueToName = [ + self::BOOT_OPTION_UNSPECIFIED => 'BOOT_OPTION_UNSPECIFIED', + self::EFI => 'EFI', + self::BIOS => 'BIOS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BootOption::class, \Google\Cloud\VMMigration\V1\AwsVmDetails_BootOption::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/PowerState.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/PowerState.php new file mode 100644 index 00000000000..5d90c29f782 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/PowerState.php @@ -0,0 +1,79 @@ +google.cloud.vmmigration.v1.AwsVmDetails.PowerState + */ +class PowerState +{ + /** + * Power state is not specified. + * + * Generated from protobuf enum POWER_STATE_UNSPECIFIED = 0; + */ + const POWER_STATE_UNSPECIFIED = 0; + /** + * The VM is turned on. + * + * Generated from protobuf enum ON = 1; + */ + const ON = 1; + /** + * The VM is turned off. + * + * Generated from protobuf enum OFF = 2; + */ + const OFF = 2; + /** + * The VM is suspended. This is similar to hibernation or sleep + * mode. + * + * Generated from protobuf enum SUSPENDED = 3; + */ + const SUSPENDED = 3; + /** + * The VM is starting. + * + * Generated from protobuf enum PENDING = 4; + */ + const PENDING = 4; + + private static $valueToName = [ + self::POWER_STATE_UNSPECIFIED => 'POWER_STATE_UNSPECIFIED', + self::ON => 'ON', + self::OFF => 'OFF', + self::SUSPENDED => 'SUSPENDED', + self::PENDING => 'PENDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PowerState::class, \Google\Cloud\VMMigration\V1\AwsVmDetails_PowerState::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmArchitecture.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmArchitecture.php new file mode 100644 index 00000000000..7f6c05454f5 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmArchitecture.php @@ -0,0 +1,78 @@ +google.cloud.vmmigration.v1.AwsVmDetails.VmArchitecture + */ +class VmArchitecture +{ + /** + * The architecture is unknown. + * + * Generated from protobuf enum VM_ARCHITECTURE_UNSPECIFIED = 0; + */ + const VM_ARCHITECTURE_UNSPECIFIED = 0; + /** + * The architecture is I386. + * + * Generated from protobuf enum I386 = 1; + */ + const I386 = 1; + /** + * The architecture is X86_64. + * + * Generated from protobuf enum X86_64 = 2; + */ + const X86_64 = 2; + /** + * The architecture is ARM64. + * + * Generated from protobuf enum ARM64 = 3; + */ + const ARM64 = 3; + /** + * The architecture is X86_64_MAC. + * + * Generated from protobuf enum X86_64_MAC = 4; + */ + const X86_64_MAC = 4; + + private static $valueToName = [ + self::VM_ARCHITECTURE_UNSPECIFIED => 'VM_ARCHITECTURE_UNSPECIFIED', + self::I386 => 'I386', + self::X86_64 => 'X86_64', + self::ARM64 => 'ARM64', + self::X86_64_MAC => 'X86_64_MAC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VmArchitecture::class, \Google\Cloud\VMMigration\V1\AwsVmDetails_VmArchitecture::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmVirtualizationType.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmVirtualizationType.php new file mode 100644 index 00000000000..ce8c0368635 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmDetails/VmVirtualizationType.php @@ -0,0 +1,64 @@ +google.cloud.vmmigration.v1.AwsVmDetails.VmVirtualizationType + */ +class VmVirtualizationType +{ + /** + * The virtualization type is unknown. + * + * Generated from protobuf enum VM_VIRTUALIZATION_TYPE_UNSPECIFIED = 0; + */ + const VM_VIRTUALIZATION_TYPE_UNSPECIFIED = 0; + /** + * The virtualziation type is HVM. + * + * Generated from protobuf enum HVM = 1; + */ + const HVM = 1; + /** + * The virtualziation type is PARAVIRTUAL. + * + * Generated from protobuf enum PARAVIRTUAL = 2; + */ + const PARAVIRTUAL = 2; + + private static $valueToName = [ + self::VM_VIRTUALIZATION_TYPE_UNSPECIFIED => 'VM_VIRTUALIZATION_TYPE_UNSPECIFIED', + self::HVM => 'HVM', + self::PARAVIRTUAL => 'PARAVIRTUAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VmVirtualizationType::class, \Google\Cloud\VMMigration\V1\AwsVmDetails_VmVirtualizationType::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmsDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmsDetails.php new file mode 100644 index 00000000000..c5027ecbc76 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/AwsVmsDetails.php @@ -0,0 +1,67 @@ +google.cloud.vmmigration.v1.AwsVmsDetails + */ +class AwsVmsDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The details of the AWS VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsVmDetails details = 1; + */ + private $details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\AwsVmDetails>|\Google\Protobuf\Internal\RepeatedField $details + * The details of the AWS VMs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The details of the AWS VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsVmDetails details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetails() + { + return $this->details; + } + + /** + * The details of the AWS VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.AwsVmDetails details = 1; + * @param array<\Google\Cloud\VMMigration\V1\AwsVmDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\AwsVmDetails::class); + $this->details = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobRequest.php new file mode 100644 index 00000000000..77cdadd5622 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.CancelCloneJobRequest + */ +class CancelCloneJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The clone job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The clone job id + * Please see {@see VmMigrationClient::cloneJobName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\CancelCloneJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The clone job id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The clone job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The clone job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobResponse.php new file mode 100644 index 00000000000..cd231e22cc6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCloneJobResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.CancelCloneJobResponse + */ +class CancelCloneJobResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobRequest.php new file mode 100644 index 00000000000..71738014938 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.CancelCutoverJobRequest + */ +class CancelCutoverJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The cutover job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The cutover job id + * Please see {@see VmMigrationClient::cutoverJobName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\CancelCutoverJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The cutover job id + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The cutover job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The cutover job id + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobResponse.php new file mode 100644 index 00000000000..9c3a234caab --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CancelCutoverJobResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.CancelCutoverJobResponse + */ +class CancelCutoverJobResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob.php new file mode 100644 index 00000000000..dd34db7de2c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob.php @@ -0,0 +1,370 @@ +google.cloud.vmmigration.v1.CloneJob + */ +class CloneJob extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the clone job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the clone job was ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The name of the clone. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. State of the clone job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_time = null; + /** + * Output only. Provides details for the errors that led to the Clone Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. The clone steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneStep steps = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $steps; + protected $target_vm_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails $compute_engine_target_details + * Output only. Details of the target VM in Compute Engine. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the clone job was created (as an API call, not when + * it was actually created in the target). + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the clone job was ended. + * @type string $name + * Output only. The name of the clone. + * @type int $state + * Output only. State of the clone job. + * @type \Google\Protobuf\Timestamp $state_time + * Output only. The time the state was last updated. + * @type \Google\Rpc\Status $error + * Output only. Provides details for the errors that led to the Clone Job's + * state. + * @type array<\Google\Cloud\VMMigration\V1\CloneStep>|\Google\Protobuf\Internal\RepeatedField $steps + * Output only. The clone steps list representing its progress. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDetails compute_engine_target_details = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails|null + */ + public function getComputeEngineTargetDetails() + { + return $this->readOneof(20); + } + + public function hasComputeEngineTargetDetails() + { + return $this->hasOneof(20); + } + + /** + * Output only. Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDetails compute_engine_target_details = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails $var + * @return $this + */ + public function setComputeEngineTargetDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * Output only. The time the clone job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the clone job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the clone job was ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the clone job was ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. The name of the clone. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the clone. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. State of the clone job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the clone job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob.State state = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\CloneJob\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStateTime() + { + return $this->state_time; + } + + public function hasStateTime() + { + return isset($this->state_time); + } + + public function clearStateTime() + { + unset($this->state_time); + } + + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->state_time = $var; + + return $this; + } + + /** + * Output only. Provides details for the errors that led to the Clone Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details for the errors that led to the Clone Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. The clone steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneStep steps = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Output only. The clone steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneStep steps = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CloneStep>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CloneStep::class); + $this->steps = $arr; + + return $this; + } + + /** + * @return string + */ + public function getTargetVmDetails() + { + return $this->whichOneof("target_vm_details"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob/State.php new file mode 100644 index 00000000000..a60e309260f --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneJob/State.php @@ -0,0 +1,100 @@ +google.cloud.vmmigration.v1.CloneJob.State + */ +class State +{ + /** + * The state is unknown. This is used for API compatibility only and is not + * used by the system. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The clone job has not yet started. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The clone job is active and running. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The clone job finished with errors. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The clone job finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 4; + */ + const SUCCEEDED = 4; + /** + * The clone job was cancelled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + /** + * The clone job is being cancelled. + * + * Generated from protobuf enum CANCELLING = 6; + */ + const CANCELLING = 6; + /** + * OS adaptation is running as part of the clone job to generate license. + * + * Generated from protobuf enum ADAPTING_OS = 7; + */ + const ADAPTING_OS = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::ACTIVE => 'ACTIVE', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::CANCELLING => 'CANCELLING', + self::ADAPTING_OS => 'ADAPTING_OS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\CloneJob_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneStep.php new file mode 100644 index 00000000000..38ffc545d9b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CloneStep.php @@ -0,0 +1,229 @@ +google.cloud.vmmigration.v1.CloneStep + */ +class CloneStep extends \Google\Protobuf\Internal\Message +{ + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + protected $step; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\AdaptingOSStep $adapting_os + * Adapting OS step. + * @type \Google\Cloud\VMMigration\V1\PreparingVMDisksStep $preparing_vm_disks + * Preparing VM disks step. + * @type \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep $instantiating_migrated_vm + * Instantiating migrated VM step. + * @type \Google\Protobuf\Timestamp $start_time + * The time the step has started. + * @type \Google\Protobuf\Timestamp $end_time + * The time the step has ended. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Adapting OS step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AdaptingOSStep adapting_os = 3; + * @return \Google\Cloud\VMMigration\V1\AdaptingOSStep|null + */ + public function getAdaptingOs() + { + return $this->readOneof(3); + } + + public function hasAdaptingOs() + { + return $this->hasOneof(3); + } + + /** + * Adapting OS step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AdaptingOSStep adapting_os = 3; + * @param \Google\Cloud\VMMigration\V1\AdaptingOSStep $var + * @return $this + */ + public function setAdaptingOs($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AdaptingOSStep::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Preparing VM disks step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PreparingVMDisksStep preparing_vm_disks = 4; + * @return \Google\Cloud\VMMigration\V1\PreparingVMDisksStep|null + */ + public function getPreparingVmDisks() + { + return $this->readOneof(4); + } + + public function hasPreparingVmDisks() + { + return $this->hasOneof(4); + } + + /** + * Preparing VM disks step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PreparingVMDisksStep preparing_vm_disks = 4; + * @param \Google\Cloud\VMMigration\V1\PreparingVMDisksStep $var + * @return $this + */ + public function setPreparingVmDisks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\PreparingVMDisksStep::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Instantiating migrated VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InstantiatingMigratedVMStep instantiating_migrated_vm = 5; + * @return \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep|null + */ + public function getInstantiatingMigratedVm() + { + return $this->readOneof(5); + } + + public function hasInstantiatingMigratedVm() + { + return $this->hasOneof(5); + } + + /** + * Instantiating migrated VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InstantiatingMigratedVMStep instantiating_migrated_vm = 5; + * @param \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep $var + * @return $this + */ + public function setInstantiatingMigratedVm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getStep() + { + return $this->whichOneof("step"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineBootOption.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineBootOption.php new file mode 100644 index 00000000000..efcc0ffce13 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineBootOption.php @@ -0,0 +1,61 @@ +google.cloud.vmmigration.v1.ComputeEngineBootOption + */ +class ComputeEngineBootOption +{ + /** + * The boot option is unknown. + * + * Generated from protobuf enum COMPUTE_ENGINE_BOOT_OPTION_UNSPECIFIED = 0; + */ + const COMPUTE_ENGINE_BOOT_OPTION_UNSPECIFIED = 0; + /** + * The boot option is EFI. + * + * Generated from protobuf enum COMPUTE_ENGINE_BOOT_OPTION_EFI = 1; + */ + const COMPUTE_ENGINE_BOOT_OPTION_EFI = 1; + /** + * The boot option is BIOS. + * + * Generated from protobuf enum COMPUTE_ENGINE_BOOT_OPTION_BIOS = 2; + */ + const COMPUTE_ENGINE_BOOT_OPTION_BIOS = 2; + + private static $valueToName = [ + self::COMPUTE_ENGINE_BOOT_OPTION_UNSPECIFIED => 'COMPUTE_ENGINE_BOOT_OPTION_UNSPECIFIED', + self::COMPUTE_ENGINE_BOOT_OPTION_EFI => 'COMPUTE_ENGINE_BOOT_OPTION_EFI', + self::COMPUTE_ENGINE_BOOT_OPTION_BIOS => 'COMPUTE_ENGINE_BOOT_OPTION_BIOS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineDiskType.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineDiskType.php new file mode 100644 index 00000000000..6dd7104b8f4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineDiskType.php @@ -0,0 +1,69 @@ +google.cloud.vmmigration.v1.ComputeEngineDiskType + */ +class ComputeEngineDiskType +{ + /** + * An unspecified disk type. Will be used as STANDARD. + * + * Generated from protobuf enum COMPUTE_ENGINE_DISK_TYPE_UNSPECIFIED = 0; + */ + const COMPUTE_ENGINE_DISK_TYPE_UNSPECIFIED = 0; + /** + * A Standard disk type. + * + * Generated from protobuf enum COMPUTE_ENGINE_DISK_TYPE_STANDARD = 1; + */ + const COMPUTE_ENGINE_DISK_TYPE_STANDARD = 1; + /** + * SSD hard disk type. + * + * Generated from protobuf enum COMPUTE_ENGINE_DISK_TYPE_SSD = 2; + */ + const COMPUTE_ENGINE_DISK_TYPE_SSD = 2; + /** + * An alternative to SSD persistent disks that balance performance and + * cost. + * + * Generated from protobuf enum COMPUTE_ENGINE_DISK_TYPE_BALANCED = 3; + */ + const COMPUTE_ENGINE_DISK_TYPE_BALANCED = 3; + + private static $valueToName = [ + self::COMPUTE_ENGINE_DISK_TYPE_UNSPECIFIED => 'COMPUTE_ENGINE_DISK_TYPE_UNSPECIFIED', + self::COMPUTE_ENGINE_DISK_TYPE_STANDARD => 'COMPUTE_ENGINE_DISK_TYPE_STANDARD', + self::COMPUTE_ENGINE_DISK_TYPE_SSD => 'COMPUTE_ENGINE_DISK_TYPE_SSD', + self::COMPUTE_ENGINE_DISK_TYPE_BALANCED => 'COMPUTE_ENGINE_DISK_TYPE_BALANCED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineLicenseType.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineLicenseType.php new file mode 100644 index 00000000000..427ea82b29b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineLicenseType.php @@ -0,0 +1,61 @@ +google.cloud.vmmigration.v1.ComputeEngineLicenseType + */ +class ComputeEngineLicenseType +{ + /** + * The license type is the default for the OS. + * + * Generated from protobuf enum COMPUTE_ENGINE_LICENSE_TYPE_DEFAULT = 0; + */ + const COMPUTE_ENGINE_LICENSE_TYPE_DEFAULT = 0; + /** + * The license type is Pay As You Go license type. + * + * Generated from protobuf enum COMPUTE_ENGINE_LICENSE_TYPE_PAYG = 1; + */ + const COMPUTE_ENGINE_LICENSE_TYPE_PAYG = 1; + /** + * The license type is Bring Your Own License type. + * + * Generated from protobuf enum COMPUTE_ENGINE_LICENSE_TYPE_BYOL = 2; + */ + const COMPUTE_ENGINE_LICENSE_TYPE_BYOL = 2; + + private static $valueToName = [ + self::COMPUTE_ENGINE_LICENSE_TYPE_DEFAULT => 'COMPUTE_ENGINE_LICENSE_TYPE_DEFAULT', + self::COMPUTE_ENGINE_LICENSE_TYPE_PAYG => 'COMPUTE_ENGINE_LICENSE_TYPE_PAYG', + self::COMPUTE_ENGINE_LICENSE_TYPE_BYOL => 'COMPUTE_ENGINE_LICENSE_TYPE_BYOL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDefaults.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDefaults.php new file mode 100644 index 00000000000..2745c0b602a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDefaults.php @@ -0,0 +1,674 @@ +google.cloud.vmmigration.v1.ComputeEngineTargetDefaults + */ +class ComputeEngineTargetDefaults extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + */ + protected $vm_name = ''; + /** + * The full path of the resource of type TargetProject which represents the + * Compute Engine project in which to create this VM. + * + * Generated from protobuf field string target_project = 2 [(.google.api.resource_reference) = { + */ + protected $target_project = ''; + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + */ + protected $zone = ''; + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + */ + protected $machine_type_series = ''; + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + */ + protected $machine_type = ''; + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + */ + private $network_tags; + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + */ + private $network_interfaces; + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + */ + protected $service_account = ''; + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + */ + protected $disk_type = 0; + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + */ + private $labels; + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + */ + protected $license_type = 0; + /** + * Output only. The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $applied_license = null; + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + */ + protected $compute_scheduling = null; + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + */ + protected $secure_boot = false; + /** + * Output only. The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $boot_option = 0; + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + */ + private $metadata; + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + */ + private $additional_licenses; + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + */ + protected $hostname = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vm_name + * The name of the VM to create. + * @type string $target_project + * The full path of the resource of type TargetProject which represents the + * Compute Engine project in which to create this VM. + * @type string $zone + * The zone in which to create the VM. + * @type string $machine_type_series + * The machine type series to create the VM with. + * @type string $machine_type + * The machine type to create the VM with. + * @type array|\Google\Protobuf\Internal\RepeatedField $network_tags + * A map of network tags to associate with the VM. + * @type array<\Google\Cloud\VMMigration\V1\NetworkInterface>|\Google\Protobuf\Internal\RepeatedField $network_interfaces + * List of NICs connected to this VM. + * @type string $service_account + * The service account to associate the VM with. + * @type int $disk_type + * The disk type to use in the VM. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A map of labels to associate with the VM. + * @type int $license_type + * The license type to use in OS adaptation. + * @type \Google\Cloud\VMMigration\V1\AppliedLicense $applied_license + * Output only. The OS license returned from the adaptation module report. + * @type \Google\Cloud\VMMigration\V1\ComputeScheduling $compute_scheduling + * Compute instance scheduling information (if empty default is used). + * @type bool $secure_boot + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * @type int $boot_option + * Output only. The VM Boot Option, as set in the source vm. + * @type array|\Google\Protobuf\Internal\MapField $metadata + * The metadata key/value pairs to assign to the VM. + * @type array|\Google\Protobuf\Internal\RepeatedField $additional_licenses + * Additional licenses to assign to the VM. + * @type string $hostname + * The hostname to assign to the VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + * @return string + */ + public function getVmName() + { + return $this->vm_name; + } + + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + * @param string $var + * @return $this + */ + public function setVmName($var) + { + GPBUtil::checkString($var, True); + $this->vm_name = $var; + + return $this; + } + + /** + * The full path of the resource of type TargetProject which represents the + * Compute Engine project in which to create this VM. + * + * Generated from protobuf field string target_project = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetProject() + { + return $this->target_project; + } + + /** + * The full path of the resource of type TargetProject which represents the + * Compute Engine project in which to create this VM. + * + * Generated from protobuf field string target_project = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetProject($var) + { + GPBUtil::checkString($var, True); + $this->target_project = $var; + + return $this; + } + + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + * @return string + */ + public function getMachineTypeSeries() + { + return $this->machine_type_series; + } + + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + * @param string $var + * @return $this + */ + public function setMachineTypeSeries($var) + { + GPBUtil::checkString($var, True); + $this->machine_type_series = $var; + + return $this; + } + + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + * @return string + */ + public function getMachineType() + { + return $this->machine_type; + } + + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + * @param string $var + * @return $this + */ + public function setMachineType($var) + { + GPBUtil::checkString($var, True); + $this->machine_type = $var; + + return $this; + } + + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkTags() + { + return $this->network_tags; + } + + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->network_tags = $arr; + + return $this; + } + + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkInterfaces() + { + return $this->network_interfaces; + } + + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + * @param array<\Google\Cloud\VMMigration\V1\NetworkInterface>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkInterfaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\NetworkInterface::class); + $this->network_interfaces = $arr; + + return $this; + } + + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + * @return int + */ + public function getDiskType() + { + return $this->disk_type; + } + + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + * @param int $var + * @return $this + */ + public function setDiskType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineDiskType::class); + $this->disk_type = $var; + + return $this; + } + + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + * @return int + */ + public function getLicenseType() + { + return $this->license_type; + } + + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + * @param int $var + * @return $this + */ + public function setLicenseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineLicenseType::class); + $this->license_type = $var; + + return $this; + } + + /** + * Output only. The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\AppliedLicense|null + */ + public function getAppliedLicense() + { + return $this->applied_license; + } + + public function hasAppliedLicense() + { + return isset($this->applied_license); + } + + public function clearAppliedLicense() + { + unset($this->applied_license); + } + + /** + * Output only. The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\AppliedLicense $var + * @return $this + */ + public function setAppliedLicense($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AppliedLicense::class); + $this->applied_license = $var; + + return $this; + } + + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + * @return \Google\Cloud\VMMigration\V1\ComputeScheduling|null + */ + public function getComputeScheduling() + { + return $this->compute_scheduling; + } + + public function hasComputeScheduling() + { + return isset($this->compute_scheduling); + } + + public function clearComputeScheduling() + { + unset($this->compute_scheduling); + } + + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + * @param \Google\Cloud\VMMigration\V1\ComputeScheduling $var + * @return $this + */ + public function setComputeScheduling($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ComputeScheduling::class); + $this->compute_scheduling = $var; + + return $this; + } + + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + * @return bool + */ + public function getSecureBoot() + { + return $this->secure_boot; + } + + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + * @param bool $var + * @return $this + */ + public function setSecureBoot($var) + { + GPBUtil::checkBool($var); + $this->secure_boot = $var; + + return $this; + } + + /** + * Output only. The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getBootOption() + { + return $this->boot_option; + } + + /** + * Output only. The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setBootOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineBootOption::class); + $this->boot_option = $var; + + return $this; + } + + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalLicenses() + { + return $this->additional_licenses; + } + + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalLicenses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->additional_licenses = $arr; + + return $this; + } + + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDetails.php new file mode 100644 index 00000000000..aaca78c7881 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeEngineTargetDetails.php @@ -0,0 +1,670 @@ +google.cloud.vmmigration.v1.ComputeEngineTargetDetails + */ +class ComputeEngineTargetDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + */ + protected $vm_name = ''; + /** + * The Google Cloud target project ID or project name. + * + * Generated from protobuf field string project = 2; + */ + protected $project = ''; + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + */ + protected $zone = ''; + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + */ + protected $machine_type_series = ''; + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + */ + protected $machine_type = ''; + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + */ + private $network_tags; + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + */ + private $network_interfaces; + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + */ + protected $service_account = ''; + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + */ + protected $disk_type = 0; + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + */ + private $labels; + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + */ + protected $license_type = 0; + /** + * The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12; + */ + protected $applied_license = null; + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + */ + protected $compute_scheduling = null; + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + */ + protected $secure_boot = false; + /** + * The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15; + */ + protected $boot_option = 0; + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + */ + private $metadata; + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + */ + private $additional_licenses; + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + */ + protected $hostname = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vm_name + * The name of the VM to create. + * @type string $project + * The Google Cloud target project ID or project name. + * @type string $zone + * The zone in which to create the VM. + * @type string $machine_type_series + * The machine type series to create the VM with. + * @type string $machine_type + * The machine type to create the VM with. + * @type array|\Google\Protobuf\Internal\RepeatedField $network_tags + * A map of network tags to associate with the VM. + * @type array<\Google\Cloud\VMMigration\V1\NetworkInterface>|\Google\Protobuf\Internal\RepeatedField $network_interfaces + * List of NICs connected to this VM. + * @type string $service_account + * The service account to associate the VM with. + * @type int $disk_type + * The disk type to use in the VM. + * @type array|\Google\Protobuf\Internal\MapField $labels + * A map of labels to associate with the VM. + * @type int $license_type + * The license type to use in OS adaptation. + * @type \Google\Cloud\VMMigration\V1\AppliedLicense $applied_license + * The OS license returned from the adaptation module report. + * @type \Google\Cloud\VMMigration\V1\ComputeScheduling $compute_scheduling + * Compute instance scheduling information (if empty default is used). + * @type bool $secure_boot + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * @type int $boot_option + * The VM Boot Option, as set in the source vm. + * @type array|\Google\Protobuf\Internal\MapField $metadata + * The metadata key/value pairs to assign to the VM. + * @type array|\Google\Protobuf\Internal\RepeatedField $additional_licenses + * Additional licenses to assign to the VM. + * @type string $hostname + * The hostname to assign to the VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + * @return string + */ + public function getVmName() + { + return $this->vm_name; + } + + /** + * The name of the VM to create. + * + * Generated from protobuf field string vm_name = 1; + * @param string $var + * @return $this + */ + public function setVmName($var) + { + GPBUtil::checkString($var, True); + $this->vm_name = $var; + + return $this; + } + + /** + * The Google Cloud target project ID or project name. + * + * Generated from protobuf field string project = 2; + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * The Google Cloud target project ID or project name. + * + * Generated from protobuf field string project = 2; + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + * @return string + */ + public function getZone() + { + return $this->zone; + } + + /** + * The zone in which to create the VM. + * + * Generated from protobuf field string zone = 3; + * @param string $var + * @return $this + */ + public function setZone($var) + { + GPBUtil::checkString($var, True); + $this->zone = $var; + + return $this; + } + + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + * @return string + */ + public function getMachineTypeSeries() + { + return $this->machine_type_series; + } + + /** + * The machine type series to create the VM with. + * + * Generated from protobuf field string machine_type_series = 4; + * @param string $var + * @return $this + */ + public function setMachineTypeSeries($var) + { + GPBUtil::checkString($var, True); + $this->machine_type_series = $var; + + return $this; + } + + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + * @return string + */ + public function getMachineType() + { + return $this->machine_type; + } + + /** + * The machine type to create the VM with. + * + * Generated from protobuf field string machine_type = 5; + * @param string $var + * @return $this + */ + public function setMachineType($var) + { + GPBUtil::checkString($var, True); + $this->machine_type = $var; + + return $this; + } + + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkTags() + { + return $this->network_tags; + } + + /** + * A map of network tags to associate with the VM. + * + * Generated from protobuf field repeated string network_tags = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkTags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->network_tags = $arr; + + return $this; + } + + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkInterfaces() + { + return $this->network_interfaces; + } + + /** + * List of NICs connected to this VM. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.NetworkInterface network_interfaces = 7; + * @param array<\Google\Cloud\VMMigration\V1\NetworkInterface>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkInterfaces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\NetworkInterface::class); + $this->network_interfaces = $arr; + + return $this; + } + + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * The service account to associate the VM with. + * + * Generated from protobuf field string service_account = 8; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + * @return int + */ + public function getDiskType() + { + return $this->disk_type; + } + + /** + * The disk type to use in the VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineDiskType disk_type = 9; + * @param int $var + * @return $this + */ + public function setDiskType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineDiskType::class); + $this->disk_type = $var; + + return $this; + } + + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * A map of labels to associate with the VM. + * + * Generated from protobuf field map labels = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + * @return int + */ + public function getLicenseType() + { + return $this->license_type; + } + + /** + * The license type to use in OS adaptation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineLicenseType license_type = 11; + * @param int $var + * @return $this + */ + public function setLicenseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineLicenseType::class); + $this->license_type = $var; + + return $this; + } + + /** + * The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12; + * @return \Google\Cloud\VMMigration\V1\AppliedLicense|null + */ + public function getAppliedLicense() + { + return $this->applied_license; + } + + public function hasAppliedLicense() + { + return isset($this->applied_license); + } + + public function clearAppliedLicense() + { + unset($this->applied_license); + } + + /** + * The OS license returned from the adaptation module report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AppliedLicense applied_license = 12; + * @param \Google\Cloud\VMMigration\V1\AppliedLicense $var + * @return $this + */ + public function setAppliedLicense($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AppliedLicense::class); + $this->applied_license = $var; + + return $this; + } + + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + * @return \Google\Cloud\VMMigration\V1\ComputeScheduling|null + */ + public function getComputeScheduling() + { + return $this->compute_scheduling; + } + + public function hasComputeScheduling() + { + return isset($this->compute_scheduling); + } + + public function clearComputeScheduling() + { + unset($this->compute_scheduling); + } + + /** + * Compute instance scheduling information (if empty default is used). + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling compute_scheduling = 13; + * @param \Google\Cloud\VMMigration\V1\ComputeScheduling $var + * @return $this + */ + public function setComputeScheduling($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ComputeScheduling::class); + $this->compute_scheduling = $var; + + return $this; + } + + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + * @return bool + */ + public function getSecureBoot() + { + return $this->secure_boot; + } + + /** + * Defines whether the instance has Secure Boot enabled. + * This can be set to true only if the vm boot option is EFI. + * + * Generated from protobuf field bool secure_boot = 14; + * @param bool $var + * @return $this + */ + public function setSecureBoot($var) + { + GPBUtil::checkBool($var); + $this->secure_boot = $var; + + return $this; + } + + /** + * The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15; + * @return int + */ + public function getBootOption() + { + return $this->boot_option; + } + + /** + * The VM Boot Option, as set in the source vm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineBootOption boot_option = 15; + * @param int $var + * @return $this + */ + public function setBootOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeEngineBootOption::class); + $this->boot_option = $var; + + return $this; + } + + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getMetadata() + { + return $this->metadata; + } + + /** + * The metadata key/value pairs to assign to the VM. + * + * Generated from protobuf field map metadata = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->metadata = $arr; + + return $this; + } + + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalLicenses() + { + return $this->additional_licenses; + } + + /** + * Additional licenses to assign to the VM. + * + * Generated from protobuf field repeated string additional_licenses = 17; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalLicenses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->additional_licenses = $arr; + + return $this; + } + + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * The hostname to assign to the VM. + * + * Generated from protobuf field string hostname = 18; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling.php new file mode 100644 index 00000000000..bc30aaa06e3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling.php @@ -0,0 +1,206 @@ +google.cloud.vmmigration.v1.ComputeScheduling + */ +class ComputeScheduling extends \Google\Protobuf\Internal\Message +{ + /** + * How the instance should behave when the host machine undergoes + * maintenance that may temporarily impact instance performance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1; + */ + protected $on_host_maintenance = 0; + /** + * Whether the Instance should be automatically restarted whenever it is + * terminated by Compute Engine (not terminated by user). + * This configuration is identical to `automaticRestart` field in Compute + * Engine create instance under scheduling. + * It was changed to an enum (instead of a boolean) to match the default + * value in Compute Engine which is automatic restart. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5; + */ + protected $restart_type = 0; + /** + * A set of node affinity and anti-affinity configurations for sole tenant + * nodes. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3; + */ + private $node_affinities; + /** + * The minimum number of virtual CPUs this instance will consume when + * running on a sole-tenant node. Ignored if no node_affinites are + * configured. + * + * Generated from protobuf field int32 min_node_cpus = 4; + */ + protected $min_node_cpus = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $on_host_maintenance + * How the instance should behave when the host machine undergoes + * maintenance that may temporarily impact instance performance. + * @type int $restart_type + * Whether the Instance should be automatically restarted whenever it is + * terminated by Compute Engine (not terminated by user). + * This configuration is identical to `automaticRestart` field in Compute + * Engine create instance under scheduling. + * It was changed to an enum (instead of a boolean) to match the default + * value in Compute Engine which is automatic restart. + * @type array<\Google\Cloud\VMMigration\V1\SchedulingNodeAffinity>|\Google\Protobuf\Internal\RepeatedField $node_affinities + * A set of node affinity and anti-affinity configurations for sole tenant + * nodes. + * @type int $min_node_cpus + * The minimum number of virtual CPUs this instance will consume when + * running on a sole-tenant node. Ignored if no node_affinites are + * configured. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * How the instance should behave when the host machine undergoes + * maintenance that may temporarily impact instance performance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1; + * @return int + */ + public function getOnHostMaintenance() + { + return $this->on_host_maintenance; + } + + /** + * How the instance should behave when the host machine undergoes + * maintenance that may temporarily impact instance performance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance on_host_maintenance = 1; + * @param int $var + * @return $this + */ + public function setOnHostMaintenance($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeScheduling\OnHostMaintenance::class); + $this->on_host_maintenance = $var; + + return $this; + } + + /** + * Whether the Instance should be automatically restarted whenever it is + * terminated by Compute Engine (not terminated by user). + * This configuration is identical to `automaticRestart` field in Compute + * Engine create instance under scheduling. + * It was changed to an enum (instead of a boolean) to match the default + * value in Compute Engine which is automatic restart. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5; + * @return int + */ + public function getRestartType() + { + return $this->restart_type; + } + + /** + * Whether the Instance should be automatically restarted whenever it is + * terminated by Compute Engine (not terminated by user). + * This configuration is identical to `automaticRestart` field in Compute + * Engine create instance under scheduling. + * It was changed to an enum (instead of a boolean) to match the default + * value in Compute Engine which is automatic restart. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeScheduling.RestartType restart_type = 5; + * @param int $var + * @return $this + */ + public function setRestartType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ComputeScheduling\RestartType::class); + $this->restart_type = $var; + + return $this; + } + + /** + * A set of node affinity and anti-affinity configurations for sole tenant + * nodes. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodeAffinities() + { + return $this->node_affinities; + } + + /** + * A set of node affinity and anti-affinity configurations for sole tenant + * nodes. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.SchedulingNodeAffinity node_affinities = 3; + * @param array<\Google\Cloud\VMMigration\V1\SchedulingNodeAffinity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodeAffinities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\SchedulingNodeAffinity::class); + $this->node_affinities = $arr; + + return $this; + } + + /** + * The minimum number of virtual CPUs this instance will consume when + * running on a sole-tenant node. Ignored if no node_affinites are + * configured. + * + * Generated from protobuf field int32 min_node_cpus = 4; + * @return int + */ + public function getMinNodeCpus() + { + return $this->min_node_cpus; + } + + /** + * The minimum number of virtual CPUs this instance will consume when + * running on a sole-tenant node. Ignored if no node_affinites are + * configured. + * + * Generated from protobuf field int32 min_node_cpus = 4; + * @param int $var + * @return $this + */ + public function setMinNodeCpus($var) + { + GPBUtil::checkInt32($var); + $this->min_node_cpus = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/OnHostMaintenance.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/OnHostMaintenance.php new file mode 100644 index 00000000000..2289facddca --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/OnHostMaintenance.php @@ -0,0 +1,62 @@ +google.cloud.vmmigration.v1.ComputeScheduling.OnHostMaintenance + */ +class OnHostMaintenance +{ + /** + * An unknown, unexpected behavior. + * + * Generated from protobuf enum ON_HOST_MAINTENANCE_UNSPECIFIED = 0; + */ + const ON_HOST_MAINTENANCE_UNSPECIFIED = 0; + /** + * Terminate the instance when the host machine undergoes maintenance. + * + * Generated from protobuf enum TERMINATE = 1; + */ + const TERMINATE = 1; + /** + * Migrate the instance when the host machine undergoes maintenance. + * + * Generated from protobuf enum MIGRATE = 2; + */ + const MIGRATE = 2; + + private static $valueToName = [ + self::ON_HOST_MAINTENANCE_UNSPECIFIED => 'ON_HOST_MAINTENANCE_UNSPECIFIED', + self::TERMINATE => 'TERMINATE', + self::MIGRATE => 'MIGRATE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OnHostMaintenance::class, \Google\Cloud\VMMigration\V1\ComputeScheduling_OnHostMaintenance::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/RestartType.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/RestartType.php new file mode 100644 index 00000000000..f84ad38270f --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ComputeScheduling/RestartType.php @@ -0,0 +1,67 @@ +google.cloud.vmmigration.v1.ComputeScheduling.RestartType + */ +class RestartType +{ + /** + * Unspecified behavior. This will use the default. + * + * Generated from protobuf enum RESTART_TYPE_UNSPECIFIED = 0; + */ + const RESTART_TYPE_UNSPECIFIED = 0; + /** + * The Instance should be automatically restarted whenever it is + * terminated by Compute Engine. + * + * Generated from protobuf enum AUTOMATIC_RESTART = 1; + */ + const AUTOMATIC_RESTART = 1; + /** + * The Instance isn't automatically restarted whenever it is + * terminated by Compute Engine. + * + * Generated from protobuf enum NO_AUTOMATIC_RESTART = 2; + */ + const NO_AUTOMATIC_RESTART = 2; + + private static $valueToName = [ + self::RESTART_TYPE_UNSPECIFIED => 'RESTART_TYPE_UNSPECIFIED', + self::AUTOMATIC_RESTART => 'AUTOMATIC_RESTART', + self::NO_AUTOMATIC_RESTART => 'NO_AUTOMATIC_RESTART', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RestartType::class, \Google\Cloud\VMMigration\V1\ComputeScheduling_RestartType::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCloneJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCloneJobRequest.php new file mode 100644 index 00000000000..41851b8961e --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCloneJobRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateCloneJobRequest + */ +class CreateCloneJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Clone's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The clone job identifier. + * + * Generated from protobuf field string clone_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $clone_job_id = ''; + /** + * Required. The clone request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob clone_job = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $clone_job = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The Clone's parent. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\CloneJob $cloneJob Required. The clone request body. + * @param string $cloneJobId Required. The clone job identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateCloneJobRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\CloneJob $cloneJob, string $cloneJobId): self + { + return (new self()) + ->setParent($parent) + ->setCloneJob($cloneJob) + ->setCloneJobId($cloneJobId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Clone's parent. + * @type string $clone_job_id + * Required. The clone job identifier. + * @type \Google\Cloud\VMMigration\V1\CloneJob $clone_job + * Required. The clone request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Clone's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Clone's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The clone job identifier. + * + * Generated from protobuf field string clone_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCloneJobId() + { + return $this->clone_job_id; + } + + /** + * Required. The clone job identifier. + * + * Generated from protobuf field string clone_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCloneJobId($var) + { + GPBUtil::checkString($var, True); + $this->clone_job_id = $var; + + return $this; + } + + /** + * Required. The clone request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob clone_job = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\CloneJob|null + */ + public function getCloneJob() + { + return $this->clone_job; + } + + public function hasCloneJob() + { + return isset($this->clone_job); + } + + public function clearCloneJob() + { + unset($this->clone_job); + } + + /** + * Required. The clone request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CloneJob clone_job = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\CloneJob $var + * @return $this + */ + public function setCloneJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\CloneJob::class); + $this->clone_job = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCutoverJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCutoverJobRequest.php new file mode 100644 index 00000000000..ca9cc759834 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateCutoverJobRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateCutoverJobRequest + */ +class CreateCutoverJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Cutover's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The cutover job identifier. + * + * Generated from protobuf field string cutover_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cutover_job_id = ''; + /** + * Required. The cutover request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob cutover_job = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cutover_job = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The Cutover's parent. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\CutoverJob $cutoverJob Required. The cutover request body. + * @param string $cutoverJobId Required. The cutover job identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateCutoverJobRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\CutoverJob $cutoverJob, string $cutoverJobId): self + { + return (new self()) + ->setParent($parent) + ->setCutoverJob($cutoverJob) + ->setCutoverJobId($cutoverJobId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Cutover's parent. + * @type string $cutover_job_id + * Required. The cutover job identifier. + * @type \Google\Cloud\VMMigration\V1\CutoverJob $cutover_job + * Required. The cutover request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Cutover's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Cutover's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The cutover job identifier. + * + * Generated from protobuf field string cutover_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCutoverJobId() + { + return $this->cutover_job_id; + } + + /** + * Required. The cutover job identifier. + * + * Generated from protobuf field string cutover_job_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCutoverJobId($var) + { + GPBUtil::checkString($var, True); + $this->cutover_job_id = $var; + + return $this; + } + + /** + * Required. The cutover request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob cutover_job = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\CutoverJob|null + */ + public function getCutoverJob() + { + return $this->cutover_job; + } + + public function hasCutoverJob() + { + return isset($this->cutover_job); + } + + public function clearCutoverJob() + { + unset($this->cutover_job); + } + + /** + * Required. The cutover request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob cutover_job = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\CutoverJob $var + * @return $this + */ + public function setCutoverJob($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\CutoverJob::class); + $this->cutover_job = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateDatacenterConnectorRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateDatacenterConnectorRequest.php new file mode 100644 index 00000000000..ec4aaf84d99 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateDatacenterConnectorRequest.php @@ -0,0 +1,252 @@ +google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest + */ +class CreateDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The datacenterConnector identifier. + * + * Generated from protobuf field string datacenter_connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $datacenter_connector_id = ''; + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connector = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $datacenter_connector = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * Please see {@see VmMigrationClient::sourceName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\DatacenterConnector $datacenterConnector Required. The create request body. + * @param string $datacenterConnectorId Required. The datacenterConnector identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateDatacenterConnectorRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\DatacenterConnector $datacenterConnector, string $datacenterConnectorId): self + { + return (new self()) + ->setParent($parent) + ->setDatacenterConnector($datacenterConnector) + ->setDatacenterConnectorId($datacenterConnectorId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * @type string $datacenter_connector_id + * Required. The datacenterConnector identifier. + * @type \Google\Cloud\VMMigration\V1\DatacenterConnector $datacenter_connector + * Required. The create request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The datacenterConnector identifier. + * + * Generated from protobuf field string datacenter_connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDatacenterConnectorId() + { + return $this->datacenter_connector_id; + } + + /** + * Required. The datacenterConnector identifier. + * + * Generated from protobuf field string datacenter_connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDatacenterConnectorId($var) + { + GPBUtil::checkString($var, True); + $this->datacenter_connector_id = $var; + + return $this; + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connector = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\DatacenterConnector|null + */ + public function getDatacenterConnector() + { + return $this->datacenter_connector; + } + + public function hasDatacenterConnector() + { + return isset($this->datacenter_connector); + } + + public function clearDatacenterConnector() + { + unset($this->datacenter_connector); + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connector = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\DatacenterConnector $var + * @return $this + */ + public function setDatacenterConnector($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\DatacenterConnector::class); + $this->datacenter_connector = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateGroupRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateGroupRequest.php new file mode 100644 index 00000000000..de9bfaea893 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateGroupRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateGroupRequest + */ +class CreateGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Group's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The group identifier. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group_id = ''; + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The Group's parent. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\Group $group Required. The create request body. + * @param string $groupId Required. The group identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateGroupRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\Group $group, string $groupId): self + { + return (new self()) + ->setParent($parent) + ->setGroup($group) + ->setGroupId($groupId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Group's parent. + * @type string $group_id + * Required. The group identifier. + * @type \Google\Cloud\VMMigration\V1\Group $group + * Required. The create request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Group's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Group's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The group identifier. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGroupId() + { + return $this->group_id; + } + + /** + * Required. The group identifier. + * + * Generated from protobuf field string group_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGroupId($var) + { + GPBUtil::checkString($var, True); + $this->group_id = $var; + + return $this; + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\Group|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\Group $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\Group::class); + $this->group = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateMigratingVmRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateMigratingVmRequest.php new file mode 100644 index 00000000000..c12c649f502 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateMigratingVmRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateMigratingVmRequest + */ +class CreateMigratingVmRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The MigratingVm's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The migratingVm identifier. + * + * Generated from protobuf field string migrating_vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $migrating_vm_id = ''; + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $migrating_vm = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The MigratingVm's parent. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\MigratingVm $migratingVm Required. The create request body. + * @param string $migratingVmId Required. The migratingVm identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateMigratingVmRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\MigratingVm $migratingVm, string $migratingVmId): self + { + return (new self()) + ->setParent($parent) + ->setMigratingVm($migratingVm) + ->setMigratingVmId($migratingVmId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The MigratingVm's parent. + * @type string $migrating_vm_id + * Required. The migratingVm identifier. + * @type \Google\Cloud\VMMigration\V1\MigratingVm $migrating_vm + * Required. The create request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The MigratingVm's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The MigratingVm's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The migratingVm identifier. + * + * Generated from protobuf field string migrating_vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMigratingVmId() + { + return $this->migrating_vm_id; + } + + /** + * Required. The migratingVm identifier. + * + * Generated from protobuf field string migrating_vm_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMigratingVmId($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm_id = $var; + + return $this; + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\MigratingVm|null + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + public function hasMigratingVm() + { + return isset($this->migrating_vm); + } + + public function clearMigratingVm() + { + unset($this->migrating_vm); + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\MigratingVm $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\MigratingVm::class); + $this->migrating_vm = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateSourceRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateSourceRequest.php new file mode 100644 index 00000000000..525bb5819b4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateSourceRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateSourceRequest + */ +class CreateSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Source's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The source identifier. + * + * Generated from protobuf field string source_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_id = ''; + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The Source's parent. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\Source $source Required. The create request body. + * @param string $sourceId Required. The source identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateSourceRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\Source $source, string $sourceId): self + { + return (new self()) + ->setParent($parent) + ->setSource($source) + ->setSourceId($sourceId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Source's parent. + * @type string $source_id + * Required. The source identifier. + * @type \Google\Cloud\VMMigration\V1\Source $source + * Required. The create request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Source's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Source's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The source identifier. + * + * Generated from protobuf field string source_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceId() + { + return $this->source_id; + } + + /** + * Required. The source identifier. + * + * Generated from protobuf field string source_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceId($var) + { + GPBUtil::checkString($var, True); + $this->source_id = $var; + + return $this; + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\Source|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\Source::class); + $this->source = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateTargetProjectRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateTargetProjectRequest.php new file mode 100644 index 00000000000..fa7e25ef615 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateTargetProjectRequest.php @@ -0,0 +1,237 @@ +google.cloud.vmmigration.v1.CreateTargetProjectRequest + */ +class CreateTargetProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The TargetProject's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The target_project identifier. + * + * Generated from protobuf field string target_project_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_project_id = ''; + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_project = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The TargetProject's parent. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\TargetProject $targetProject Required. The create request body. + * @param string $targetProjectId Required. The target_project identifier. + * + * @return \Google\Cloud\VMMigration\V1\CreateTargetProjectRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\TargetProject $targetProject, string $targetProjectId): self + { + return (new self()) + ->setParent($parent) + ->setTargetProject($targetProject) + ->setTargetProjectId($targetProjectId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The TargetProject's parent. + * @type string $target_project_id + * Required. The target_project identifier. + * @type \Google\Cloud\VMMigration\V1\TargetProject $target_project + * Required. The create request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The TargetProject's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The TargetProject's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The target_project identifier. + * + * Generated from protobuf field string target_project_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetProjectId() + { + return $this->target_project_id; + } + + /** + * Required. The target_project identifier. + * + * Generated from protobuf field string target_project_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetProjectId($var) + { + GPBUtil::checkString($var, True); + $this->target_project_id = $var; + + return $this; + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\TargetProject|null + */ + public function getTargetProject() + { + return $this->target_project; + } + + public function hasTargetProject() + { + return isset($this->target_project); + } + + public function clearTargetProject() + { + unset($this->target_project); + } + + /** + * Required. The create request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\TargetProject $var + * @return $this + */ + public function setTargetProject($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\TargetProject::class); + $this->target_project = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateUtilizationReportRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateUtilizationReportRequest.php new file mode 100644 index 00000000000..80a507c4970 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CreateUtilizationReportRequest.php @@ -0,0 +1,258 @@ +google.cloud.vmmigration.v1.CreateUtilizationReportRequest + */ +class CreateUtilizationReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Utilization Report's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The report to create. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport utilization_report = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $utilization_report = null; + /** + * Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * + * Generated from protobuf field string utilization_report_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $utilization_report_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The Utilization Report's parent. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * @param \Google\Cloud\VMMigration\V1\UtilizationReport $utilizationReport Required. The report to create. + * @param string $utilizationReportId Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * + * @return \Google\Cloud\VMMigration\V1\CreateUtilizationReportRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VMMigration\V1\UtilizationReport $utilizationReport, string $utilizationReportId): self + { + return (new self()) + ->setParent($parent) + ->setUtilizationReport($utilizationReport) + ->setUtilizationReportId($utilizationReportId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Utilization Report's parent. + * @type \Google\Cloud\VMMigration\V1\UtilizationReport $utilization_report + * Required. The report to create. + * @type string $utilization_report_id + * Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Utilization Report's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Utilization Report's parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The report to create. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport utilization_report = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\UtilizationReport|null + */ + public function getUtilizationReport() + { + return $this->utilization_report; + } + + public function hasUtilizationReport() + { + return isset($this->utilization_report); + } + + public function clearUtilizationReport() + { + unset($this->utilization_report); + } + + /** + * Required. The report to create. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport utilization_report = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\UtilizationReport $var + * @return $this + */ + public function setUtilizationReport($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\UtilizationReport::class); + $this->utilization_report = $var; + + return $this; + } + + /** + * Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * + * Generated from protobuf field string utilization_report_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUtilizationReportId() + { + return $this->utilization_report_id; + } + + /** + * Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * + * Generated from protobuf field string utilization_report_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUtilizationReportId($var) + { + GPBUtil::checkString($var, True); + $this->utilization_report_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob.php new file mode 100644 index 00000000000..3fafe9c8c7e --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob.php @@ -0,0 +1,435 @@ +google.cloud.vmmigration.v1.CutoverJob + */ +class CutoverJob extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the cutover job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the cutover job had finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. The name of the cutover job. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. State of the cutover job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_time = null; + /** + * Output only. The current progress in percentage of the cutover job. + * + * Generated from protobuf field int32 progress_percent = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $progress_percent = 0; + /** + * Output only. Provides details for the errors that led to the Cutover Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. A message providing possible extra details about the current + * state. + * + * Generated from protobuf field string state_message = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_message = ''; + /** + * Output only. The cutover steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverStep steps = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $steps; + protected $target_vm_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails $compute_engine_target_details + * Output only. Details of the target VM in Compute Engine. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the cutover job was created (as an API call, not when + * it was actually created in the target). + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the cutover job had finished. + * @type string $name + * Output only. The name of the cutover job. + * @type int $state + * Output only. State of the cutover job. + * @type \Google\Protobuf\Timestamp $state_time + * Output only. The time the state was last updated. + * @type int $progress_percent + * Output only. The current progress in percentage of the cutover job. + * @type \Google\Rpc\Status $error + * Output only. Provides details for the errors that led to the Cutover Job's + * state. + * @type string $state_message + * Output only. A message providing possible extra details about the current + * state. + * @type array<\Google\Cloud\VMMigration\V1\CutoverStep>|\Google\Protobuf\Internal\RepeatedField $steps + * Output only. The cutover steps list representing its progress. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDetails compute_engine_target_details = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails|null + */ + public function getComputeEngineTargetDetails() + { + return $this->readOneof(14); + } + + public function hasComputeEngineTargetDetails() + { + return $this->hasOneof(14); + } + + /** + * Output only. Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDetails compute_engine_target_details = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails $var + * @return $this + */ + public function setComputeEngineTargetDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ComputeEngineTargetDetails::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Output only. The time the cutover job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the cutover job was created (as an API call, not when + * it was actually created in the target). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the cutover job had finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the cutover job had finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. The name of the cutover job. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the cutover job. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. State of the cutover job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the cutover job. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.CutoverJob.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\CutoverJob\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStateTime() + { + return $this->state_time; + } + + public function hasStateTime() + { + return isset($this->state_time); + } + + public function clearStateTime() + { + unset($this->state_time); + } + + /** + * Output only. The time the state was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->state_time = $var; + + return $this; + } + + /** + * Output only. The current progress in percentage of the cutover job. + * + * Generated from protobuf field int32 progress_percent = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Output only. The current progress in percentage of the cutover job. + * + * Generated from protobuf field int32 progress_percent = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Output only. Provides details for the errors that led to the Cutover Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details for the errors that led to the Cutover Job's + * state. + * + * Generated from protobuf field .google.rpc.Status error = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. A message providing possible extra details about the current + * state. + * + * Generated from protobuf field string state_message = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * Output only. A message providing possible extra details about the current + * state. + * + * Generated from protobuf field string state_message = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * Output only. The cutover steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverStep steps = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Output only. The cutover steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverStep steps = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CutoverStep>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CutoverStep::class); + $this->steps = $arr; + + return $this; + } + + /** + * @return string + */ + public function getTargetVmDetails() + { + return $this->whichOneof("target_vm_details"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob/State.php new file mode 100644 index 00000000000..b1810e6a5d3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverJob/State.php @@ -0,0 +1,100 @@ +google.cloud.vmmigration.v1.CutoverJob.State + */ +class State +{ + /** + * The state is unknown. This is used for API compatibility only and is not + * used by the system. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The cutover job has not yet started. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The cutover job finished with errors. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * The cutover job finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The cutover job was cancelled. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + /** + * The cutover job is being cancelled. + * + * Generated from protobuf enum CANCELLING = 5; + */ + const CANCELLING = 5; + /** + * The cutover job is active and running. + * + * Generated from protobuf enum ACTIVE = 6; + */ + const ACTIVE = 6; + /** + * OS adaptation is running as part of the cutover job to generate license. + * + * Generated from protobuf enum ADAPTING_OS = 7; + */ + const ADAPTING_OS = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::CANCELLING => 'CANCELLING', + self::ACTIVE => 'ACTIVE', + self::ADAPTING_OS => 'ADAPTING_OS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\CutoverJob_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverStep.php new file mode 100644 index 00000000000..68550eca3b9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CutoverStep.php @@ -0,0 +1,295 @@ +google.cloud.vmmigration.v1.CutoverStep + */ +class CutoverStep extends \Google\Protobuf\Internal\Message +{ + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + protected $step; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\ReplicationCycle $previous_replication_cycle + * A replication cycle prior cutover step. + * @type \Google\Cloud\VMMigration\V1\ShuttingDownSourceVMStep $shutting_down_source_vm + * Shutting down VM step. + * @type \Google\Cloud\VMMigration\V1\ReplicationCycle $final_sync + * Final sync step. + * @type \Google\Cloud\VMMigration\V1\PreparingVMDisksStep $preparing_vm_disks + * Preparing VM disks step. + * @type \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep $instantiating_migrated_vm + * Instantiating migrated VM step. + * @type \Google\Protobuf\Timestamp $start_time + * The time the step has started. + * @type \Google\Protobuf\Timestamp $end_time + * The time the step has ended. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * A replication cycle prior cutover step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle previous_replication_cycle = 3; + * @return \Google\Cloud\VMMigration\V1\ReplicationCycle|null + */ + public function getPreviousReplicationCycle() + { + return $this->readOneof(3); + } + + public function hasPreviousReplicationCycle() + { + return $this->hasOneof(3); + } + + /** + * A replication cycle prior cutover step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle previous_replication_cycle = 3; + * @param \Google\Cloud\VMMigration\V1\ReplicationCycle $var + * @return $this + */ + public function setPreviousReplicationCycle($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ReplicationCycle::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Shutting down VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ShuttingDownSourceVMStep shutting_down_source_vm = 4; + * @return \Google\Cloud\VMMigration\V1\ShuttingDownSourceVMStep|null + */ + public function getShuttingDownSourceVm() + { + return $this->readOneof(4); + } + + public function hasShuttingDownSourceVm() + { + return $this->hasOneof(4); + } + + /** + * Shutting down VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ShuttingDownSourceVMStep shutting_down_source_vm = 4; + * @param \Google\Cloud\VMMigration\V1\ShuttingDownSourceVMStep $var + * @return $this + */ + public function setShuttingDownSourceVm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ShuttingDownSourceVMStep::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Final sync step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle final_sync = 5; + * @return \Google\Cloud\VMMigration\V1\ReplicationCycle|null + */ + public function getFinalSync() + { + return $this->readOneof(5); + } + + public function hasFinalSync() + { + return $this->hasOneof(5); + } + + /** + * Final sync step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle final_sync = 5; + * @param \Google\Cloud\VMMigration\V1\ReplicationCycle $var + * @return $this + */ + public function setFinalSync($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ReplicationCycle::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Preparing VM disks step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PreparingVMDisksStep preparing_vm_disks = 6; + * @return \Google\Cloud\VMMigration\V1\PreparingVMDisksStep|null + */ + public function getPreparingVmDisks() + { + return $this->readOneof(6); + } + + public function hasPreparingVmDisks() + { + return $this->hasOneof(6); + } + + /** + * Preparing VM disks step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PreparingVMDisksStep preparing_vm_disks = 6; + * @param \Google\Cloud\VMMigration\V1\PreparingVMDisksStep $var + * @return $this + */ + public function setPreparingVmDisks($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\PreparingVMDisksStep::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Instantiating migrated VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InstantiatingMigratedVMStep instantiating_migrated_vm = 7; + * @return \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep|null + */ + public function getInstantiatingMigratedVm() + { + return $this->readOneof(7); + } + + public function hasInstantiatingMigratedVm() + { + return $this->hasOneof(7); + } + + /** + * Instantiating migrated VM step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InstantiatingMigratedVMStep instantiating_migrated_vm = 7; + * @param \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep $var + * @return $this + */ + public function setInstantiatingMigratedVm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\InstantiatingMigratedVMStep::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time the step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getStep() + { + return $this->whichOneof("step"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CycleStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CycleStep.php new file mode 100644 index 00000000000..a081411451d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/CycleStep.php @@ -0,0 +1,229 @@ +google.cloud.vmmigration.v1.CycleStep + */ +class CycleStep extends \Google\Protobuf\Internal\Message +{ + /** + * The time the cycle step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The time the cycle step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + protected $step; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\InitializingReplicationStep $initializing_replication + * Initializing replication step. + * @type \Google\Cloud\VMMigration\V1\ReplicatingStep $replicating + * Replicating step. + * @type \Google\Cloud\VMMigration\V1\PostProcessingStep $post_processing + * Post processing step. + * @type \Google\Protobuf\Timestamp $start_time + * The time the cycle step has started. + * @type \Google\Protobuf\Timestamp $end_time + * The time the cycle step has ended. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Initializing replication step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InitializingReplicationStep initializing_replication = 3; + * @return \Google\Cloud\VMMigration\V1\InitializingReplicationStep|null + */ + public function getInitializingReplication() + { + return $this->readOneof(3); + } + + public function hasInitializingReplication() + { + return $this->hasOneof(3); + } + + /** + * Initializing replication step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.InitializingReplicationStep initializing_replication = 3; + * @param \Google\Cloud\VMMigration\V1\InitializingReplicationStep $var + * @return $this + */ + public function setInitializingReplication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\InitializingReplicationStep::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Replicating step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicatingStep replicating = 4; + * @return \Google\Cloud\VMMigration\V1\ReplicatingStep|null + */ + public function getReplicating() + { + return $this->readOneof(4); + } + + public function hasReplicating() + { + return $this->hasOneof(4); + } + + /** + * Replicating step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicatingStep replicating = 4; + * @param \Google\Cloud\VMMigration\V1\ReplicatingStep $var + * @return $this + */ + public function setReplicating($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ReplicatingStep::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Post processing step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PostProcessingStep post_processing = 5; + * @return \Google\Cloud\VMMigration\V1\PostProcessingStep|null + */ + public function getPostProcessing() + { + return $this->readOneof(5); + } + + public function hasPostProcessing() + { + return $this->hasOneof(5); + } + + /** + * Post processing step. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.PostProcessingStep post_processing = 5; + * @param \Google\Cloud\VMMigration\V1\PostProcessingStep $var + * @return $this + */ + public function setPostProcessing($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\PostProcessingStep::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The time the cycle step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time the cycle step has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time the cycle step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the cycle step has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getStep() + { + return $this->whichOneof("step"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector.php new file mode 100644 index 00000000000..20244d65ed0 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector.php @@ -0,0 +1,620 @@ +google.cloud.vmmigration.v1.DatacenterConnector + */ +class DatacenterConnector extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the connector was created (as an API call, not when + * it was actually installed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The last time the connector was updated with an API call. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The connector's name. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Immutable. A unique key for this connector. This key is internal to the OVA + * connector and is supplied with its creation during the registration process + * and can not be modified. + * + * Generated from protobuf field string registration_id = 12 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $registration_id = ''; + /** + * The service account to use in the connector when communicating with the + * cloud. + * + * Generated from protobuf field string service_account = 5; + */ + protected $service_account = ''; + /** + * The version running in the DatacenterConnector. This is supplied by the OVA + * connector during the registration process and can not be modified. + * + * Generated from protobuf field string version = 6; + */ + protected $version = ''; + /** + * Output only. The communication channel between the datacenter connector and + * Google Cloud. + * + * Generated from protobuf field string bucket = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $bucket = ''; + /** + * Output only. State of the DatacenterConnector, as determined by the health + * checks. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_time = null; + /** + * Output only. Provides details on the state of the Datacenter Connector in + * case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. Appliance OVA version. + * This is the OVA which is manually installed by the user and contains the + * infrastructure for the automatically updatable components on the appliance. + * + * Generated from protobuf field string appliance_infrastructure_version = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $appliance_infrastructure_version = ''; + /** + * Output only. Appliance last installed update bundle version. + * This is the version of the automatically updatable components on the + * appliance. + * + * Generated from protobuf field string appliance_software_version = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $appliance_software_version = ''; + /** + * Output only. The available versions for updating this appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AvailableUpdates available_versions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $available_versions = null; + /** + * Output only. The status of the current / last upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus upgrade_status = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $upgrade_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the connector was created (as an API call, not when + * it was actually installed). + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last time the connector was updated with an API call. + * @type string $name + * Output only. The connector's name. + * @type string $registration_id + * Immutable. A unique key for this connector. This key is internal to the OVA + * connector and is supplied with its creation during the registration process + * and can not be modified. + * @type string $service_account + * The service account to use in the connector when communicating with the + * cloud. + * @type string $version + * The version running in the DatacenterConnector. This is supplied by the OVA + * connector during the registration process and can not be modified. + * @type string $bucket + * Output only. The communication channel between the datacenter connector and + * Google Cloud. + * @type int $state + * Output only. State of the DatacenterConnector, as determined by the health + * checks. + * @type \Google\Protobuf\Timestamp $state_time + * Output only. The time the state was last set. + * @type \Google\Rpc\Status $error + * Output only. Provides details on the state of the Datacenter Connector in + * case of an error. + * @type string $appliance_infrastructure_version + * Output only. Appliance OVA version. + * This is the OVA which is manually installed by the user and contains the + * infrastructure for the automatically updatable components on the appliance. + * @type string $appliance_software_version + * Output only. Appliance last installed update bundle version. + * This is the version of the automatically updatable components on the + * appliance. + * @type \Google\Cloud\VMMigration\V1\AvailableUpdates $available_versions + * Output only. The available versions for updating this appliance. + * @type \Google\Cloud\VMMigration\V1\UpgradeStatus $upgrade_status + * Output only. The status of the current / last upgradeAppliance operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the connector was created (as an API call, not when + * it was actually installed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the connector was created (as an API call, not when + * it was actually installed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The last time the connector was updated with an API call. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The last time the connector was updated with an API call. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The connector's name. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The connector's name. + * + * Generated from protobuf field string name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Immutable. A unique key for this connector. This key is internal to the OVA + * connector and is supplied with its creation during the registration process + * and can not be modified. + * + * Generated from protobuf field string registration_id = 12 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getRegistrationId() + { + return $this->registration_id; + } + + /** + * Immutable. A unique key for this connector. This key is internal to the OVA + * connector and is supplied with its creation during the registration process + * and can not be modified. + * + * Generated from protobuf field string registration_id = 12 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setRegistrationId($var) + { + GPBUtil::checkString($var, True); + $this->registration_id = $var; + + return $this; + } + + /** + * The service account to use in the connector when communicating with the + * cloud. + * + * Generated from protobuf field string service_account = 5; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * The service account to use in the connector when communicating with the + * cloud. + * + * Generated from protobuf field string service_account = 5; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * The version running in the DatacenterConnector. This is supplied by the OVA + * connector during the registration process and can not be modified. + * + * Generated from protobuf field string version = 6; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version running in the DatacenterConnector. This is supplied by the OVA + * connector during the registration process and can not be modified. + * + * Generated from protobuf field string version = 6; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Output only. The communication channel between the datacenter connector and + * Google Cloud. + * + * Generated from protobuf field string bucket = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBucket() + { + return $this->bucket; + } + + /** + * Output only. The communication channel between the datacenter connector and + * Google Cloud. + * + * Generated from protobuf field string bucket = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBucket($var) + { + GPBUtil::checkString($var, True); + $this->bucket = $var; + + return $this; + } + + /** + * Output only. State of the DatacenterConnector, as determined by the health + * checks. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the DatacenterConnector, as determined by the health + * checks. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.DatacenterConnector.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\DatacenterConnector\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStateTime() + { + return $this->state_time; + } + + public function hasStateTime() + { + return isset($this->state_time); + } + + public function clearStateTime() + { + unset($this->state_time); + } + + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->state_time = $var; + + return $this; + } + + /** + * Output only. Provides details on the state of the Datacenter Connector in + * case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details on the state of the Datacenter Connector in + * case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. Appliance OVA version. + * This is the OVA which is manually installed by the user and contains the + * infrastructure for the automatically updatable components on the appliance. + * + * Generated from protobuf field string appliance_infrastructure_version = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApplianceInfrastructureVersion() + { + return $this->appliance_infrastructure_version; + } + + /** + * Output only. Appliance OVA version. + * This is the OVA which is manually installed by the user and contains the + * infrastructure for the automatically updatable components on the appliance. + * + * Generated from protobuf field string appliance_infrastructure_version = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApplianceInfrastructureVersion($var) + { + GPBUtil::checkString($var, True); + $this->appliance_infrastructure_version = $var; + + return $this; + } + + /** + * Output only. Appliance last installed update bundle version. + * This is the version of the automatically updatable components on the + * appliance. + * + * Generated from protobuf field string appliance_software_version = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApplianceSoftwareVersion() + { + return $this->appliance_software_version; + } + + /** + * Output only. Appliance last installed update bundle version. + * This is the version of the automatically updatable components on the + * appliance. + * + * Generated from protobuf field string appliance_software_version = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApplianceSoftwareVersion($var) + { + GPBUtil::checkString($var, True); + $this->appliance_software_version = $var; + + return $this; + } + + /** + * Output only. The available versions for updating this appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AvailableUpdates available_versions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\AvailableUpdates|null + */ + public function getAvailableVersions() + { + return $this->available_versions; + } + + public function hasAvailableVersions() + { + return isset($this->available_versions); + } + + public function clearAvailableVersions() + { + unset($this->available_versions); + } + + /** + * Output only. The available versions for updating this appliance. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AvailableUpdates available_versions = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\AvailableUpdates $var + * @return $this + */ + public function setAvailableVersions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AvailableUpdates::class); + $this->available_versions = $var; + + return $this; + } + + /** + * Output only. The status of the current / last upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus upgrade_status = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\UpgradeStatus|null + */ + public function getUpgradeStatus() + { + return $this->upgrade_status; + } + + public function hasUpgradeStatus() + { + return isset($this->upgrade_status); + } + + public function clearUpgradeStatus() + { + unset($this->upgrade_status); + } + + /** + * Output only. The status of the current / last upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus upgrade_status = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\UpgradeStatus $var + * @return $this + */ + public function setUpgradeStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\UpgradeStatus::class); + $this->upgrade_status = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector/State.php new file mode 100644 index 00000000000..836a8746502 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DatacenterConnector/State.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.DatacenterConnector.State + */ +class State +{ + /** + * The state is unknown. This is used for API compatibility only and is not + * used by the system. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The state was not sampled by the health checks yet. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The source was sampled by health checks and is not available. + * + * Generated from protobuf enum OFFLINE = 2; + */ + const OFFLINE = 2; + /** + * The source is available but might not be usable yet due to unvalidated + * credentials or another reason. The credentials referred to are the ones + * to the Source. The error message will contain further details. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The source exists and its credentials were verified. + * + * Generated from protobuf enum ACTIVE = 4; + */ + const ACTIVE = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::OFFLINE => 'OFFLINE', + self::FAILED => 'FAILED', + self::ACTIVE => 'ACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\DatacenterConnector_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteDatacenterConnectorRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteDatacenterConnectorRequest.php new file mode 100644 index 00000000000..3a18f26d864 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteDatacenterConnectorRequest.php @@ -0,0 +1,155 @@ +google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest + */ +class DeleteDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The DatacenterConnector name. Please see + * {@see VmMigrationClient::datacenterConnectorName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteDatacenterConnectorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The DatacenterConnector name. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteGroupRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteGroupRequest.php new file mode 100644 index 00000000000..58ed1909db6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteGroupRequest.php @@ -0,0 +1,155 @@ +google.cloud.vmmigration.v1.DeleteGroupRequest + */ +class DeleteGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The Group name. Please see + * {@see VmMigrationClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteGroupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Group name. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteMigratingVmRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteMigratingVmRequest.php new file mode 100644 index 00000000000..d92845c4cd6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteMigratingVmRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.DeleteMigratingVmRequest + */ +class DeleteMigratingVmRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the MigratingVm. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteMigratingVmRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the MigratingVm. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteSourceRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteSourceRequest.php new file mode 100644 index 00000000000..73363cfd5bc --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteSourceRequest.php @@ -0,0 +1,155 @@ +google.cloud.vmmigration.v1.DeleteSourceRequest + */ +class DeleteSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The Source name. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteSourceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Source name. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteTargetProjectRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteTargetProjectRequest.php new file mode 100644 index 00000000000..d1c39084915 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteTargetProjectRequest.php @@ -0,0 +1,155 @@ +google.cloud.vmmigration.v1.DeleteTargetProjectRequest + */ +class DeleteTargetProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The TargetProject name. Please see + * {@see VmMigrationClient::targetProjectName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteTargetProjectRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The TargetProject name. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteUtilizationReportRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteUtilizationReportRequest.php new file mode 100644 index 00000000000..8341c1a7702 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/DeleteUtilizationReportRequest.php @@ -0,0 +1,155 @@ +google.cloud.vmmigration.v1.DeleteUtilizationReportRequest + */ +class DeleteUtilizationReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The Utilization Report name. Please see + * {@see VmMigrationClient::utilizationReportName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\DeleteUtilizationReportRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Utilization Report name. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryRequest.php new file mode 100644 index 00000000000..3ccec18360e --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryRequest.php @@ -0,0 +1,120 @@ +google.cloud.vmmigration.v1.FetchInventoryRequest + */ +class FetchInventoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Source. + * + * Generated from protobuf field string source = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $source = ''; + /** + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * + * Generated from protobuf field bool force_refresh = 2; + */ + protected $force_refresh = false; + + /** + * @param string $source Required. The name of the Source. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\FetchInventoryRequest + * + * @experimental + */ + public static function build(string $source): self + { + return (new self()) + ->setSource($source); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $source + * Required. The name of the Source. + * @type bool $force_refresh + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Source. + * + * Generated from protobuf field string source = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * Required. The name of the Source. + * + * Generated from protobuf field string source = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkString($var, True); + $this->source = $var; + + return $this; + } + + /** + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * + * Generated from protobuf field bool force_refresh = 2; + * @return bool + */ + public function getForceRefresh() + { + return $this->force_refresh; + } + + /** + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * + * Generated from protobuf field bool force_refresh = 2; + * @param bool $var + * @return $this + */ + public function setForceRefresh($var) + { + GPBUtil::checkBool($var); + $this->force_refresh = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryResponse.php new file mode 100644 index 00000000000..ce1bdac4c8c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FetchInventoryResponse.php @@ -0,0 +1,157 @@ +google.cloud.vmmigration.v1.FetchInventoryResponse + */ +class FetchInventoryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The timestamp when the source was last queried (if the result + * is from the cache). + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + protected $SourceVms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\VmwareVmsDetails $vmware_vms + * The description of the VMs in a Source of type Vmware. + * @type \Google\Cloud\VMMigration\V1\AwsVmsDetails $aws_vms + * The description of the VMs in a Source of type AWS. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp when the source was last queried (if the result + * is from the cache). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The description of the VMs in a Source of type Vmware. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmsDetails vmware_vms = 1; + * @return \Google\Cloud\VMMigration\V1\VmwareVmsDetails|null + */ + public function getVmwareVms() + { + return $this->readOneof(1); + } + + public function hasVmwareVms() + { + return $this->hasOneof(1); + } + + /** + * The description of the VMs in a Source of type Vmware. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmsDetails vmware_vms = 1; + * @param \Google\Cloud\VMMigration\V1\VmwareVmsDetails $var + * @return $this + */ + public function setVmwareVms($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\VmwareVmsDetails::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The description of the VMs in a Source of type AWS. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmsDetails aws_vms = 3; + * @return \Google\Cloud\VMMigration\V1\AwsVmsDetails|null + */ + public function getAwsVms() + { + return $this->readOneof(3); + } + + public function hasAwsVms() + { + return $this->hasOneof(3); + } + + /** + * The description of the VMs in a Source of type AWS. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsVmsDetails aws_vms = 3; + * @param \Google\Cloud\VMMigration\V1\AwsVmsDetails $var + * @return $this + */ + public function setAwsVms($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AwsVmsDetails::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Output only. The timestamp when the source was last queried (if the result + * is from the cache). + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp when the source was last queried (if the result + * is from the cache). + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceVms() + { + return $this->whichOneof("SourceVms"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationRequest.php new file mode 100644 index 00000000000..d71b82ccb9b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.FinalizeMigrationRequest + */ +class FinalizeMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * @param string $migratingVm Required. The name of the MigratingVm. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\FinalizeMigrationRequest + * + * @experimental + */ + public static function build(string $migratingVm): self + { + return (new self()) + ->setMigratingVm($migratingVm); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $migrating_vm + * Required. The name of the MigratingVm. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationResponse.php new file mode 100644 index 00000000000..bdfdb9430da --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/FinalizeMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.FinalizeMigrationResponse + */ +class FinalizeMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCloneJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCloneJobRequest.php new file mode 100644 index 00000000000..48dce1bf1c8 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCloneJobRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetCloneJobRequest + */ +class GetCloneJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CloneJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the CloneJob. Please see + * {@see VmMigrationClient::cloneJobName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetCloneJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the CloneJob. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CloneJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the CloneJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCutoverJobRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCutoverJobRequest.php new file mode 100644 index 00000000000..9d30019287a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetCutoverJobRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetCutoverJobRequest + */ +class GetCutoverJobRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CutoverJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the CutoverJob. Please see + * {@see VmMigrationClient::cutoverJobName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetCutoverJobRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the CutoverJob. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CutoverJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the CutoverJob. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetDatacenterConnectorRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetDatacenterConnectorRequest.php new file mode 100644 index 00000000000..7aa5823e702 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetDatacenterConnectorRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetDatacenterConnectorRequest + */ +class GetDatacenterConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the DatacenterConnector. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the DatacenterConnector. Please see + * {@see VmMigrationClient::datacenterConnectorName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetDatacenterConnectorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the DatacenterConnector. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the DatacenterConnector. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the DatacenterConnector. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetGroupRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetGroupRequest.php new file mode 100644 index 00000000000..fbf5c771c2d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetGroupRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetGroupRequest + */ +class GetGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The group name. Please see + * {@see VmMigrationClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetGroupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The group name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetMigratingVmRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetMigratingVmRequest.php new file mode 100644 index 00000000000..3e59f540c79 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetMigratingVmRequest.php @@ -0,0 +1,115 @@ +google.cloud.vmmigration.v1.GetMigratingVmRequest + */ +class GetMigratingVmRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The level of details of the migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * @param string $name Required. The name of the MigratingVm. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetMigratingVmRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the MigratingVm. + * @type int $view + * Optional. The level of details of the migrating VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The level of details of the migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The level of details of the migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\MigratingVmView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetReplicationCycleRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetReplicationCycleRequest.php new file mode 100644 index 00000000000..c86a34b32a7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetReplicationCycleRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetReplicationCycleRequest + */ +class GetReplicationCycleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the ReplicationCycle. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the ReplicationCycle. Please see + * {@see VmMigrationClient::replicationCycleName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetReplicationCycleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the ReplicationCycle. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the ReplicationCycle. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the ReplicationCycle. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetSourceRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetSourceRequest.php new file mode 100644 index 00000000000..28346a94ac2 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetSourceRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetSourceRequest + */ +class GetSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The Source name. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetSourceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Source name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetTargetProjectRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetTargetProjectRequest.php new file mode 100644 index 00000000000..244edd28be2 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetTargetProjectRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.GetTargetProjectRequest + */ +class GetTargetProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The TargetProject name. Please see + * {@see VmMigrationClient::targetProjectName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetTargetProjectRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The TargetProject name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The TargetProject name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetUtilizationReportRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetUtilizationReportRequest.php new file mode 100644 index 00000000000..eb7bac23ec7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/GetUtilizationReportRequest.php @@ -0,0 +1,119 @@ +google.cloud.vmmigration.v1.GetUtilizationReportRequest + */ +class GetUtilizationReportRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The level of details of the report. + * Defaults to FULL + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * @param string $name Required. The Utilization Report name. Please see + * {@see VmMigrationClient::utilizationReportName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\GetUtilizationReportRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The Utilization Report name. + * @type int $view + * Optional. The level of details of the report. + * Defaults to FULL + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The Utilization Report name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The level of details of the report. + * Defaults to FULL + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The level of details of the report. + * Defaults to FULL + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\UtilizationReportView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Group.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Group.php new file mode 100644 index 00000000000..ea661a9c1fe --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Group.php @@ -0,0 +1,224 @@ +google.cloud.vmmigration.v1.Group + */ +class Group extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-provided description of the group. + * + * Generated from protobuf field string description = 4; + */ + protected $description = ''; + /** + * Display name is a user defined name for this group which can be updated. + * + * Generated from protobuf field string display_name = 5; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The Group name. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The create time timestamp. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time timestamp. + * @type string $description + * User-provided description of the group. + * @type string $display_name + * Display name is a user defined name for this group which can be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The Group name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-provided description of the group. + * + * Generated from protobuf field string description = 4; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the group. + * + * Generated from protobuf field string description = 4; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Display name is a user defined name for this group which can be updated. + * + * Generated from protobuf field string display_name = 5; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Display name is a user defined name for this group which can be updated. + * + * Generated from protobuf field string display_name = 5; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InitializingReplicationStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InitializingReplicationStep.php new file mode 100644 index 00000000000..d25d4156a11 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InitializingReplicationStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.InitializingReplicationStep + */ +class InitializingReplicationStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InstantiatingMigratedVMStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InstantiatingMigratedVMStep.php new file mode 100644 index 00000000000..d4b0ac54435 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/InstantiatingMigratedVMStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.InstantiatingMigratedVMStep + */ +class InstantiatingMigratedVMStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsRequest.php new file mode 100644 index 00000000000..3d8d4efa2f3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListCloneJobsRequest + */ +class ListCloneJobsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of source VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of source VMs. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListCloneJobsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of source VMs. + * @type int $page_size + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of source VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of source VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsResponse.php new file mode 100644 index 00000000000..5c89b1f50d7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCloneJobsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListCloneJobsResponse + */ +class ListCloneJobsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of clone jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob clone_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $clone_jobs; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\CloneJob>|\Google\Protobuf\Internal\RepeatedField $clone_jobs + * Output only. The list of clone jobs response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of clone jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob clone_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCloneJobs() + { + return $this->clone_jobs; + } + + /** + * Output only. The list of clone jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob clone_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CloneJob>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCloneJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CloneJob::class); + $this->clone_jobs = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsRequest.php new file mode 100644 index 00000000000..07b28f2c7d3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListCutoverJobsRequest + */ +class ListCutoverJobsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of migrating VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of migrating VMs. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListCutoverJobsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of migrating VMs. + * @type int $page_size + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of migrating VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of migrating VMs. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsResponse.php new file mode 100644 index 00000000000..0eb0adebbb3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListCutoverJobsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListCutoverJobsResponse + */ +class ListCutoverJobsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of cutover jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob cutover_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $cutover_jobs; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\CutoverJob>|\Google\Protobuf\Internal\RepeatedField $cutover_jobs + * Output only. The list of cutover jobs response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of cutover jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob cutover_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCutoverJobs() + { + return $this->cutover_jobs; + } + + /** + * Output only. The list of cutover jobs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob cutover_jobs = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CutoverJob>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCutoverJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CutoverJob::class); + $this->cutover_jobs = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsRequest.php new file mode 100644 index 00000000000..ec0686fe621 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsRequest.php @@ -0,0 +1,245 @@ +google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest + */ +class ListDatacenterConnectorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of connectors. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of connectors. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListDatacenterConnectorsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of connectors. + * @type int $page_size + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of connectors. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of connectors. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsResponse.php new file mode 100644 index 00000000000..8aa1c27e311 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListDatacenterConnectorsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListDatacenterConnectorsResponse + */ +class ListDatacenterConnectorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connectors = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $datacenter_connectors; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\DatacenterConnector>|\Google\Protobuf\Internal\RepeatedField $datacenter_connectors + * Output only. The list of sources response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connectors = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDatacenterConnectors() + { + return $this->datacenter_connectors; + } + + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.DatacenterConnector datacenter_connectors = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\DatacenterConnector>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDatacenterConnectors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\DatacenterConnector::class); + $this->datacenter_connectors = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsRequest.php new file mode 100644 index 00000000000..11b8be3b9a9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListGroupsRequest + */ +class ListGroupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of groups. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListGroupsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of groups. + * @type int $page_size + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsResponse.php new file mode 100644 index 00000000000..3296fe31b74 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListGroupsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListGroupsResponse + */ +class ListGroupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of groups response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Group groups = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $groups; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\Group>|\Google\Protobuf\Internal\RepeatedField $groups + * Output only. The list of groups response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of groups response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Group groups = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGroups() + { + return $this->groups; + } + + /** + * Output only. The list of groups response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Group groups = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\Group>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\Group::class); + $this->groups = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsRequest.php new file mode 100644 index 00000000000..51052e3a953 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsRequest.php @@ -0,0 +1,275 @@ +google.cloud.vmmigration.v1.ListMigratingVmsRequest + */ +class ListMigratingVmsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of MigratingVms. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. The level of details of each migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * @param string $parent Required. The parent, which owns this collection of MigratingVms. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListMigratingVmsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of MigratingVms. + * @type int $page_size + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * @type int $view + * Optional. The level of details of each migrating VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of MigratingVms. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of MigratingVms. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. The level of details of each migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The level of details of each migrating VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVmView view = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\MigratingVmView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsResponse.php new file mode 100644 index 00000000000..3f42ab8737d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListMigratingVmsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListMigratingVmsResponse + */ +class ListMigratingVmsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of Migrating VMs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.MigratingVm migrating_vms = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $migrating_vms; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\MigratingVm>|\Google\Protobuf\Internal\RepeatedField $migrating_vms + * Output only. The list of Migrating VMs response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of Migrating VMs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.MigratingVm migrating_vms = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMigratingVms() + { + return $this->migrating_vms; + } + + /** + * Output only. The list of Migrating VMs response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.MigratingVm migrating_vms = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\MigratingVm>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMigratingVms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\MigratingVm::class); + $this->migrating_vms = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesRequest.php new file mode 100644 index 00000000000..816d448a57c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListReplicationCyclesRequest + */ +class ListReplicationCyclesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of ReplicationCycles. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of ReplicationCycles. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListReplicationCyclesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of ReplicationCycles. + * @type int $page_size + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * @type string $page_token + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of ReplicationCycles. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of ReplicationCycles. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesResponse.php new file mode 100644 index 00000000000..2e8b8b96042 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListReplicationCyclesResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListReplicationCyclesResponse + */ +class ListReplicationCyclesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of replication cycles response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.ReplicationCycle replication_cycles = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $replication_cycles; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\ReplicationCycle>|\Google\Protobuf\Internal\RepeatedField $replication_cycles + * Output only. The list of replication cycles response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of replication cycles response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.ReplicationCycle replication_cycles = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicationCycles() + { + return $this->replication_cycles; + } + + /** + * Output only. The list of replication cycles response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.ReplicationCycle replication_cycles = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\ReplicationCycle>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicationCycles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\ReplicationCycle::class); + $this->replication_cycles = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesRequest.php new file mode 100644 index 00000000000..8286f34c3e6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListSourcesRequest + */ +class ListSourcesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of sources. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of sources. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListSourcesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of sources. + * @type int $page_size + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of sources. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of sources. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesResponse.php new file mode 100644 index 00000000000..413cd7b0d15 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListSourcesResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListSourcesResponse + */ +class ListSourcesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Source sources = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $sources; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\Source>|\Google\Protobuf\Internal\RepeatedField $sources + * Output only. The list of sources response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Source sources = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSources() + { + return $this->sources; + } + + /** + * Output only. The list of sources response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.Source sources = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\Source>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\Source::class); + $this->sources = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsRequest.php new file mode 100644 index 00000000000..82fa22a9be6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmmigration.v1.ListTargetProjectsRequest + */ +class ListTargetProjectsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent, which owns this collection of targets. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent, which owns this collection of targets. Please see + * {@see VmMigrationClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListTargetProjectsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent, which owns this collection of targets. + * @type int $page_size + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent, which owns this collection of targets. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent, which owns this collection of targets. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsResponse.php new file mode 100644 index 00000000000..a51c7c607f9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListTargetProjectsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListTargetProjectsResponse + */ +class ListTargetProjectsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of target response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.TargetProject target_projects = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $target_projects; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\TargetProject>|\Google\Protobuf\Internal\RepeatedField $target_projects + * Output only. The list of target response. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of target response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.TargetProject target_projects = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetProjects() + { + return $this->target_projects; + } + + /** + * Output only. The list of target response. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.TargetProject target_projects = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\TargetProject>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetProjects($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\TargetProject::class); + $this->target_projects = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsRequest.php new file mode 100644 index 00000000000..a1b2d9ef827 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsRequest.php @@ -0,0 +1,279 @@ +google.cloud.vmmigration.v1.ListUtilizationReportsRequest + */ +class ListUtilizationReportsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Utilization Reports parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The level of details of each report. + * Defaults to BASIC. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + /** + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page_token = ''; + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The Utilization Reports parent. Please see + * {@see VmMigrationClient::sourceName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\ListUtilizationReportsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The Utilization Reports parent. + * @type int $view + * Optional. The level of details of each report. + * Defaults to BASIC. + * @type int $page_size + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * @type string $filter + * Optional. The filter request. + * @type string $order_by + * Optional. the order by fields for the result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Utilization Reports parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The Utilization Reports parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The level of details of each report. + * Defaults to BASIC. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The level of details of each report. + * Defaults to BASIC. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReportView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\UtilizationReportView::class); + $this->view = $var; + + return $this; + } + + /** + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter request. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. the order by fields for the result. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsResponse.php new file mode 100644 index 00000000000..a82c22f473b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ListUtilizationReportsResponse.php @@ -0,0 +1,139 @@ +google.cloud.vmmigration.v1.ListUtilizationReportsResponse + */ +class ListUtilizationReportsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The list of reports. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.UtilizationReport utilization_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $utilization_reports; + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\UtilizationReport>|\Google\Protobuf\Internal\RepeatedField $utilization_reports + * Output only. The list of reports. + * @type string $next_page_token + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Output only. Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The list of reports. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.UtilizationReport utilization_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUtilizationReports() + { + return $this->utilization_reports; + } + + /** + * Output only. The list of reports. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.UtilizationReport utilization_reports = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\UtilizationReport>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUtilizationReports($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\UtilizationReport::class); + $this->utilization_reports = $arr; + + return $this; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token, which can be sent as `page_token` to retrieve the + * next page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Output only. Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm.php new file mode 100644 index 00000000000..a86771ba3c4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm.php @@ -0,0 +1,796 @@ +google.cloud.vmmigration.v1.MigratingVm + */ +class MigratingVm extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The identifier of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The unique ID of the VM in the source. + * The VM's name in vSphere can be changed, so this is not the VM's name but + * rather its moRef id. This id is of the form vm-. + * + * Generated from protobuf field string source_vm_id = 2; + */ + protected $source_vm_id = ''; + /** + * The display name attached to the MigratingVm by the user. + * + * Generated from protobuf field string display_name = 18; + */ + protected $display_name = ''; + /** + * The description attached to the migrating VM by the user. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * The replication schedule policy. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulePolicy policy = 8; + */ + protected $policy = null; + /** + * Output only. The time the migrating VM was created (this refers to this + * resource and not to the time it was installed in the source). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The last time the migrating VM resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The most updated snapshot created time in the source that + * finished replication. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationSync last_sync = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $last_sync = null; + /** + * Output only. State of the MigratingVm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm.State state = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The last time the migrating VM state was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_time = null; + /** + * Output only. The percentage progress of the current running replication + * cycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle current_sync_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $current_sync_info = null; + /** + * Output only. The group this migrating vm is included in, if any. The group + * is represented by the full path of the appropriate + * [Group][google.cloud.vmmigration.v1.Group] resource. + * + * Generated from protobuf field string group = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $group = ''; + /** + * The labels of the migrating VM. + * + * Generated from protobuf field map labels = 16; + */ + private $labels; + /** + * Output only. The recent [clone jobs][google.cloud.vmmigration.v1.CloneJob] + * performed on the migrating VM. This field holds the vm's last completed + * clone job and the vm's running clone job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob recent_clone_jobs = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $recent_clone_jobs; + /** + * Output only. Provides details on the state of the Migrating VM in case of + * an error in replication. + * + * Generated from protobuf field .google.rpc.Status error = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. The recent cutover jobs performed on the migrating VM. + * This field holds the vm's last completed cutover job and the vm's + * running cutover job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob recent_cutover_jobs = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $recent_cutover_jobs; + protected $target_vm_defaults; + protected $source_vm_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\ComputeEngineTargetDefaults $compute_engine_target_defaults + * Details of the target VM in Compute Engine. + * @type \Google\Cloud\VMMigration\V1\AwsSourceVmDetails $aws_source_vm_details + * Output only. Details of the VM from an AWS source. + * @type string $name + * Output only. The identifier of the MigratingVm. + * @type string $source_vm_id + * The unique ID of the VM in the source. + * The VM's name in vSphere can be changed, so this is not the VM's name but + * rather its moRef id. This id is of the form vm-. + * @type string $display_name + * The display name attached to the MigratingVm by the user. + * @type string $description + * The description attached to the migrating VM by the user. + * @type \Google\Cloud\VMMigration\V1\SchedulePolicy $policy + * The replication schedule policy. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the migrating VM was created (this refers to this + * resource and not to the time it was installed in the source). + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last time the migrating VM resource was updated. + * @type \Google\Cloud\VMMigration\V1\ReplicationSync $last_sync + * Output only. The most updated snapshot created time in the source that + * finished replication. + * @type int $state + * Output only. State of the MigratingVm. + * @type \Google\Protobuf\Timestamp $state_time + * Output only. The last time the migrating VM state was updated. + * @type \Google\Cloud\VMMigration\V1\ReplicationCycle $current_sync_info + * Output only. The percentage progress of the current running replication + * cycle. + * @type string $group + * Output only. The group this migrating vm is included in, if any. The group + * is represented by the full path of the appropriate + * [Group][google.cloud.vmmigration.v1.Group] resource. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels of the migrating VM. + * @type array<\Google\Cloud\VMMigration\V1\CloneJob>|\Google\Protobuf\Internal\RepeatedField $recent_clone_jobs + * Output only. The recent [clone jobs][google.cloud.vmmigration.v1.CloneJob] + * performed on the migrating VM. This field holds the vm's last completed + * clone job and the vm's running clone job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * @type \Google\Rpc\Status $error + * Output only. Provides details on the state of the Migrating VM in case of + * an error in replication. + * @type array<\Google\Cloud\VMMigration\V1\CutoverJob>|\Google\Protobuf\Internal\RepeatedField $recent_cutover_jobs + * Output only. The recent cutover jobs performed on the migrating VM. + * This field holds the vm's last completed cutover job and the vm's + * running cutover job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDefaults compute_engine_target_defaults = 26; + * @return \Google\Cloud\VMMigration\V1\ComputeEngineTargetDefaults|null + */ + public function getComputeEngineTargetDefaults() + { + return $this->readOneof(26); + } + + public function hasComputeEngineTargetDefaults() + { + return $this->hasOneof(26); + } + + /** + * Details of the target VM in Compute Engine. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ComputeEngineTargetDefaults compute_engine_target_defaults = 26; + * @param \Google\Cloud\VMMigration\V1\ComputeEngineTargetDefaults $var + * @return $this + */ + public function setComputeEngineTargetDefaults($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ComputeEngineTargetDefaults::class); + $this->writeOneof(26, $var); + + return $this; + } + + /** + * Output only. Details of the VM from an AWS source. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails aws_source_vm_details = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\AwsSourceVmDetails|null + */ + public function getAwsSourceVmDetails() + { + return $this->readOneof(29); + } + + public function hasAwsSourceVmDetails() + { + return $this->hasOneof(29); + } + + /** + * Output only. Details of the VM from an AWS source. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceVmDetails aws_source_vm_details = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\AwsSourceVmDetails $var + * @return $this + */ + public function setAwsSourceVmDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AwsSourceVmDetails::class); + $this->writeOneof(29, $var); + + return $this; + } + + /** + * Output only. The identifier of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The identifier of the MigratingVm. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The unique ID of the VM in the source. + * The VM's name in vSphere can be changed, so this is not the VM's name but + * rather its moRef id. This id is of the form vm-. + * + * Generated from protobuf field string source_vm_id = 2; + * @return string + */ + public function getSourceVmId() + { + return $this->source_vm_id; + } + + /** + * The unique ID of the VM in the source. + * The VM's name in vSphere can be changed, so this is not the VM's name but + * rather its moRef id. This id is of the form vm-. + * + * Generated from protobuf field string source_vm_id = 2; + * @param string $var + * @return $this + */ + public function setSourceVmId($var) + { + GPBUtil::checkString($var, True); + $this->source_vm_id = $var; + + return $this; + } + + /** + * The display name attached to the MigratingVm by the user. + * + * Generated from protobuf field string display_name = 18; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name attached to the MigratingVm by the user. + * + * Generated from protobuf field string display_name = 18; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The description attached to the migrating VM by the user. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description attached to the migrating VM by the user. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The replication schedule policy. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulePolicy policy = 8; + * @return \Google\Cloud\VMMigration\V1\SchedulePolicy|null + */ + public function getPolicy() + { + return $this->policy; + } + + public function hasPolicy() + { + return isset($this->policy); + } + + public function clearPolicy() + { + unset($this->policy); + } + + /** + * The replication schedule policy. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulePolicy policy = 8; + * @param \Google\Cloud\VMMigration\V1\SchedulePolicy $var + * @return $this + */ + public function setPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\SchedulePolicy::class); + $this->policy = $var; + + return $this; + } + + /** + * Output only. The time the migrating VM was created (this refers to this + * resource and not to the time it was installed in the source). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the migrating VM was created (this refers to this + * resource and not to the time it was installed in the source). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The last time the migrating VM resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The last time the migrating VM resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The most updated snapshot created time in the source that + * finished replication. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationSync last_sync = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\ReplicationSync|null + */ + public function getLastSync() + { + return $this->last_sync; + } + + public function hasLastSync() + { + return isset($this->last_sync); + } + + public function clearLastSync() + { + unset($this->last_sync); + } + + /** + * Output only. The most updated snapshot created time in the source that + * finished replication. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationSync last_sync = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\ReplicationSync $var + * @return $this + */ + public function setLastSync($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ReplicationSync::class); + $this->last_sync = $var; + + return $this; + } + + /** + * Output only. State of the MigratingVm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm.State state = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the MigratingVm. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm.State state = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\MigratingVm\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The last time the migrating VM state was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStateTime() + { + return $this->state_time; + } + + public function hasStateTime() + { + return isset($this->state_time); + } + + public function clearStateTime() + { + unset($this->state_time); + } + + /** + * Output only. The last time the migrating VM state was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->state_time = $var; + + return $this; + } + + /** + * Output only. The percentage progress of the current running replication + * cycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle current_sync_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VMMigration\V1\ReplicationCycle|null + */ + public function getCurrentSyncInfo() + { + return $this->current_sync_info; + } + + public function hasCurrentSyncInfo() + { + return isset($this->current_sync_info); + } + + public function clearCurrentSyncInfo() + { + unset($this->current_sync_info); + } + + /** + * Output only. The percentage progress of the current running replication + * cycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle current_sync_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VMMigration\V1\ReplicationCycle $var + * @return $this + */ + public function setCurrentSyncInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\ReplicationCycle::class); + $this->current_sync_info = $var; + + return $this; + } + + /** + * Output only. The group this migrating vm is included in, if any. The group + * is represented by the full path of the appropriate + * [Group][google.cloud.vmmigration.v1.Group] resource. + * + * Generated from protobuf field string group = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getGroup() + { + return $this->group; + } + + /** + * Output only. The group this migrating vm is included in, if any. The group + * is represented by the full path of the appropriate + * [Group][google.cloud.vmmigration.v1.Group] resource. + * + * Generated from protobuf field string group = 15 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkString($var, True); + $this->group = $var; + + return $this; + } + + /** + * The labels of the migrating VM. + * + * Generated from protobuf field map labels = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels of the migrating VM. + * + * Generated from protobuf field map labels = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. The recent [clone jobs][google.cloud.vmmigration.v1.CloneJob] + * performed on the migrating VM. This field holds the vm's last completed + * clone job and the vm's running clone job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob recent_clone_jobs = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecentCloneJobs() + { + return $this->recent_clone_jobs; + } + + /** + * Output only. The recent [clone jobs][google.cloud.vmmigration.v1.CloneJob] + * performed on the migrating VM. This field holds the vm's last completed + * clone job and the vm's running clone job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CloneJob recent_clone_jobs = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CloneJob>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecentCloneJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CloneJob::class); + $this->recent_clone_jobs = $arr; + + return $this; + } + + /** + * Output only. Provides details on the state of the Migrating VM in case of + * an error in replication. + * + * Generated from protobuf field .google.rpc.Status error = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details on the state of the Migrating VM in case of + * an error in replication. + * + * Generated from protobuf field .google.rpc.Status error = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. The recent cutover jobs performed on the migrating VM. + * This field holds the vm's last completed cutover job and the vm's + * running cutover job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob recent_cutover_jobs = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecentCutoverJobs() + { + return $this->recent_cutover_jobs; + } + + /** + * Output only. The recent cutover jobs performed on the migrating VM. + * This field holds the vm's last completed cutover job and the vm's + * running cutover job, if one exists. + * Note: To have this field populated you need to explicitly request it via + * the "view" parameter of the Get/List request. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CutoverJob recent_cutover_jobs = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VMMigration\V1\CutoverJob>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecentCutoverJobs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CutoverJob::class); + $this->recent_cutover_jobs = $arr; + + return $this; + } + + /** + * @return string + */ + public function getTargetVmDefaults() + { + return $this->whichOneof("target_vm_defaults"); + } + + /** + * @return string + */ + public function getSourceVmDetails() + { + return $this->whichOneof("source_vm_details"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm/State.php new file mode 100644 index 00000000000..1677e69889d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVm/State.php @@ -0,0 +1,133 @@ +google.cloud.vmmigration.v1.MigratingVm.State + */ +class State +{ + /** + * The state was not sampled by the health checks yet. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The VM in the source is being verified. + * + * Generated from protobuf enum PENDING = 1; + */ + const PENDING = 1; + /** + * The source VM was verified, and it's ready to start replication. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * Migration is going through the first sync cycle. + * + * Generated from protobuf enum FIRST_SYNC = 3; + */ + const FIRST_SYNC = 3; + /** + * The replication is active, and it's running or scheduled to run. + * + * Generated from protobuf enum ACTIVE = 4; + */ + const ACTIVE = 4; + /** + * The source VM is being turned off, and a final replication is currently + * running. + * + * Generated from protobuf enum CUTTING_OVER = 7; + */ + const CUTTING_OVER = 7; + /** + * The source VM was stopped and replicated. The replication is currently + * paused. + * + * Generated from protobuf enum CUTOVER = 8; + */ + const CUTOVER = 8; + /** + * A cutover job is active and replication cycle is running the final sync. + * + * Generated from protobuf enum FINAL_SYNC = 9; + */ + const FINAL_SYNC = 9; + /** + * The replication was paused by the user and no cycles are scheduled to + * run. + * + * Generated from protobuf enum PAUSED = 10; + */ + const PAUSED = 10; + /** + * The migrating VM is being finalized and migration resources are being + * removed. + * + * Generated from protobuf enum FINALIZING = 11; + */ + const FINALIZING = 11; + /** + * The replication process is done. The migrating VM is finalized and no + * longer consumes billable resources. + * + * Generated from protobuf enum FINALIZED = 12; + */ + const FINALIZED = 12; + /** + * The replication process encountered an unrecoverable error and was + * aborted. + * + * Generated from protobuf enum ERROR = 13; + */ + const ERROR = 13; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING => 'PENDING', + self::READY => 'READY', + self::FIRST_SYNC => 'FIRST_SYNC', + self::ACTIVE => 'ACTIVE', + self::CUTTING_OVER => 'CUTTING_OVER', + self::CUTOVER => 'CUTOVER', + self::FINAL_SYNC => 'FINAL_SYNC', + self::PAUSED => 'PAUSED', + self::FINALIZING => 'FINALIZING', + self::FINALIZED => 'FINALIZED', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\MigratingVm_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVmView.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVmView.php new file mode 100644 index 00000000000..b856588e1ba --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigratingVmView.php @@ -0,0 +1,63 @@ +google.cloud.vmmigration.v1.MigratingVmView + */ +class MigratingVmView +{ + /** + * View is unspecified. The API will fallback to the default value. + * + * Generated from protobuf enum MIGRATING_VM_VIEW_UNSPECIFIED = 0; + */ + const MIGRATING_VM_VIEW_UNSPECIFIED = 0; + /** + * Get the migrating VM basic details. + * The basic details do not include the recent clone jobs and recent cutover + * jobs lists. + * + * Generated from protobuf enum MIGRATING_VM_VIEW_BASIC = 1; + */ + const MIGRATING_VM_VIEW_BASIC = 1; + /** + * Include everything. + * + * Generated from protobuf enum MIGRATING_VM_VIEW_FULL = 2; + */ + const MIGRATING_VM_VIEW_FULL = 2; + + private static $valueToName = [ + self::MIGRATING_VM_VIEW_UNSPECIFIED => 'MIGRATING_VM_VIEW_UNSPECIFIED', + self::MIGRATING_VM_VIEW_BASIC => 'MIGRATING_VM_VIEW_BASIC', + self::MIGRATING_VM_VIEW_FULL => 'MIGRATING_VM_VIEW_FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError.php new file mode 100644 index 00000000000..55181c0327d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError.php @@ -0,0 +1,239 @@ +google.cloud.vmmigration.v1.MigrationError + */ +class MigrationError extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The error code. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigrationError.ErrorCode code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $code = 0; + /** + * Output only. The localized error message. + * + * Generated from protobuf field .google.rpc.LocalizedMessage error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error_message = null; + /** + * Output only. Suggested action for solving the error. + * + * Generated from protobuf field .google.rpc.LocalizedMessage action_item = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $action_item = null; + /** + * Output only. URL(s) pointing to additional information on handling the + * current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link help_links = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $help_links; + /** + * Output only. The time the error occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp error_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Output only. The error code. + * @type \Google\Rpc\LocalizedMessage $error_message + * Output only. The localized error message. + * @type \Google\Rpc\LocalizedMessage $action_item + * Output only. Suggested action for solving the error. + * @type array<\Google\Rpc\Help\Link>|\Google\Protobuf\Internal\RepeatedField $help_links + * Output only. URL(s) pointing to additional information on handling the + * current error. + * @type \Google\Protobuf\Timestamp $error_time + * Output only. The time the error occurred. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The error code. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigrationError.ErrorCode code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. The error code. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigrationError.ErrorCode code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\MigrationError\ErrorCode::class); + $this->code = $var; + + return $this; + } + + /** + * Output only. The localized error message. + * + * Generated from protobuf field .google.rpc.LocalizedMessage error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\LocalizedMessage|null + */ + public function getErrorMessage() + { + return $this->error_message; + } + + public function hasErrorMessage() + { + return isset($this->error_message); + } + + public function clearErrorMessage() + { + unset($this->error_message); + } + + /** + * Output only. The localized error message. + * + * Generated from protobuf field .google.rpc.LocalizedMessage error_message = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\LocalizedMessage $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\LocalizedMessage::class); + $this->error_message = $var; + + return $this; + } + + /** + * Output only. Suggested action for solving the error. + * + * Generated from protobuf field .google.rpc.LocalizedMessage action_item = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\LocalizedMessage|null + */ + public function getActionItem() + { + return $this->action_item; + } + + public function hasActionItem() + { + return isset($this->action_item); + } + + public function clearActionItem() + { + unset($this->action_item); + } + + /** + * Output only. Suggested action for solving the error. + * + * Generated from protobuf field .google.rpc.LocalizedMessage action_item = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\LocalizedMessage $var + * @return $this + */ + public function setActionItem($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\LocalizedMessage::class); + $this->action_item = $var; + + return $this; + } + + /** + * Output only. URL(s) pointing to additional information on handling the + * current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link help_links = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHelpLinks() + { + return $this->help_links; + } + + /** + * Output only. URL(s) pointing to additional information on handling the + * current error. + * + * Generated from protobuf field repeated .google.rpc.Help.Link help_links = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Rpc\Help\Link>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHelpLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Help\Link::class); + $this->help_links = $arr; + + return $this; + } + + /** + * Output only. The time the error occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp error_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getErrorTime() + { + return $this->error_time; + } + + public function hasErrorTime() + { + return isset($this->error_time); + } + + public function clearErrorTime() + { + unset($this->error_time); + } + + /** + * Output only. The time the error occurred. + * + * Generated from protobuf field .google.protobuf.Timestamp error_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setErrorTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->error_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError/ErrorCode.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError/ErrorCode.php new file mode 100644 index 00000000000..b7f0736328f --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/MigrationError/ErrorCode.php @@ -0,0 +1,115 @@ +google.cloud.vmmigration.v1.MigrationError.ErrorCode + */ +class ErrorCode +{ + /** + * Default value. This value is not used. + * + * Generated from protobuf enum ERROR_CODE_UNSPECIFIED = 0; + */ + const ERROR_CODE_UNSPECIFIED = 0; + /** + * Migrate for Compute encountered an unknown error. + * + * Generated from protobuf enum UNKNOWN_ERROR = 1; + */ + const UNKNOWN_ERROR = 1; + /** + * Migrate for Compute encountered an error while validating replication + * source health. + * + * Generated from protobuf enum SOURCE_VALIDATION_ERROR = 2; + */ + const SOURCE_VALIDATION_ERROR = 2; + /** + * Migrate for Compute encountered an error during source data operation. + * + * Generated from protobuf enum SOURCE_REPLICATION_ERROR = 3; + */ + const SOURCE_REPLICATION_ERROR = 3; + /** + * Migrate for Compute encountered an error during target data operation. + * + * Generated from protobuf enum TARGET_REPLICATION_ERROR = 4; + */ + const TARGET_REPLICATION_ERROR = 4; + /** + * Migrate for Compute encountered an error during OS adaptation. + * + * Generated from protobuf enum OS_ADAPTATION_ERROR = 5; + */ + const OS_ADAPTATION_ERROR = 5; + /** + * Migrate for Compute encountered an error in clone operation. + * + * Generated from protobuf enum CLONE_ERROR = 6; + */ + const CLONE_ERROR = 6; + /** + * Migrate for Compute encountered an error in cutover operation. + * + * Generated from protobuf enum CUTOVER_ERROR = 7; + */ + const CUTOVER_ERROR = 7; + /** + * Migrate for Compute encountered an error during utilization report + * creation. + * + * Generated from protobuf enum UTILIZATION_REPORT_ERROR = 8; + */ + const UTILIZATION_REPORT_ERROR = 8; + /** + * Migrate for Compute encountered an error during appliance upgrade. + * + * Generated from protobuf enum APPLIANCE_UPGRADE_ERROR = 9; + */ + const APPLIANCE_UPGRADE_ERROR = 9; + + private static $valueToName = [ + self::ERROR_CODE_UNSPECIFIED => 'ERROR_CODE_UNSPECIFIED', + self::UNKNOWN_ERROR => 'UNKNOWN_ERROR', + self::SOURCE_VALIDATION_ERROR => 'SOURCE_VALIDATION_ERROR', + self::SOURCE_REPLICATION_ERROR => 'SOURCE_REPLICATION_ERROR', + self::TARGET_REPLICATION_ERROR => 'TARGET_REPLICATION_ERROR', + self::OS_ADAPTATION_ERROR => 'OS_ADAPTATION_ERROR', + self::CLONE_ERROR => 'CLONE_ERROR', + self::CUTOVER_ERROR => 'CUTOVER_ERROR', + self::UTILIZATION_REPORT_ERROR => 'UTILIZATION_REPORT_ERROR', + self::APPLIANCE_UPGRADE_ERROR => 'APPLIANCE_UPGRADE_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ErrorCode::class, \Google\Cloud\VMMigration\V1\MigrationError_ErrorCode::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/NetworkInterface.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/NetworkInterface.php new file mode 100644 index 00000000000..e70ad652db3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/NetworkInterface.php @@ -0,0 +1,177 @@ +google.cloud.vmmigration.v1.NetworkInterface + */ +class NetworkInterface extends \Google\Protobuf\Internal\Message +{ + /** + * The network to connect the NIC to. + * + * Generated from protobuf field string network = 1; + */ + protected $network = ''; + /** + * The subnetwork to connect the NIC to. + * + * Generated from protobuf field string subnetwork = 2; + */ + protected $subnetwork = ''; + /** + * The internal IP to define in the NIC. + * The formats accepted are: `ephemeral` \ ipv4 address \ a named address + * resource full path. + * + * Generated from protobuf field string internal_ip = 3; + */ + protected $internal_ip = ''; + /** + * The external IP to define in the NIC. + * + * Generated from protobuf field string external_ip = 4; + */ + protected $external_ip = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network + * The network to connect the NIC to. + * @type string $subnetwork + * The subnetwork to connect the NIC to. + * @type string $internal_ip + * The internal IP to define in the NIC. + * The formats accepted are: `ephemeral` \ ipv4 address \ a named address + * resource full path. + * @type string $external_ip + * The external IP to define in the NIC. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The network to connect the NIC to. + * + * Generated from protobuf field string network = 1; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * The network to connect the NIC to. + * + * Generated from protobuf field string network = 1; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The subnetwork to connect the NIC to. + * + * Generated from protobuf field string subnetwork = 2; + * @return string + */ + public function getSubnetwork() + { + return $this->subnetwork; + } + + /** + * The subnetwork to connect the NIC to. + * + * Generated from protobuf field string subnetwork = 2; + * @param string $var + * @return $this + */ + public function setSubnetwork($var) + { + GPBUtil::checkString($var, True); + $this->subnetwork = $var; + + return $this; + } + + /** + * The internal IP to define in the NIC. + * The formats accepted are: `ephemeral` \ ipv4 address \ a named address + * resource full path. + * + * Generated from protobuf field string internal_ip = 3; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * The internal IP to define in the NIC. + * The formats accepted are: `ephemeral` \ ipv4 address \ a named address + * resource full path. + * + * Generated from protobuf field string internal_ip = 3; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * The external IP to define in the NIC. + * + * Generated from protobuf field string external_ip = 4; + * @return string + */ + public function getExternalIp() + { + return $this->external_ip; + } + + /** + * The external IP to define in the NIC. + * + * Generated from protobuf field string external_ip = 4; + * @param string $var + * @return $this + */ + public function setExternalIp($var) + { + GPBUtil::checkString($var, True); + $this->external_ip = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/OperationMetadata.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/OperationMetadata.php new file mode 100644 index 00000000000..3174fc52417 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/OperationMetadata.php @@ -0,0 +1,307 @@ +google.cloud.vmmigration.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationRequest.php new file mode 100644 index 00000000000..bd578e77b38 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationRequest.php @@ -0,0 +1,67 @@ +google.cloud.vmmigration.v1.PauseMigrationRequest + */ +class PauseMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $migrating_vm + * Required. The name of the MigratingVm. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationResponse.php new file mode 100644 index 00000000000..943c6192f11 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PauseMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.PauseMigrationResponse + */ +class PauseMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PostProcessingStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PostProcessingStep.php new file mode 100644 index 00000000000..6fea26e7428 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PostProcessingStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.PostProcessingStep + */ +class PostProcessingStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PreparingVMDisksStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PreparingVMDisksStep.php new file mode 100644 index 00000000000..1fd2f8bc8ca --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/PreparingVMDisksStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.PreparingVMDisksStep + */ +class PreparingVMDisksStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationRequest.php new file mode 100644 index 00000000000..5aa1a199ff0 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationRequest.php @@ -0,0 +1,115 @@ +google.cloud.vmmigration.v1.RemoveGroupMigrationRequest + */ +class RemoveGroupMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Group. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $group = ''; + /** + * The MigratingVm to remove. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * @param string $group Required. The name of the Group. Please see + * {@see VmMigrationClient::groupName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\RemoveGroupMigrationRequest + * + * @experimental + */ + public static function build(string $group): self + { + return (new self()) + ->setGroup($group); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $group + * Required. The name of the Group. + * @type string $migrating_vm + * The MigratingVm to remove. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Group. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getGroup() + { + return $this->group; + } + + /** + * Required. The name of the Group. + * + * Generated from protobuf field string group = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkString($var, True); + $this->group = $var; + + return $this; + } + + /** + * The MigratingVm to remove. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * The MigratingVm to remove. + * + * Generated from protobuf field string migrating_vm = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationResponse.php new file mode 100644 index 00000000000..76fe02aad40 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/RemoveGroupMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.RemoveGroupMigrationResponse + */ +class RemoveGroupMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicatingStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicatingStep.php new file mode 100644 index 00000000000..c0191fc596f --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicatingStep.php @@ -0,0 +1,177 @@ +google.cloud.vmmigration.v1.ReplicatingStep + */ +class ReplicatingStep extends \Google\Protobuf\Internal\Message +{ + /** + * Total bytes to be handled in the step. + * + * Generated from protobuf field int64 total_bytes = 1; + */ + protected $total_bytes = 0; + /** + * Replicated bytes in the step. + * + * Generated from protobuf field int64 replicated_bytes = 2; + */ + protected $replicated_bytes = 0; + /** + * The source disks replication rate for the last 2 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_two_minutes_average_bytes_per_second = 3; + */ + protected $last_two_minutes_average_bytes_per_second = 0; + /** + * The source disks replication rate for the last 30 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_thirty_minutes_average_bytes_per_second = 4; + */ + protected $last_thirty_minutes_average_bytes_per_second = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $total_bytes + * Total bytes to be handled in the step. + * @type int|string $replicated_bytes + * Replicated bytes in the step. + * @type int|string $last_two_minutes_average_bytes_per_second + * The source disks replication rate for the last 2 minutes in bytes per + * second. + * @type int|string $last_thirty_minutes_average_bytes_per_second + * The source disks replication rate for the last 30 minutes in bytes per + * second. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Total bytes to be handled in the step. + * + * Generated from protobuf field int64 total_bytes = 1; + * @return int|string + */ + public function getTotalBytes() + { + return $this->total_bytes; + } + + /** + * Total bytes to be handled in the step. + * + * Generated from protobuf field int64 total_bytes = 1; + * @param int|string $var + * @return $this + */ + public function setTotalBytes($var) + { + GPBUtil::checkInt64($var); + $this->total_bytes = $var; + + return $this; + } + + /** + * Replicated bytes in the step. + * + * Generated from protobuf field int64 replicated_bytes = 2; + * @return int|string + */ + public function getReplicatedBytes() + { + return $this->replicated_bytes; + } + + /** + * Replicated bytes in the step. + * + * Generated from protobuf field int64 replicated_bytes = 2; + * @param int|string $var + * @return $this + */ + public function setReplicatedBytes($var) + { + GPBUtil::checkInt64($var); + $this->replicated_bytes = $var; + + return $this; + } + + /** + * The source disks replication rate for the last 2 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_two_minutes_average_bytes_per_second = 3; + * @return int|string + */ + public function getLastTwoMinutesAverageBytesPerSecond() + { + return $this->last_two_minutes_average_bytes_per_second; + } + + /** + * The source disks replication rate for the last 2 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_two_minutes_average_bytes_per_second = 3; + * @param int|string $var + * @return $this + */ + public function setLastTwoMinutesAverageBytesPerSecond($var) + { + GPBUtil::checkInt64($var); + $this->last_two_minutes_average_bytes_per_second = $var; + + return $this; + } + + /** + * The source disks replication rate for the last 30 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_thirty_minutes_average_bytes_per_second = 4; + * @return int|string + */ + public function getLastThirtyMinutesAverageBytesPerSecond() + { + return $this->last_thirty_minutes_average_bytes_per_second; + } + + /** + * The source disks replication rate for the last 30 minutes in bytes per + * second. + * + * Generated from protobuf field int64 last_thirty_minutes_average_bytes_per_second = 4; + * @param int|string $var + * @return $this + */ + public function setLastThirtyMinutesAverageBytesPerSecond($var) + { + GPBUtil::checkInt64($var); + $this->last_thirty_minutes_average_bytes_per_second = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle.php new file mode 100644 index 00000000000..54c3bf4c6ee --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle.php @@ -0,0 +1,393 @@ +google.cloud.vmmigration.v1.ReplicationCycle + */ +class ReplicationCycle extends \Google\Protobuf\Internal\Message +{ + /** + * The identifier of the ReplicationCycle. + * + * Generated from protobuf field string name = 13; + */ + protected $name = ''; + /** + * The cycle's ordinal number. + * + * Generated from protobuf field int32 cycle_number = 10; + */ + protected $cycle_number = 0; + /** + * The time the replication cycle has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * The time the replication cycle has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + */ + protected $end_time = null; + /** + * The accumulated duration the replication cycle was paused. + * + * Generated from protobuf field .google.protobuf.Duration total_pause_duration = 7; + */ + protected $total_pause_duration = null; + /** + * The current progress in percentage of this cycle. + * Was replaced by 'steps' field, which breaks down the cycle progression more + * accurately. + * + * Generated from protobuf field int32 progress_percent = 5 [deprecated = true]; + * @deprecated + */ + protected $progress_percent = 0; + /** + * The cycle's steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CycleStep steps = 9; + */ + private $steps; + /** + * State of the ReplicationCycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle.State state = 11; + */ + protected $state = 0; + /** + * Provides details on the state of the cycle in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 12; + */ + protected $error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The identifier of the ReplicationCycle. + * @type int $cycle_number + * The cycle's ordinal number. + * @type \Google\Protobuf\Timestamp $start_time + * The time the replication cycle has started. + * @type \Google\Protobuf\Timestamp $end_time + * The time the replication cycle has ended. + * @type \Google\Protobuf\Duration $total_pause_duration + * The accumulated duration the replication cycle was paused. + * @type int $progress_percent + * The current progress in percentage of this cycle. + * Was replaced by 'steps' field, which breaks down the cycle progression more + * accurately. + * @type array<\Google\Cloud\VMMigration\V1\CycleStep>|\Google\Protobuf\Internal\RepeatedField $steps + * The cycle's steps list representing its progress. + * @type int $state + * State of the ReplicationCycle. + * @type \Google\Rpc\Status $error + * Provides details on the state of the cycle in case of an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The identifier of the ReplicationCycle. + * + * Generated from protobuf field string name = 13; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The identifier of the ReplicationCycle. + * + * Generated from protobuf field string name = 13; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The cycle's ordinal number. + * + * Generated from protobuf field int32 cycle_number = 10; + * @return int + */ + public function getCycleNumber() + { + return $this->cycle_number; + } + + /** + * The cycle's ordinal number. + * + * Generated from protobuf field int32 cycle_number = 10; + * @param int $var + * @return $this + */ + public function setCycleNumber($var) + { + GPBUtil::checkInt32($var); + $this->cycle_number = $var; + + return $this; + } + + /** + * The time the replication cycle has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time the replication cycle has started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time the replication cycle has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the replication cycle has ended. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The accumulated duration the replication cycle was paused. + * + * Generated from protobuf field .google.protobuf.Duration total_pause_duration = 7; + * @return \Google\Protobuf\Duration|null + */ + public function getTotalPauseDuration() + { + return $this->total_pause_duration; + } + + public function hasTotalPauseDuration() + { + return isset($this->total_pause_duration); + } + + public function clearTotalPauseDuration() + { + unset($this->total_pause_duration); + } + + /** + * The accumulated duration the replication cycle was paused. + * + * Generated from protobuf field .google.protobuf.Duration total_pause_duration = 7; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setTotalPauseDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->total_pause_duration = $var; + + return $this; + } + + /** + * The current progress in percentage of this cycle. + * Was replaced by 'steps' field, which breaks down the cycle progression more + * accurately. + * + * Generated from protobuf field int32 progress_percent = 5 [deprecated = true]; + * @return int + * @deprecated + */ + public function getProgressPercent() + { + @trigger_error('progress_percent is deprecated.', E_USER_DEPRECATED); + return $this->progress_percent; + } + + /** + * The current progress in percentage of this cycle. + * Was replaced by 'steps' field, which breaks down the cycle progression more + * accurately. + * + * Generated from protobuf field int32 progress_percent = 5 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setProgressPercent($var) + { + @trigger_error('progress_percent is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * The cycle's steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CycleStep steps = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * The cycle's steps list representing its progress. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.CycleStep steps = 9; + * @param array<\Google\Cloud\VMMigration\V1\CycleStep>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\CycleStep::class); + $this->steps = $arr; + + return $this; + } + + /** + * State of the ReplicationCycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle.State state = 11; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * State of the ReplicationCycle. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.ReplicationCycle.State state = 11; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\ReplicationCycle\State::class); + $this->state = $var; + + return $this; + } + + /** + * Provides details on the state of the cycle in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 12; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Provides details on the state of the cycle in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 12; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle/State.php new file mode 100644 index 00000000000..b4eb3dbe09e --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationCycle/State.php @@ -0,0 +1,79 @@ +google.cloud.vmmigration.v1.ReplicationCycle.State + */ +class State +{ + /** + * The state is unknown. This is used for API compatibility only and is not + * used by the system. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The replication cycle is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The replication cycle is paused. + * + * Generated from protobuf enum PAUSED = 2; + */ + const PAUSED = 2; + /** + * The replication cycle finished with errors. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The replication cycle finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 4; + */ + const SUCCEEDED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::PAUSED => 'PAUSED', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\ReplicationCycle_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationSync.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationSync.php new file mode 100644 index 00000000000..5723d6e67f4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ReplicationSync.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.ReplicationSync + */ +class ReplicationSync extends \Google\Protobuf\Internal\Message +{ + /** + * The most updated snapshot created time in the source that finished + * replication. + * + * Generated from protobuf field .google.protobuf.Timestamp last_sync_time = 1; + */ + protected $last_sync_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $last_sync_time + * The most updated snapshot created time in the source that finished + * replication. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The most updated snapshot created time in the source that finished + * replication. + * + * Generated from protobuf field .google.protobuf.Timestamp last_sync_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastSyncTime() + { + return $this->last_sync_time; + } + + public function hasLastSyncTime() + { + return isset($this->last_sync_time); + } + + public function clearLastSyncTime() + { + unset($this->last_sync_time); + } + + /** + * The most updated snapshot created time in the source that finished + * replication. + * + * Generated from protobuf field .google.protobuf.Timestamp last_sync_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastSyncTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_sync_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationRequest.php new file mode 100644 index 00000000000..b907eb8348b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationRequest.php @@ -0,0 +1,67 @@ +google.cloud.vmmigration.v1.ResumeMigrationRequest + */ +class ResumeMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $migrating_vm + * Required. The name of the MigratingVm. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationResponse.php new file mode 100644 index 00000000000..7f896956446 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ResumeMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.ResumeMigrationResponse + */ +class ResumeMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulePolicy.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulePolicy.php new file mode 100644 index 00000000000..0ef6fde8d9d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulePolicy.php @@ -0,0 +1,119 @@ +google.cloud.vmmigration.v1.SchedulePolicy + */ +class SchedulePolicy extends \Google\Protobuf\Internal\Message +{ + /** + * The idle duration between replication stages. + * + * Generated from protobuf field .google.protobuf.Duration idle_duration = 1; + */ + protected $idle_duration = null; + /** + * A flag to indicate whether to skip OS adaptation during the replication + * sync. OS adaptation is a process where the VM's operating system undergoes + * changes and adaptations to fully function on Compute Engine. + * + * Generated from protobuf field bool skip_os_adaptation = 2; + */ + protected $skip_os_adaptation = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $idle_duration + * The idle duration between replication stages. + * @type bool $skip_os_adaptation + * A flag to indicate whether to skip OS adaptation during the replication + * sync. OS adaptation is a process where the VM's operating system undergoes + * changes and adaptations to fully function on Compute Engine. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The idle duration between replication stages. + * + * Generated from protobuf field .google.protobuf.Duration idle_duration = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getIdleDuration() + { + return $this->idle_duration; + } + + public function hasIdleDuration() + { + return isset($this->idle_duration); + } + + public function clearIdleDuration() + { + unset($this->idle_duration); + } + + /** + * The idle duration between replication stages. + * + * Generated from protobuf field .google.protobuf.Duration idle_duration = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setIdleDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->idle_duration = $var; + + return $this; + } + + /** + * A flag to indicate whether to skip OS adaptation during the replication + * sync. OS adaptation is a process where the VM's operating system undergoes + * changes and adaptations to fully function on Compute Engine. + * + * Generated from protobuf field bool skip_os_adaptation = 2; + * @return bool + */ + public function getSkipOsAdaptation() + { + return $this->skip_os_adaptation; + } + + /** + * A flag to indicate whether to skip OS adaptation during the replication + * sync. OS adaptation is a process where the VM's operating system undergoes + * changes and adaptations to fully function on Compute Engine. + * + * Generated from protobuf field bool skip_os_adaptation = 2; + * @param bool $var + * @return $this + */ + public function setSkipOsAdaptation($var) + { + GPBUtil::checkBool($var); + $this->skip_os_adaptation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity.php new file mode 100644 index 00000000000..d66ecb3f057 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity.php @@ -0,0 +1,141 @@ +google.cloud.vmmigration.v1.SchedulingNodeAffinity + */ +class SchedulingNodeAffinity extends \Google\Protobuf\Internal\Message +{ + /** + * The label key of Node resource to reference. + * + * Generated from protobuf field string key = 1; + */ + protected $key = ''; + /** + * The operator to use for the node resources specified in the `values` + * parameter. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulingNodeAffinity.Operator operator = 2; + */ + protected $operator = 0; + /** + * Corresponds to the label values of Node resource. + * + * Generated from protobuf field repeated string values = 3; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The label key of Node resource to reference. + * @type int $operator + * The operator to use for the node resources specified in the `values` + * parameter. + * @type array|\Google\Protobuf\Internal\RepeatedField $values + * Corresponds to the label values of Node resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The label key of Node resource to reference. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The label key of Node resource to reference. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The operator to use for the node resources specified in the `values` + * parameter. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulingNodeAffinity.Operator operator = 2; + * @return int + */ + public function getOperator() + { + return $this->operator; + } + + /** + * The operator to use for the node resources specified in the `values` + * parameter. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.SchedulingNodeAffinity.Operator operator = 2; + * @param int $var + * @return $this + */ + public function setOperator($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\SchedulingNodeAffinity\Operator::class); + $this->operator = $var; + + return $this; + } + + /** + * Corresponds to the label values of Node resource. + * + * Generated from protobuf field repeated string values = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * Corresponds to the label values of Node resource. + * + * Generated from protobuf field repeated string values = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->values = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity/Operator.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity/Operator.php new file mode 100644 index 00000000000..ac3acae966d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/SchedulingNodeAffinity/Operator.php @@ -0,0 +1,65 @@ +google.cloud.vmmigration.v1.SchedulingNodeAffinity.Operator + */ +class Operator +{ + /** + * An unknown, unexpected behavior. + * + * Generated from protobuf enum OPERATOR_UNSPECIFIED = 0; + */ + const OPERATOR_UNSPECIFIED = 0; + /** + * The node resource group should be in these resources affinity. + * + * Generated from protobuf enum IN = 1; + */ + const IN = 1; + /** + * The node resource group should not be in these resources affinity. + * + * Generated from protobuf enum NOT_IN = 2; + */ + const NOT_IN = 2; + + private static $valueToName = [ + self::OPERATOR_UNSPECIFIED => 'OPERATOR_UNSPECIFIED', + self::IN => 'IN', + self::NOT_IN => 'NOT_IN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Operator::class, \Google\Cloud\VMMigration\V1\SchedulingNodeAffinity_Operator::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ShuttingDownSourceVMStep.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ShuttingDownSourceVMStep.php new file mode 100644 index 00000000000..64c6ddafe8b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/ShuttingDownSourceVMStep.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.ShuttingDownSourceVMStep + */ +class ShuttingDownSourceVMStep extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Source.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Source.php new file mode 100644 index 00000000000..ae1ab78c28c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/Source.php @@ -0,0 +1,299 @@ +google.cloud.vmmigration.v1.Source + */ +class Source extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * The labels of the source. + * + * Generated from protobuf field map labels = 4; + */ + private $labels; + /** + * User-provided description of the source. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + protected $source_details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\VmwareSourceDetails $vmware + * Vmware type source details. + * @type \Google\Cloud\VMMigration\V1\AwsSourceDetails $aws + * AWS type source details. + * @type string $name + * Output only. The Source name. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The create time timestamp. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The update time timestamp. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels of the source. + * @type string $description + * User-provided description of the source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Vmware type source details. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareSourceDetails vmware = 10; + * @return \Google\Cloud\VMMigration\V1\VmwareSourceDetails|null + */ + public function getVmware() + { + return $this->readOneof(10); + } + + public function hasVmware() + { + return $this->hasOneof(10); + } + + /** + * Vmware type source details. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareSourceDetails vmware = 10; + * @param \Google\Cloud\VMMigration\V1\VmwareSourceDetails $var + * @return $this + */ + public function setVmware($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\VmwareSourceDetails::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * AWS type source details. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails aws = 12; + * @return \Google\Cloud\VMMigration\V1\AwsSourceDetails|null + */ + public function getAws() + { + return $this->readOneof(12); + } + + public function hasAws() + { + return $this->hasOneof(12); + } + + /** + * AWS type source details. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.AwsSourceDetails aws = 12; + * @param \Google\Cloud\VMMigration\V1\AwsSourceDetails $var + * @return $this + */ + public function setAws($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\AwsSourceDetails::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Output only. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The Source name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The create time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The update time timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The labels of the source. + * + * Generated from protobuf field map labels = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels of the source. + * + * Generated from protobuf field map labels = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * User-provided description of the source. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the source. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceDetails() + { + return $this->whichOneof("source_details"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationRequest.php new file mode 100644 index 00000000000..4e456d7c4f8 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationRequest.php @@ -0,0 +1,81 @@ +google.cloud.vmmigration.v1.StartMigrationRequest + */ +class StartMigrationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $migrating_vm = ''; + + /** + * @param string $migratingVm Required. The name of the MigratingVm. Please see + * {@see VmMigrationClient::migratingVmName()} for help formatting this field. + * + * @return \Google\Cloud\VMMigration\V1\StartMigrationRequest + * + * @experimental + */ + public static function build(string $migratingVm): self + { + return (new self()) + ->setMigratingVm($migratingVm); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $migrating_vm + * Required. The name of the MigratingVm. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + /** + * Required. The name of the MigratingVm. + * + * Generated from protobuf field string migrating_vm = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkString($var, True); + $this->migrating_vm = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationResponse.php new file mode 100644 index 00000000000..80c1997ca0c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/StartMigrationResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.StartMigrationResponse + */ +class StartMigrationResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/TargetProject.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/TargetProject.php new file mode 100644 index 00000000000..d19fb184997 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/TargetProject.php @@ -0,0 +1,228 @@ +google.cloud.vmmigration.v1.TargetProject + */ +class TargetProject extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the target project. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The target project ID (number) or project name. + * + * Generated from protobuf field string project = 2; + */ + protected $project = ''; + /** + * The target project's description. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * Output only. The time this target project resource was created (not related + * to when the Compute Engine project it points to was created). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The last time the target project resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the target project. + * @type string $project + * The target project ID (number) or project name. + * @type string $description + * The target project's description. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time this target project resource was created (not related + * to when the Compute Engine project it points to was created). + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last time the target project resource was updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the target project. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the target project. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The target project ID (number) or project name. + * + * Generated from protobuf field string project = 2; + * @return string + */ + public function getProject() + { + return $this->project; + } + + /** + * The target project ID (number) or project name. + * + * Generated from protobuf field string project = 2; + * @param string $var + * @return $this + */ + public function setProject($var) + { + GPBUtil::checkString($var, True); + $this->project = $var; + + return $this; + } + + /** + * The target project's description. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The target project's description. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The time this target project resource was created (not related + * to when the Compute Engine project it points to was created). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time this target project resource was created (not related + * to when the Compute Engine project it points to was created). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The last time the target project resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The last time the target project resource was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateGroupRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateGroupRequest.php new file mode 100644 index 00000000000..c3566d1bd51 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateGroupRequest.php @@ -0,0 +1,230 @@ +google.cloud.vmmigration.v1.UpdateGroupRequest + */ +class UpdateGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $group = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VMMigration\V1\Group $group Required. The update request body. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VMMigration\V1\UpdateGroupRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VMMigration\V1\Group $group, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setGroup($group) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VMMigration\V1\Group $group + * Required. The update request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\Group|null + */ + public function getGroup() + { + return $this->group; + } + + public function hasGroup() + { + return isset($this->group); + } + + public function clearGroup() + { + unset($this->group); + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Group group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\Group $var + * @return $this + */ + public function setGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\Group::class); + $this->group = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateMigratingVmRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateMigratingVmRequest.php new file mode 100644 index 00000000000..4dc83e8dfef --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateMigratingVmRequest.php @@ -0,0 +1,230 @@ +google.cloud.vmmigration.v1.UpdateMigratingVmRequest + */ +class UpdateMigratingVmRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $migrating_vm = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VMMigration\V1\MigratingVm $migratingVm Required. The update request body. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VMMigration\V1\UpdateMigratingVmRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VMMigration\V1\MigratingVm $migratingVm, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setMigratingVm($migratingVm) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VMMigration\V1\MigratingVm $migrating_vm + * Required. The update request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\MigratingVm|null + */ + public function getMigratingVm() + { + return $this->migrating_vm; + } + + public function hasMigratingVm() + { + return isset($this->migrating_vm); + } + + public function clearMigratingVm() + { + unset($this->migrating_vm); + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.MigratingVm migrating_vm = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\MigratingVm $var + * @return $this + */ + public function setMigratingVm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\MigratingVm::class); + $this->migrating_vm = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateSourceRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateSourceRequest.php new file mode 100644 index 00000000000..6fedf6b8437 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateSourceRequest.php @@ -0,0 +1,230 @@ +google.cloud.vmmigration.v1.UpdateSourceRequest + */ +class UpdateSourceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VMMigration\V1\Source $source Required. The update request body. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VMMigration\V1\UpdateSourceRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VMMigration\V1\Source $source, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSource($source) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VMMigration\V1\Source $source + * Required. The update request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\Source|null + */ + public function getSource() + { + return $this->source; + } + + public function hasSource() + { + return isset($this->source); + } + + public function clearSource() + { + unset($this->source); + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.Source source = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\Source $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\Source::class); + $this->source = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateTargetProjectRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateTargetProjectRequest.php new file mode 100644 index 00000000000..64f7eaec970 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpdateTargetProjectRequest.php @@ -0,0 +1,230 @@ +google.cloud.vmmigration.v1.UpdateTargetProjectRequest + */ +class UpdateTargetProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + */ + protected $update_mask = null; + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_project = null; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VMMigration\V1\TargetProject $targetProject Required. The update request body. + * @param \Google\Protobuf\FieldMask $updateMask Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VMMigration\V1\UpdateTargetProjectRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VMMigration\V1\TargetProject $targetProject, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setTargetProject($targetProject) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VMMigration\V1\TargetProject $target_project + * Required. The update request body. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VMMigration\V1\TargetProject|null + */ + public function getTargetProject() + { + return $this->target_project; + } + + public function hasTargetProject() + { + return isset($this->target_project); + } + + public function clearTargetProject() + { + unset($this->target_project); + } + + /** + * Required. The update request body. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.TargetProject target_project = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VMMigration\V1\TargetProject $var + * @return $this + */ + public function setTargetProject($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\TargetProject::class); + $this->target_project = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceRequest.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceRequest.php new file mode 100644 index 00000000000..ceb9df3af2c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceRequest.php @@ -0,0 +1,141 @@ +google.cloud.vmmigration.v1.UpgradeApplianceRequest + */ +class UpgradeApplianceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string datacenter_connector = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $datacenter_connector = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $datacenter_connector + * Required. The DatacenterConnector name. + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string datacenter_connector = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatacenterConnector() + { + return $this->datacenter_connector; + } + + /** + * Required. The DatacenterConnector name. + * + * Generated from protobuf field string datacenter_connector = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatacenterConnector($var) + { + GPBUtil::checkString($var, True); + $this->datacenter_connector = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceResponse.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceResponse.php new file mode 100644 index 00000000000..caff9fe4988 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeApplianceResponse.php @@ -0,0 +1,33 @@ +google.cloud.vmmigration.v1.UpgradeApplianceResponse + */ +class UpgradeApplianceResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus.php new file mode 100644 index 00000000000..ed6bf097167 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus.php @@ -0,0 +1,223 @@ +google.cloud.vmmigration.v1.UpgradeStatus + */ +class UpgradeStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The version to upgrade to. + * + * Generated from protobuf field string version = 1; + */ + protected $version = ''; + /** + * The state of the upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus.State state = 2; + */ + protected $state = 0; + /** + * Provides details on the state of the upgrade operation in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 3; + */ + protected $error = null; + /** + * The time the operation was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + */ + protected $start_time = null; + /** + * The version from which we upgraded. + * + * Generated from protobuf field string previous_version = 5; + */ + protected $previous_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The version to upgrade to. + * @type int $state + * The state of the upgradeAppliance operation. + * @type \Google\Rpc\Status $error + * Provides details on the state of the upgrade operation in case of an error. + * @type \Google\Protobuf\Timestamp $start_time + * The time the operation was started. + * @type string $previous_version + * The version from which we upgraded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The version to upgrade to. + * + * Generated from protobuf field string version = 1; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version to upgrade to. + * + * Generated from protobuf field string version = 1; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * The state of the upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the upgradeAppliance operation. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UpgradeStatus.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\UpgradeStatus\State::class); + $this->state = $var; + + return $this; + } + + /** + * Provides details on the state of the upgrade operation in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 3; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Provides details on the state of the upgrade operation in case of an error. + * + * Generated from protobuf field .google.rpc.Status error = 3; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * The time the operation was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time the operation was started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The version from which we upgraded. + * + * Generated from protobuf field string previous_version = 5; + * @return string + */ + public function getPreviousVersion() + { + return $this->previous_version; + } + + /** + * The version from which we upgraded. + * + * Generated from protobuf field string previous_version = 5; + * @param string $var + * @return $this + */ + public function setPreviousVersion($var) + { + GPBUtil::checkString($var, True); + $this->previous_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus/State.php new file mode 100644 index 00000000000..d35e49d9ae6 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UpgradeStatus/State.php @@ -0,0 +1,71 @@ +google.cloud.vmmigration.v1.UpgradeStatus.State + */ +class State +{ + /** + * The state was not sampled by the health checks yet. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The upgrade has started. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The upgrade failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * The upgrade finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\UpgradeStatus_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport.php new file mode 100644 index 00000000000..322d7e9820a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport.php @@ -0,0 +1,446 @@ +google.cloud.vmmigration.v1.UtilizationReport + */ +class UtilizationReport extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The report unique name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The report display name, as assigned by the user. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. Current state of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_time = null; + /** + * Output only. Provides details on the state of the report in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. The time the report was created (this refers to the time of + * the request, not the time the report creation completed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Time frame of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.TimeFrame time_frame = 7; + */ + protected $time_frame = 0; + /** + * Output only. The point in time when the time frame ends. Notice that the + * time frame is counted backwards. For instance if the "frame_end_time" value + * is 2021/01/20 and the time frame is WEEK then the report covers the week + * between 2021/01/20 and 2021/01/14. + * + * Generated from protobuf field .google.protobuf.Timestamp frame_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $frame_end_time = null; + /** + * Output only. Total number of VMs included in the report. + * + * Generated from protobuf field int32 vm_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $vm_count = 0; + /** + * List of utilization information per VM. + * When sent as part of the request, the "vm_id" field is used in order to + * specify which VMs to include in the report. In that case all other fields + * are ignored. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmUtilizationInfo vms = 10; + */ + private $vms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The report unique name. + * @type string $display_name + * The report display name, as assigned by the user. + * @type int $state + * Output only. Current state of the report. + * @type \Google\Protobuf\Timestamp $state_time + * Output only. The time the state was last set. + * @type \Google\Rpc\Status $error + * Output only. Provides details on the state of the report in case of an + * error. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the report was created (this refers to the time of + * the request, not the time the report creation completed). + * @type int $time_frame + * Time frame of the report. + * @type \Google\Protobuf\Timestamp $frame_end_time + * Output only. The point in time when the time frame ends. Notice that the + * time frame is counted backwards. For instance if the "frame_end_time" value + * is 2021/01/20 and the time frame is WEEK then the report covers the week + * between 2021/01/20 and 2021/01/14. + * @type int $vm_count + * Output only. Total number of VMs included in the report. + * @type array<\Google\Cloud\VMMigration\V1\VmUtilizationInfo>|\Google\Protobuf\Internal\RepeatedField $vms + * List of utilization information per VM. + * When sent as part of the request, the "vm_id" field is used in order to + * specify which VMs to include in the report. In that case all other fields + * are ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The report unique name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The report unique name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The report display name, as assigned by the user. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The report display name, as assigned by the user. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. Current state of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\UtilizationReport\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStateTime() + { + return $this->state_time; + } + + public function hasStateTime() + { + return isset($this->state_time); + } + + public function clearStateTime() + { + unset($this->state_time); + } + + /** + * Output only. The time the state was last set. + * + * Generated from protobuf field .google.protobuf.Timestamp state_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->state_time = $var; + + return $this; + } + + /** + * Output only. Provides details on the state of the report in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. Provides details on the state of the report in case of an + * error. + * + * Generated from protobuf field .google.rpc.Status error = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. The time the report was created (this refers to the time of + * the request, not the time the report creation completed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the report was created (this refers to the time of + * the request, not the time the report creation completed). + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Time frame of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.TimeFrame time_frame = 7; + * @return int + */ + public function getTimeFrame() + { + return $this->time_frame; + } + + /** + * Time frame of the report. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.UtilizationReport.TimeFrame time_frame = 7; + * @param int $var + * @return $this + */ + public function setTimeFrame($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\UtilizationReport\TimeFrame::class); + $this->time_frame = $var; + + return $this; + } + + /** + * Output only. The point in time when the time frame ends. Notice that the + * time frame is counted backwards. For instance if the "frame_end_time" value + * is 2021/01/20 and the time frame is WEEK then the report covers the week + * between 2021/01/20 and 2021/01/14. + * + * Generated from protobuf field .google.protobuf.Timestamp frame_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getFrameEndTime() + { + return $this->frame_end_time; + } + + public function hasFrameEndTime() + { + return isset($this->frame_end_time); + } + + public function clearFrameEndTime() + { + unset($this->frame_end_time); + } + + /** + * Output only. The point in time when the time frame ends. Notice that the + * time frame is counted backwards. For instance if the "frame_end_time" value + * is 2021/01/20 and the time frame is WEEK then the report covers the week + * between 2021/01/20 and 2021/01/14. + * + * Generated from protobuf field .google.protobuf.Timestamp frame_end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setFrameEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->frame_end_time = $var; + + return $this; + } + + /** + * Output only. Total number of VMs included in the report. + * + * Generated from protobuf field int32 vm_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVmCount() + { + return $this->vm_count; + } + + /** + * Output only. Total number of VMs included in the report. + * + * Generated from protobuf field int32 vm_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVmCount($var) + { + GPBUtil::checkInt32($var); + $this->vm_count = $var; + + return $this; + } + + /** + * List of utilization information per VM. + * When sent as part of the request, the "vm_id" field is used in order to + * specify which VMs to include in the report. In that case all other fields + * are ignored. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmUtilizationInfo vms = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVms() + { + return $this->vms; + } + + /** + * List of utilization information per VM. + * When sent as part of the request, the "vm_id" field is used in order to + * specify which VMs to include in the report. In that case all other fields + * are ignored. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmUtilizationInfo vms = 10; + * @param array<\Google\Cloud\VMMigration\V1\VmUtilizationInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\VmUtilizationInfo::class); + $this->vms = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/State.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/State.php new file mode 100644 index 00000000000..2e6f82fb524 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/State.php @@ -0,0 +1,71 @@ +google.cloud.vmmigration.v1.UtilizationReport.State + */ +class State +{ + /** + * The state is unknown. This value is not in use. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The report is in the making. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * Report creation completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * Report creation failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VMMigration\V1\UtilizationReport_State::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/TimeFrame.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/TimeFrame.php new file mode 100644 index 00000000000..6f7489bf7c3 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReport/TimeFrame.php @@ -0,0 +1,71 @@ +google.cloud.vmmigration.v1.UtilizationReport.TimeFrame + */ +class TimeFrame +{ + /** + * The time frame was not specified and will default to WEEK. + * + * Generated from protobuf enum TIME_FRAME_UNSPECIFIED = 0; + */ + const TIME_FRAME_UNSPECIFIED = 0; + /** + * One week. + * + * Generated from protobuf enum WEEK = 1; + */ + const WEEK = 1; + /** + * One month. + * + * Generated from protobuf enum MONTH = 2; + */ + const MONTH = 2; + /** + * One year. + * + * Generated from protobuf enum YEAR = 3; + */ + const YEAR = 3; + + private static $valueToName = [ + self::TIME_FRAME_UNSPECIFIED => 'TIME_FRAME_UNSPECIFIED', + self::WEEK => 'WEEK', + self::MONTH => 'MONTH', + self::YEAR => 'YEAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TimeFrame::class, \Google\Cloud\VMMigration\V1\UtilizationReport_TimeFrame::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReportView.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReportView.php new file mode 100644 index 00000000000..bb5048154cd --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/UtilizationReportView.php @@ -0,0 +1,64 @@ +google.cloud.vmmigration.v1.UtilizationReportView + */ +class UtilizationReportView +{ + /** + * The default / unset value. + * The API will default to FULL on single report request and BASIC for + * multiple reports request. + * + * Generated from protobuf enum UTILIZATION_REPORT_VIEW_UNSPECIFIED = 0; + */ + const UTILIZATION_REPORT_VIEW_UNSPECIFIED = 0; + /** + * Get the report metadata, without the list of VMs and their utilization + * info. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Include everything. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::UTILIZATION_REPORT_VIEW_UNSPECIFIED => 'UTILIZATION_REPORT_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationInfo.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationInfo.php new file mode 100644 index 00000000000..8ba1b02d4c1 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationInfo.php @@ -0,0 +1,153 @@ +google.cloud.vmmigration.v1.VmUtilizationInfo + */ +class VmUtilizationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The VM's ID in the source. + * + * Generated from protobuf field string vm_id = 3; + */ + protected $vm_id = ''; + /** + * Utilization metrics for this VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmUtilizationMetrics utilization = 2; + */ + protected $utilization = null; + protected $VmDetails; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VMMigration\V1\VmwareVmDetails $vmware_vm_details + * The description of the VM in a Source of type Vmware. + * @type string $vm_id + * The VM's ID in the source. + * @type \Google\Cloud\VMMigration\V1\VmUtilizationMetrics $utilization + * Utilization metrics for this VM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The description of the VM in a Source of type Vmware. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails vmware_vm_details = 1; + * @return \Google\Cloud\VMMigration\V1\VmwareVmDetails|null + */ + public function getVmwareVmDetails() + { + return $this->readOneof(1); + } + + public function hasVmwareVmDetails() + { + return $this->hasOneof(1); + } + + /** + * The description of the VM in a Source of type Vmware. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails vmware_vm_details = 1; + * @param \Google\Cloud\VMMigration\V1\VmwareVmDetails $var + * @return $this + */ + public function setVmwareVmDetails($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\VmwareVmDetails::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The VM's ID in the source. + * + * Generated from protobuf field string vm_id = 3; + * @return string + */ + public function getVmId() + { + return $this->vm_id; + } + + /** + * The VM's ID in the source. + * + * Generated from protobuf field string vm_id = 3; + * @param string $var + * @return $this + */ + public function setVmId($var) + { + GPBUtil::checkString($var, True); + $this->vm_id = $var; + + return $this; + } + + /** + * Utilization metrics for this VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmUtilizationMetrics utilization = 2; + * @return \Google\Cloud\VMMigration\V1\VmUtilizationMetrics|null + */ + public function getUtilization() + { + return $this->utilization; + } + + public function hasUtilization() + { + return isset($this->utilization); + } + + public function clearUtilization() + { + unset($this->utilization); + } + + /** + * Utilization metrics for this VM. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmUtilizationMetrics utilization = 2; + * @param \Google\Cloud\VMMigration\V1\VmUtilizationMetrics $var + * @return $this + */ + public function setUtilization($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VMMigration\V1\VmUtilizationMetrics::class); + $this->utilization = $var; + + return $this; + } + + /** + * @return string + */ + public function getVmDetails() + { + return $this->whichOneof("VmDetails"); + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationMetrics.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationMetrics.php new file mode 100644 index 00000000000..e81a156532d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmUtilizationMetrics.php @@ -0,0 +1,313 @@ +google.cloud.vmmigration.v1.VmUtilizationMetrics + */ +class VmUtilizationMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * Max CPU usage, percent. + * + * Generated from protobuf field int32 cpu_max_percent = 9; + */ + protected $cpu_max_percent = 0; + /** + * Average CPU usage, percent. + * + * Generated from protobuf field int32 cpu_average_percent = 10; + */ + protected $cpu_average_percent = 0; + /** + * Max memory usage, percent. + * + * Generated from protobuf field int32 memory_max_percent = 11; + */ + protected $memory_max_percent = 0; + /** + * Average memory usage, percent. + * + * Generated from protobuf field int32 memory_average_percent = 12; + */ + protected $memory_average_percent = 0; + /** + * Max disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_max_kbps = 13; + */ + protected $disk_io_rate_max_kbps = 0; + /** + * Average disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_average_kbps = 14; + */ + protected $disk_io_rate_average_kbps = 0; + /** + * Max network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_max_kbps = 15; + */ + protected $network_throughput_max_kbps = 0; + /** + * Average network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_average_kbps = 16; + */ + protected $network_throughput_average_kbps = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $cpu_max_percent + * Max CPU usage, percent. + * @type int $cpu_average_percent + * Average CPU usage, percent. + * @type int $memory_max_percent + * Max memory usage, percent. + * @type int $memory_average_percent + * Average memory usage, percent. + * @type int|string $disk_io_rate_max_kbps + * Max disk IO rate, in kilobytes per second. + * @type int|string $disk_io_rate_average_kbps + * Average disk IO rate, in kilobytes per second. + * @type int|string $network_throughput_max_kbps + * Max network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * @type int|string $network_throughput_average_kbps + * Average network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * Max CPU usage, percent. + * + * Generated from protobuf field int32 cpu_max_percent = 9; + * @return int + */ + public function getCpuMaxPercent() + { + return $this->cpu_max_percent; + } + + /** + * Max CPU usage, percent. + * + * Generated from protobuf field int32 cpu_max_percent = 9; + * @param int $var + * @return $this + */ + public function setCpuMaxPercent($var) + { + GPBUtil::checkInt32($var); + $this->cpu_max_percent = $var; + + return $this; + } + + /** + * Average CPU usage, percent. + * + * Generated from protobuf field int32 cpu_average_percent = 10; + * @return int + */ + public function getCpuAveragePercent() + { + return $this->cpu_average_percent; + } + + /** + * Average CPU usage, percent. + * + * Generated from protobuf field int32 cpu_average_percent = 10; + * @param int $var + * @return $this + */ + public function setCpuAveragePercent($var) + { + GPBUtil::checkInt32($var); + $this->cpu_average_percent = $var; + + return $this; + } + + /** + * Max memory usage, percent. + * + * Generated from protobuf field int32 memory_max_percent = 11; + * @return int + */ + public function getMemoryMaxPercent() + { + return $this->memory_max_percent; + } + + /** + * Max memory usage, percent. + * + * Generated from protobuf field int32 memory_max_percent = 11; + * @param int $var + * @return $this + */ + public function setMemoryMaxPercent($var) + { + GPBUtil::checkInt32($var); + $this->memory_max_percent = $var; + + return $this; + } + + /** + * Average memory usage, percent. + * + * Generated from protobuf field int32 memory_average_percent = 12; + * @return int + */ + public function getMemoryAveragePercent() + { + return $this->memory_average_percent; + } + + /** + * Average memory usage, percent. + * + * Generated from protobuf field int32 memory_average_percent = 12; + * @param int $var + * @return $this + */ + public function setMemoryAveragePercent($var) + { + GPBUtil::checkInt32($var); + $this->memory_average_percent = $var; + + return $this; + } + + /** + * Max disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_max_kbps = 13; + * @return int|string + */ + public function getDiskIoRateMaxKbps() + { + return $this->disk_io_rate_max_kbps; + } + + /** + * Max disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_max_kbps = 13; + * @param int|string $var + * @return $this + */ + public function setDiskIoRateMaxKbps($var) + { + GPBUtil::checkInt64($var); + $this->disk_io_rate_max_kbps = $var; + + return $this; + } + + /** + * Average disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_average_kbps = 14; + * @return int|string + */ + public function getDiskIoRateAverageKbps() + { + return $this->disk_io_rate_average_kbps; + } + + /** + * Average disk IO rate, in kilobytes per second. + * + * Generated from protobuf field int64 disk_io_rate_average_kbps = 14; + * @param int|string $var + * @return $this + */ + public function setDiskIoRateAverageKbps($var) + { + GPBUtil::checkInt64($var); + $this->disk_io_rate_average_kbps = $var; + + return $this; + } + + /** + * Max network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_max_kbps = 15; + * @return int|string + */ + public function getNetworkThroughputMaxKbps() + { + return $this->network_throughput_max_kbps; + } + + /** + * Max network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_max_kbps = 15; + * @param int|string $var + * @return $this + */ + public function setNetworkThroughputMaxKbps($var) + { + GPBUtil::checkInt64($var); + $this->network_throughput_max_kbps = $var; + + return $this; + } + + /** + * Average network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_average_kbps = 16; + * @return int|string + */ + public function getNetworkThroughputAverageKbps() + { + return $this->network_throughput_average_kbps; + } + + /** + * Average network throughput (combined transmit-rates and receive-rates), in + * kilobytes per second. + * + * Generated from protobuf field int64 network_throughput_average_kbps = 16; + * @param int|string $var + * @return $this + */ + public function setNetworkThroughputAverageKbps($var) + { + GPBUtil::checkInt64($var); + $this->network_throughput_average_kbps = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareSourceDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareSourceDetails.php new file mode 100644 index 00000000000..751c4aebdc1 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareSourceDetails.php @@ -0,0 +1,174 @@ +google.cloud.vmmigration.v1.VmwareSourceDetails + */ +class VmwareSourceDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The credentials username. + * + * Generated from protobuf field string username = 1; + */ + protected $username = ''; + /** + * Input only. The credentials password. This is write only and can not be + * read in a GET operation. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $password = ''; + /** + * The ip address of the vcenter this Source represents. + * + * Generated from protobuf field string vcenter_ip = 3; + */ + protected $vcenter_ip = ''; + /** + * The thumbprint representing the certificate for the vcenter. + * + * Generated from protobuf field string thumbprint = 4; + */ + protected $thumbprint = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * The credentials username. + * @type string $password + * Input only. The credentials password. This is write only and can not be + * read in a GET operation. + * @type string $vcenter_ip + * The ip address of the vcenter this Source represents. + * @type string $thumbprint + * The thumbprint representing the certificate for the vcenter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The credentials username. + * + * Generated from protobuf field string username = 1; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * The credentials username. + * + * Generated from protobuf field string username = 1; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Input only. The credentials password. This is write only and can not be + * read in a GET operation. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Input only. The credentials password. This is write only and can not be + * read in a GET operation. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + + /** + * The ip address of the vcenter this Source represents. + * + * Generated from protobuf field string vcenter_ip = 3; + * @return string + */ + public function getVcenterIp() + { + return $this->vcenter_ip; + } + + /** + * The ip address of the vcenter this Source represents. + * + * Generated from protobuf field string vcenter_ip = 3; + * @param string $var + * @return $this + */ + public function setVcenterIp($var) + { + GPBUtil::checkString($var, True); + $this->vcenter_ip = $var; + + return $this; + } + + /** + * The thumbprint representing the certificate for the vcenter. + * + * Generated from protobuf field string thumbprint = 4; + * @return string + */ + public function getThumbprint() + { + return $this->thumbprint; + } + + /** + * The thumbprint representing the certificate for the vcenter. + * + * Generated from protobuf field string thumbprint = 4; + * @param string $var + * @return $this + */ + public function setThumbprint($var) + { + GPBUtil::checkString($var, True); + $this->thumbprint = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails.php new file mode 100644 index 00000000000..d35cf1bfd3e --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails.php @@ -0,0 +1,453 @@ +google.cloud.vmmigration.v1.VmwareVmDetails + */ +class VmwareVmDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The VM's id in the source (note that this is not the MigratingVm's id). + * This is the moref id of the VM. + * + * Generated from protobuf field string vm_id = 1; + */ + protected $vm_id = ''; + /** + * The id of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_id = 2; + */ + protected $datacenter_id = ''; + /** + * The descriptive name of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_description = 3; + */ + protected $datacenter_description = ''; + /** + * The unique identifier of the VM in vCenter. + * + * Generated from protobuf field string uuid = 4; + */ + protected $uuid = ''; + /** + * The display name of the VM. Note that this is not necessarily unique. + * + * Generated from protobuf field string display_name = 5; + */ + protected $display_name = ''; + /** + * The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.PowerState power_state = 6; + */ + protected $power_state = 0; + /** + * The number of cpus in the VM. + * + * Generated from protobuf field int32 cpu_count = 7; + */ + protected $cpu_count = 0; + /** + * The size of the memory of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 8; + */ + protected $memory_mb = 0; + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 9; + */ + protected $disk_count = 0; + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 12; + */ + protected $committed_storage_mb = 0; + /** + * The VM's OS. See for example + * https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html + * for types of strings this might hold. + * + * Generated from protobuf field string guest_description = 11; + */ + protected $guest_description = ''; + /** + * Output only. The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.BootOption boot_option = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $boot_option = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $vm_id + * The VM's id in the source (note that this is not the MigratingVm's id). + * This is the moref id of the VM. + * @type string $datacenter_id + * The id of the vCenter's datacenter this VM is contained in. + * @type string $datacenter_description + * The descriptive name of the vCenter's datacenter this VM is contained in. + * @type string $uuid + * The unique identifier of the VM in vCenter. + * @type string $display_name + * The display name of the VM. Note that this is not necessarily unique. + * @type int $power_state + * The power state of the VM at the moment list was taken. + * @type int $cpu_count + * The number of cpus in the VM. + * @type int $memory_mb + * The size of the memory of the VM in MB. + * @type int $disk_count + * The number of disks the VM has. + * @type int|string $committed_storage_mb + * The total size of the storage allocated to the VM in MB. + * @type string $guest_description + * The VM's OS. See for example + * https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html + * for types of strings this might hold. + * @type int $boot_option + * Output only. The VM Boot Option. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The VM's id in the source (note that this is not the MigratingVm's id). + * This is the moref id of the VM. + * + * Generated from protobuf field string vm_id = 1; + * @return string + */ + public function getVmId() + { + return $this->vm_id; + } + + /** + * The VM's id in the source (note that this is not the MigratingVm's id). + * This is the moref id of the VM. + * + * Generated from protobuf field string vm_id = 1; + * @param string $var + * @return $this + */ + public function setVmId($var) + { + GPBUtil::checkString($var, True); + $this->vm_id = $var; + + return $this; + } + + /** + * The id of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_id = 2; + * @return string + */ + public function getDatacenterId() + { + return $this->datacenter_id; + } + + /** + * The id of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_id = 2; + * @param string $var + * @return $this + */ + public function setDatacenterId($var) + { + GPBUtil::checkString($var, True); + $this->datacenter_id = $var; + + return $this; + } + + /** + * The descriptive name of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_description = 3; + * @return string + */ + public function getDatacenterDescription() + { + return $this->datacenter_description; + } + + /** + * The descriptive name of the vCenter's datacenter this VM is contained in. + * + * Generated from protobuf field string datacenter_description = 3; + * @param string $var + * @return $this + */ + public function setDatacenterDescription($var) + { + GPBUtil::checkString($var, True); + $this->datacenter_description = $var; + + return $this; + } + + /** + * The unique identifier of the VM in vCenter. + * + * Generated from protobuf field string uuid = 4; + * @return string + */ + public function getUuid() + { + return $this->uuid; + } + + /** + * The unique identifier of the VM in vCenter. + * + * Generated from protobuf field string uuid = 4; + * @param string $var + * @return $this + */ + public function setUuid($var) + { + GPBUtil::checkString($var, True); + $this->uuid = $var; + + return $this; + } + + /** + * The display name of the VM. Note that this is not necessarily unique. + * + * Generated from protobuf field string display_name = 5; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the VM. Note that this is not necessarily unique. + * + * Generated from protobuf field string display_name = 5; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.PowerState power_state = 6; + * @return int + */ + public function getPowerState() + { + return $this->power_state; + } + + /** + * The power state of the VM at the moment list was taken. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.PowerState power_state = 6; + * @param int $var + * @return $this + */ + public function setPowerState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\VmwareVmDetails\PowerState::class); + $this->power_state = $var; + + return $this; + } + + /** + * The number of cpus in the VM. + * + * Generated from protobuf field int32 cpu_count = 7; + * @return int + */ + public function getCpuCount() + { + return $this->cpu_count; + } + + /** + * The number of cpus in the VM. + * + * Generated from protobuf field int32 cpu_count = 7; + * @param int $var + * @return $this + */ + public function setCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->cpu_count = $var; + + return $this; + } + + /** + * The size of the memory of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 8; + * @return int + */ + public function getMemoryMb() + { + return $this->memory_mb; + } + + /** + * The size of the memory of the VM in MB. + * + * Generated from protobuf field int32 memory_mb = 8; + * @param int $var + * @return $this + */ + public function setMemoryMb($var) + { + GPBUtil::checkInt32($var); + $this->memory_mb = $var; + + return $this; + } + + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 9; + * @return int + */ + public function getDiskCount() + { + return $this->disk_count; + } + + /** + * The number of disks the VM has. + * + * Generated from protobuf field int32 disk_count = 9; + * @param int $var + * @return $this + */ + public function setDiskCount($var) + { + GPBUtil::checkInt32($var); + $this->disk_count = $var; + + return $this; + } + + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 12; + * @return int|string + */ + public function getCommittedStorageMb() + { + return $this->committed_storage_mb; + } + + /** + * The total size of the storage allocated to the VM in MB. + * + * Generated from protobuf field int64 committed_storage_mb = 12; + * @param int|string $var + * @return $this + */ + public function setCommittedStorageMb($var) + { + GPBUtil::checkInt64($var); + $this->committed_storage_mb = $var; + + return $this; + } + + /** + * The VM's OS. See for example + * https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html + * for types of strings this might hold. + * + * Generated from protobuf field string guest_description = 11; + * @return string + */ + public function getGuestDescription() + { + return $this->guest_description; + } + + /** + * The VM's OS. See for example + * https://vdc-repo.vmware.com/vmwb-repository/dcr-public/da47f910-60ac-438b-8b9b-6122f4d14524/16b7274a-bf8b-4b4c-a05e-746f2aa93c8c/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html + * for types of strings this might hold. + * + * Generated from protobuf field string guest_description = 11; + * @param string $var + * @return $this + */ + public function setGuestDescription($var) + { + GPBUtil::checkString($var, True); + $this->guest_description = $var; + + return $this; + } + + /** + * Output only. The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.BootOption boot_option = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getBootOption() + { + return $this->boot_option; + } + + /** + * Output only. The VM Boot Option. + * + * Generated from protobuf field .google.cloud.vmmigration.v1.VmwareVmDetails.BootOption boot_option = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setBootOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VMMigration\V1\VmwareVmDetails\BootOption::class); + $this->boot_option = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/BootOption.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/BootOption.php new file mode 100644 index 00000000000..a8339218052 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/BootOption.php @@ -0,0 +1,64 @@ +google.cloud.vmmigration.v1.VmwareVmDetails.BootOption + */ +class BootOption +{ + /** + * The boot option is unknown. + * + * Generated from protobuf enum BOOT_OPTION_UNSPECIFIED = 0; + */ + const BOOT_OPTION_UNSPECIFIED = 0; + /** + * The boot option is EFI. + * + * Generated from protobuf enum EFI = 1; + */ + const EFI = 1; + /** + * The boot option is BIOS. + * + * Generated from protobuf enum BIOS = 2; + */ + const BIOS = 2; + + private static $valueToName = [ + self::BOOT_OPTION_UNSPECIFIED => 'BOOT_OPTION_UNSPECIFIED', + self::EFI => 'EFI', + self::BIOS => 'BIOS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BootOption::class, \Google\Cloud\VMMigration\V1\VmwareVmDetails_BootOption::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/PowerState.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/PowerState.php new file mode 100644 index 00000000000..925c1f5a6f4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmDetails/PowerState.php @@ -0,0 +1,71 @@ +google.cloud.vmmigration.v1.VmwareVmDetails.PowerState + */ +class PowerState +{ + /** + * Power state is not specified. + * + * Generated from protobuf enum POWER_STATE_UNSPECIFIED = 0; + */ + const POWER_STATE_UNSPECIFIED = 0; + /** + * The VM is turned ON. + * + * Generated from protobuf enum ON = 1; + */ + const ON = 1; + /** + * The VM is turned OFF. + * + * Generated from protobuf enum OFF = 2; + */ + const OFF = 2; + /** + * The VM is suspended. This is similar to hibernation or sleep mode. + * + * Generated from protobuf enum SUSPENDED = 3; + */ + const SUSPENDED = 3; + + private static $valueToName = [ + self::POWER_STATE_UNSPECIFIED => 'POWER_STATE_UNSPECIFIED', + self::ON => 'ON', + self::OFF => 'OFF', + self::SUSPENDED => 'SUSPENDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PowerState::class, \Google\Cloud\VMMigration\V1\VmwareVmDetails_PowerState::class); + diff --git a/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmsDetails.php b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmsDetails.php new file mode 100644 index 00000000000..96796ec1c12 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/proto/src/Google/Cloud/VMMigration/V1/VmwareVmsDetails.php @@ -0,0 +1,67 @@ +google.cloud.vmmigration.v1.VmwareVmsDetails + */ +class VmwareVmsDetails extends \Google\Protobuf\Internal\Message +{ + /** + * The details of the vmware VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmwareVmDetails details = 1; + */ + private $details; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VMMigration\V1\VmwareVmDetails>|\Google\Protobuf\Internal\RepeatedField $details + * The details of the vmware VMs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmmigration\V1\Vmmigration::initOnce(); + parent::__construct($data); + } + + /** + * The details of the vmware VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmwareVmDetails details = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetails() + { + return $this->details; + } + + /** + * The details of the vmware VMs. + * + * Generated from protobuf field repeated .google.cloud.vmmigration.v1.VmwareVmDetails details = 1; + * @param array<\Google\Cloud\VMMigration\V1\VmwareVmDetails>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VMMigration\V1\VmwareVmDetails::class); + $this->details = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/add_group_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/add_group_migration.php new file mode 100644 index 00000000000..c1149ffb2ce --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/add_group_migration.php @@ -0,0 +1,83 @@ +setGroup($formattedGroup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->addGroupMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var AddGroupMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + + add_group_migration_sample($formattedGroup); +} +// [END vmmigration_v1_generated_VmMigration_AddGroupMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_clone_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_clone_job.php new file mode 100644 index 00000000000..7f0c1864eb4 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_clone_job.php @@ -0,0 +1,89 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->cancelCloneJob($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CancelCloneJobResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + + cancel_clone_job_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_CancelCloneJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_cutover_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_cutover_job.php new file mode 100644 index 00000000000..54e25699d4a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/cancel_cutover_job.php @@ -0,0 +1,89 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->cancelCutoverJob($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CancelCutoverJobResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + + cancel_cutover_job_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_CancelCutoverJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_clone_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_clone_job.php new file mode 100644 index 00000000000..583a8c71260 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_clone_job.php @@ -0,0 +1,93 @@ +setParent($formattedParent) + ->setCloneJobId($cloneJobId) + ->setCloneJob($cloneJob); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createCloneJob($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CloneJob $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + $cloneJobId = '[CLONE_JOB_ID]'; + + create_clone_job_sample($formattedParent, $cloneJobId); +} +// [END vmmigration_v1_generated_VmMigration_CreateCloneJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_cutover_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_cutover_job.php new file mode 100644 index 00000000000..9c09806ea5b --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_cutover_job.php @@ -0,0 +1,95 @@ +setParent($formattedParent) + ->setCutoverJobId($cutoverJobId) + ->setCutoverJob($cutoverJob); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createCutoverJob($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CutoverJob $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + $cutoverJobId = '[CUTOVER_JOB_ID]'; + + create_cutover_job_sample($formattedParent, $cutoverJobId); +} +// [END vmmigration_v1_generated_VmMigration_CreateCutoverJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_datacenter_connector.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_datacenter_connector.php new file mode 100644 index 00000000000..5a6d0b79ede --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_datacenter_connector.php @@ -0,0 +1,93 @@ +setParent($formattedParent) + ->setDatacenterConnectorId($datacenterConnectorId) + ->setDatacenterConnector($datacenterConnector); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createDatacenterConnector($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DatacenterConnector $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $datacenterConnectorId = '[DATACENTER_CONNECTOR_ID]'; + + create_datacenter_connector_sample($formattedParent, $datacenterConnectorId); +} +// [END vmmigration_v1_generated_VmMigration_CreateDatacenterConnector_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_group.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_group.php new file mode 100644 index 00000000000..6c8db44dcbe --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_group.php @@ -0,0 +1,88 @@ +setParent($formattedParent) + ->setGroupId($groupId) + ->setGroup($group); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createGroup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Group $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $groupId = '[GROUP_ID]'; + + create_group_sample($formattedParent, $groupId); +} +// [END vmmigration_v1_generated_VmMigration_CreateGroup_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_migrating_vm.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_migrating_vm.php new file mode 100644 index 00000000000..9bb80007933 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_migrating_vm.php @@ -0,0 +1,88 @@ +setParent($formattedParent) + ->setMigratingVmId($migratingVmId) + ->setMigratingVm($migratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createMigratingVm($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MigratingVm $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $migratingVmId = '[MIGRATING_VM_ID]'; + + create_migrating_vm_sample($formattedParent, $migratingVmId); +} +// [END vmmigration_v1_generated_VmMigration_CreateMigratingVm_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_source.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_source.php new file mode 100644 index 00000000000..a58e3ff3237 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_source.php @@ -0,0 +1,88 @@ +setParent($formattedParent) + ->setSourceId($sourceId) + ->setSource($source); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createSource($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Source $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $sourceId = '[SOURCE_ID]'; + + create_source_sample($formattedParent, $sourceId); +} +// [END vmmigration_v1_generated_VmMigration_CreateSource_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_target_project.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_target_project.php new file mode 100644 index 00000000000..6a4a065f7cb --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_target_project.php @@ -0,0 +1,91 @@ +setParent($formattedParent) + ->setTargetProjectId($targetProjectId) + ->setTargetProject($targetProject); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createTargetProject($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TargetProject $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $targetProjectId = '[TARGET_PROJECT_ID]'; + + create_target_project_sample($formattedParent, $targetProjectId); +} +// [END vmmigration_v1_generated_VmMigration_CreateTargetProject_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_utilization_report.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_utilization_report.php new file mode 100644 index 00000000000..006b3b0f260 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/create_utilization_report.php @@ -0,0 +1,95 @@ +setParent($formattedParent) + ->setUtilizationReport($utilizationReport) + ->setUtilizationReportId($utilizationReportId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->createUtilizationReport($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var UtilizationReport $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $utilizationReportId = '[UTILIZATION_REPORT_ID]'; + + create_utilization_report_sample($formattedParent, $utilizationReportId); +} +// [END vmmigration_v1_generated_VmMigration_CreateUtilizationReport_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_datacenter_connector.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_datacenter_connector.php new file mode 100644 index 00000000000..993b71b4385 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_datacenter_connector.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteDatacenterConnector($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + + delete_datacenter_connector_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteDatacenterConnector_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_group.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_group.php new file mode 100644 index 00000000000..e970916f7c2 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_group.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteGroup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + + delete_group_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteGroup_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_migrating_vm.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_migrating_vm.php new file mode 100644 index 00000000000..262f5b57230 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_migrating_vm.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteMigratingVm($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + delete_migrating_vm_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteMigratingVm_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_source.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_source.php new file mode 100644 index 00000000000..6f5da2d0372 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_source.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteSource($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + + delete_source_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteSource_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_target_project.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_target_project.php new file mode 100644 index 00000000000..70ea146c9bb --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_target_project.php @@ -0,0 +1,87 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteTargetProject($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::targetProjectName( + '[PROJECT]', + '[LOCATION]', + '[TARGET_PROJECT]' + ); + + delete_target_project_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteTargetProject_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_utilization_report.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_utilization_report.php new file mode 100644 index 00000000000..291a7ee83c8 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/delete_utilization_report.php @@ -0,0 +1,85 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->deleteUtilizationReport($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + + delete_utilization_report_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_DeleteUtilizationReport_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/fetch_inventory.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/fetch_inventory.php new file mode 100644 index 00000000000..8550ce32893 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/fetch_inventory.php @@ -0,0 +1,75 @@ +setSource($formattedSource); + + // Call the API and handle any network failures. + try { + /** @var FetchInventoryResponse $response */ + $response = $vmMigrationClient->fetchInventory($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSource = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + + fetch_inventory_sample($formattedSource); +} +// [END vmmigration_v1_generated_VmMigration_FetchInventory_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/finalize_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/finalize_migration.php new file mode 100644 index 00000000000..1efd40ebfff --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/finalize_migration.php @@ -0,0 +1,89 @@ +setMigratingVm($formattedMigratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->finalizeMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var FinalizeMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedMigratingVm = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + finalize_migration_sample($formattedMigratingVm); +} +// [END vmmigration_v1_generated_VmMigration_FinalizeMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_clone_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_clone_job.php new file mode 100644 index 00000000000..1acd3193f37 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_clone_job.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CloneJob $response */ + $response = $vmMigrationClient->getCloneJob($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::cloneJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CLONE_JOB]' + ); + + get_clone_job_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetCloneJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_cutover_job.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_cutover_job.php new file mode 100644 index 00000000000..b56ebfd889d --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_cutover_job.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CutoverJob $response */ + $response = $vmMigrationClient->getCutoverJob($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::cutoverJobName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[CUTOVER_JOB]' + ); + + get_cutover_job_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetCutoverJob_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_datacenter_connector.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_datacenter_connector.php new file mode 100644 index 00000000000..f10424c13d5 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_datacenter_connector.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DatacenterConnector $response */ + $response = $vmMigrationClient->getDatacenterConnector($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + + get_datacenter_connector_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetDatacenterConnector_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_group.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_group.php new file mode 100644 index 00000000000..68e2412fcb9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_group.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Group $response */ + $response = $vmMigrationClient->getGroup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + + get_group_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetGroup_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_location.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_location.php new file mode 100644 index 00000000000..8dc72c4f1e9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_GetLocation_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_migrating_vm.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_migrating_vm.php new file mode 100644 index 00000000000..e10be327fb9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_migrating_vm.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MigratingVm $response */ + $response = $vmMigrationClient->getMigratingVm($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + get_migrating_vm_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetMigratingVm_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_replication_cycle.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_replication_cycle.php new file mode 100644 index 00000000000..588a87cf36c --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_replication_cycle.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ReplicationCycle $response */ + $response = $vmMigrationClient->getReplicationCycle($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::replicationCycleName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]', + '[REPLICATION_CYCLE]' + ); + + get_replication_cycle_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetReplicationCycle_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_source.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_source.php new file mode 100644 index 00000000000..632be52c6f9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_source.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Source $response */ + $response = $vmMigrationClient->getSource($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + + get_source_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetSource_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_target_project.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_target_project.php new file mode 100644 index 00000000000..4509ae4b4f1 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_target_project.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var TargetProject $response */ + $response = $vmMigrationClient->getTargetProject($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::targetProjectName( + '[PROJECT]', + '[LOCATION]', + '[TARGET_PROJECT]' + ); + + get_target_project_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetTargetProject_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_utilization_report.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_utilization_report.php new file mode 100644 index 00000000000..8c7a7169c43 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/get_utilization_report.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var UtilizationReport $response */ + $response = $vmMigrationClient->getUtilizationReport($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmMigrationClient::utilizationReportName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[UTILIZATION_REPORT]' + ); + + get_utilization_report_sample($formattedName); +} +// [END vmmigration_v1_generated_VmMigration_GetUtilizationReport_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_clone_jobs.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_clone_jobs.php new file mode 100644 index 00000000000..63a58c1987a --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_clone_jobs.php @@ -0,0 +1,87 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listCloneJobs($request); + + /** @var CloneJob $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + $pageToken = '[PAGE_TOKEN]'; + + list_clone_jobs_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListCloneJobs_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_cutover_jobs.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_cutover_jobs.php new file mode 100644 index 00000000000..6b869a4b889 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_cutover_jobs.php @@ -0,0 +1,87 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listCutoverJobs($request); + + /** @var CutoverJob $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + $pageToken = '[PAGE_TOKEN]'; + + list_cutover_jobs_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListCutoverJobs_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_datacenter_connectors.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_datacenter_connectors.php new file mode 100644 index 00000000000..398c35b6f75 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_datacenter_connectors.php @@ -0,0 +1,82 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listDatacenterConnectors($request); + + /** @var DatacenterConnector $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = '[PAGE_TOKEN]'; + + list_datacenter_connectors_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListDatacenterConnectors_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_groups.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_groups.php new file mode 100644 index 00000000000..7b405b9f8ee --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_groups.php @@ -0,0 +1,82 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listGroups($request); + + /** @var Group $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $pageToken = '[PAGE_TOKEN]'; + + list_groups_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListGroups_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_locations.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_locations.php new file mode 100644 index 00000000000..f765b432d73 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_ListLocations_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_migrating_vms.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_migrating_vms.php new file mode 100644 index 00000000000..314d02fc299 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_migrating_vms.php @@ -0,0 +1,82 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listMigratingVms($request); + + /** @var MigratingVm $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = '[PAGE_TOKEN]'; + + list_migrating_vms_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListMigratingVms_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_replication_cycles.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_replication_cycles.php new file mode 100644 index 00000000000..91543c4635f --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_replication_cycles.php @@ -0,0 +1,87 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listReplicationCycles($request); + + /** @var ReplicationCycle $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + $pageToken = '[PAGE_TOKEN]'; + + list_replication_cycles_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListReplicationCycles_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_sources.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_sources.php new file mode 100644 index 00000000000..084038f7e53 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_sources.php @@ -0,0 +1,82 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listSources($request); + + /** @var Source $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $pageToken = '[PAGE_TOKEN]'; + + list_sources_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListSources_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_target_projects.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_target_projects.php new file mode 100644 index 00000000000..7605687b9a0 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_target_projects.php @@ -0,0 +1,85 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listTargetProjects($request); + + /** @var TargetProject $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::locationName('[PROJECT]', '[LOCATION]'); + $pageToken = '[PAGE_TOKEN]'; + + list_target_projects_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListTargetProjects_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_utilization_reports.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_utilization_reports.php new file mode 100644 index 00000000000..8d5cd0d4e91 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/list_utilization_reports.php @@ -0,0 +1,82 @@ +setParent($formattedParent) + ->setPageToken($pageToken); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmMigrationClient->listUtilizationReports($request); + + /** @var UtilizationReport $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmMigrationClient::sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = '[PAGE_TOKEN]'; + + list_utilization_reports_sample($formattedParent, $pageToken); +} +// [END vmmigration_v1_generated_VmMigration_ListUtilizationReports_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/pause_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/pause_migration.php new file mode 100644 index 00000000000..c5b34d9bcef --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/pause_migration.php @@ -0,0 +1,90 @@ +setMigratingVm($formattedMigratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->pauseMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PauseMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedMigratingVm = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + pause_migration_sample($formattedMigratingVm); +} +// [END vmmigration_v1_generated_VmMigration_PauseMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/remove_group_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/remove_group_migration.php new file mode 100644 index 00000000000..6daf0dfa674 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/remove_group_migration.php @@ -0,0 +1,83 @@ +setGroup($formattedGroup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->removeGroupMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RemoveGroupMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedGroup = VmMigrationClient::groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + + remove_group_migration_sample($formattedGroup); +} +// [END vmmigration_v1_generated_VmMigration_RemoveGroupMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/resume_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/resume_migration.php new file mode 100644 index 00000000000..63a188540ee --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/resume_migration.php @@ -0,0 +1,91 @@ +setMigratingVm($formattedMigratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->resumeMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ResumeMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedMigratingVm = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + resume_migration_sample($formattedMigratingVm); +} +// [END vmmigration_v1_generated_VmMigration_ResumeMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/start_migration.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/start_migration.php new file mode 100644 index 00000000000..3a7702e45a1 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/start_migration.php @@ -0,0 +1,89 @@ +setMigratingVm($formattedMigratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->startMigration($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var StartMigrationResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedMigratingVm = VmMigrationClient::migratingVmName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[MIGRATING_VM]' + ); + + start_migration_sample($formattedMigratingVm); +} +// [END vmmigration_v1_generated_VmMigration_StartMigration_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_group.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_group.php new file mode 100644 index 00000000000..e3468de71b9 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_group.php @@ -0,0 +1,71 @@ +setGroup($group); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->updateGroup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Group $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_UpdateGroup_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_migrating_vm.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_migrating_vm.php new file mode 100644 index 00000000000..dc1fc7086de --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_migrating_vm.php @@ -0,0 +1,71 @@ +setMigratingVm($migratingVm); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->updateMigratingVm($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MigratingVm $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_UpdateMigratingVm_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_source.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_source.php new file mode 100644 index 00000000000..14f89e98f59 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_source.php @@ -0,0 +1,71 @@ +setSource($source); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->updateSource($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Source $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_UpdateSource_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_target_project.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_target_project.php new file mode 100644 index 00000000000..a8c541b7cbc --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/update_target_project.php @@ -0,0 +1,74 @@ +setTargetProject($targetProject); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->updateTargetProject($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TargetProject $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmmigration_v1_generated_VmMigration_UpdateTargetProject_sync] diff --git a/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/upgrade_appliance.php b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/upgrade_appliance.php new file mode 100644 index 00000000000..39731268643 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/samples/V1/VmMigrationClient/upgrade_appliance.php @@ -0,0 +1,89 @@ +setDatacenterConnector($formattedDatacenterConnector); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmMigrationClient->upgradeAppliance($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var UpgradeApplianceResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatacenterConnector = VmMigrationClient::datacenterConnectorName( + '[PROJECT]', + '[LOCATION]', + '[SOURCE]', + '[DATACENTER_CONNECTOR]' + ); + + upgrade_appliance_sample($formattedDatacenterConnector); +} +// [END vmmigration_v1_generated_VmMigration_UpgradeAppliance_sync] diff --git a/owl-bot-staging/VmMigration/v1/src/V1/Client/VmMigrationClient.php b/owl-bot-staging/VmMigration/v1/src/V1/Client/VmMigrationClient.php new file mode 100644 index 00000000000..56dbb87cf74 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/src/V1/Client/VmMigrationClient.php @@ -0,0 +1,1828 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vm_migration_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vm_migration_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vm_migration_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vm_migration_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a clone_job + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $cloneJob + * + * @return string The formatted clone_job resource. + */ + public static function cloneJobName(string $project, string $location, string $source, string $migratingVm, string $cloneJob): string + { + return self::getPathTemplate('cloneJob')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'clone_job' => $cloneJob, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cutover_job + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $cutoverJob + * + * @return string The formatted cutover_job resource. + */ + public static function cutoverJobName(string $project, string $location, string $source, string $migratingVm, string $cutoverJob): string + { + return self::getPathTemplate('cutoverJob')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'cutover_job' => $cutoverJob, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * datacenter_connector resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $datacenterConnector + * + * @return string The formatted datacenter_connector resource. + */ + public static function datacenterConnectorName(string $project, string $location, string $source, string $datacenterConnector): string + { + return self::getPathTemplate('datacenterConnector')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'datacenter_connector' => $datacenterConnector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a group + * resource. + * + * @param string $project + * @param string $location + * @param string $group + * + * @return string The formatted group resource. + */ + public static function groupName(string $project, string $location, string $group): string + { + return self::getPathTemplate('group')->render([ + 'project' => $project, + 'location' => $location, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a migrating_vm + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * + * @return string The formatted migrating_vm resource. + */ + public static function migratingVmName(string $project, string $location, string $source, string $migratingVm): string + { + return self::getPathTemplate('migratingVm')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * replication_cycle resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $replicationCycle + * + * @return string The formatted replication_cycle resource. + */ + public static function replicationCycleName(string $project, string $location, string $source, string $migratingVm, string $replicationCycle): string + { + return self::getPathTemplate('replicationCycle')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'replication_cycle' => $replicationCycle, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a source + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * + * @return string The formatted source resource. + */ + public static function sourceName(string $project, string $location, string $source): string + { + return self::getPathTemplate('source')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * target_project resource. + * + * @param string $project + * @param string $location + * @param string $targetProject + * + * @return string The formatted target_project resource. + */ + public static function targetProjectName(string $project, string $location, string $targetProject): string + { + return self::getPathTemplate('targetProject')->render([ + 'project' => $project, + 'location' => $location, + 'target_project' => $targetProject, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * utilization_report resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $utilizationReport + * + * @return string The formatted utilization_report resource. + */ + public static function utilizationReportName(string $project, string $location, string $source, string $utilizationReport): string + { + return self::getPathTemplate('utilizationReport')->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'utilization_report' => $utilizationReport, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cloneJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job} + * - cutoverJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job} + * - datacenterConnector: projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector} + * - group: projects/{project}/locations/{location}/groups/{group} + * - location: projects/{project}/locations/{location} + * - migratingVm: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm} + * - replicationCycle: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle} + * - source: projects/{project}/locations/{location}/sources/{source} + * - targetProject: projects/{project}/locations/{location}/targetProjects/{target_project} + * - utilizationReport: projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'vmmigration.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Adds a MigratingVm to a Group. + * + * The async variant is {@see VmMigrationClient::addGroupMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/add_group_migration.php + * + * @param AddGroupMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function addGroupMigration(AddGroupMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('AddGroupMigration', $request, $callOptions)->wait(); + } + + /** + * Initiates the cancellation of a running clone job. + * + * The async variant is {@see VmMigrationClient::cancelCloneJobAsync()} . + * + * @example samples/V1/VmMigrationClient/cancel_clone_job.php + * + * @param CancelCloneJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancelCloneJob(CancelCloneJobRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CancelCloneJob', $request, $callOptions)->wait(); + } + + /** + * Initiates the cancellation of a running cutover job. + * + * The async variant is {@see VmMigrationClient::cancelCutoverJobAsync()} . + * + * @example samples/V1/VmMigrationClient/cancel_cutover_job.php + * + * @param CancelCutoverJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancelCutoverJob(CancelCutoverJobRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CancelCutoverJob', $request, $callOptions)->wait(); + } + + /** + * Initiates a Clone of a specific migrating VM. + * + * The async variant is {@see VmMigrationClient::createCloneJobAsync()} . + * + * @example samples/V1/VmMigrationClient/create_clone_job.php + * + * @param CreateCloneJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createCloneJob(CreateCloneJobRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateCloneJob', $request, $callOptions)->wait(); + } + + /** + * Initiates a Cutover of a specific migrating VM. + * The returned LRO is completed when the cutover job resource is created + * and the job is initiated. + * + * The async variant is {@see VmMigrationClient::createCutoverJobAsync()} . + * + * @example samples/V1/VmMigrationClient/create_cutover_job.php + * + * @param CreateCutoverJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createCutoverJob(CreateCutoverJobRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateCutoverJob', $request, $callOptions)->wait(); + } + + /** + * Creates a new DatacenterConnector in a given Source. + * + * The async variant is {@see VmMigrationClient::createDatacenterConnectorAsync()} + * . + * + * @example samples/V1/VmMigrationClient/create_datacenter_connector.php + * + * @param CreateDatacenterConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDatacenterConnector(CreateDatacenterConnectorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDatacenterConnector', $request, $callOptions)->wait(); + } + + /** + * Creates a new Group in a given project and location. + * + * The async variant is {@see VmMigrationClient::createGroupAsync()} . + * + * @example samples/V1/VmMigrationClient/create_group.php + * + * @param CreateGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createGroup(CreateGroupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateGroup', $request, $callOptions)->wait(); + } + + /** + * Creates a new MigratingVm in a given Source. + * + * The async variant is {@see VmMigrationClient::createMigratingVmAsync()} . + * + * @example samples/V1/VmMigrationClient/create_migrating_vm.php + * + * @param CreateMigratingVmRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createMigratingVm(CreateMigratingVmRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateMigratingVm', $request, $callOptions)->wait(); + } + + /** + * Creates a new Source in a given project and location. + * + * The async variant is {@see VmMigrationClient::createSourceAsync()} . + * + * @example samples/V1/VmMigrationClient/create_source.php + * + * @param CreateSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSource(CreateSourceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateSource', $request, $callOptions)->wait(); + } + + /** + * Creates a new TargetProject in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * The async variant is {@see VmMigrationClient::createTargetProjectAsync()} . + * + * @example samples/V1/VmMigrationClient/create_target_project.php + * + * @param CreateTargetProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createTargetProject(CreateTargetProjectRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateTargetProject', $request, $callOptions)->wait(); + } + + /** + * Creates a new UtilizationReport. + * + * The async variant is {@see VmMigrationClient::createUtilizationReportAsync()} . + * + * @example samples/V1/VmMigrationClient/create_utilization_report.php + * + * @param CreateUtilizationReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createUtilizationReport(CreateUtilizationReportRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateUtilizationReport', $request, $callOptions)->wait(); + } + + /** + * Deletes a single DatacenterConnector. + * + * The async variant is {@see VmMigrationClient::deleteDatacenterConnectorAsync()} + * . + * + * @example samples/V1/VmMigrationClient/delete_datacenter_connector.php + * + * @param DeleteDatacenterConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDatacenterConnector(DeleteDatacenterConnectorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteDatacenterConnector', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Group. + * + * The async variant is {@see VmMigrationClient::deleteGroupAsync()} . + * + * @example samples/V1/VmMigrationClient/delete_group.php + * + * @param DeleteGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteGroup(DeleteGroupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteGroup', $request, $callOptions)->wait(); + } + + /** + * Deletes a single MigratingVm. + * + * The async variant is {@see VmMigrationClient::deleteMigratingVmAsync()} . + * + * @example samples/V1/VmMigrationClient/delete_migrating_vm.php + * + * @param DeleteMigratingVmRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteMigratingVm(DeleteMigratingVmRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteMigratingVm', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Source. + * + * The async variant is {@see VmMigrationClient::deleteSourceAsync()} . + * + * @example samples/V1/VmMigrationClient/delete_source.php + * + * @param DeleteSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSource(DeleteSourceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteSource', $request, $callOptions)->wait(); + } + + /** + * Deletes a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * The async variant is {@see VmMigrationClient::deleteTargetProjectAsync()} . + * + * @example samples/V1/VmMigrationClient/delete_target_project.php + * + * @param DeleteTargetProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteTargetProject(DeleteTargetProjectRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteTargetProject', $request, $callOptions)->wait(); + } + + /** + * Deletes a single Utilization Report. + * + * The async variant is {@see VmMigrationClient::deleteUtilizationReportAsync()} . + * + * @example samples/V1/VmMigrationClient/delete_utilization_report.php + * + * @param DeleteUtilizationReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteUtilizationReport(DeleteUtilizationReportRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteUtilizationReport', $request, $callOptions)->wait(); + } + + /** + * List remote source's inventory of VMs. + * The remote source is the onprem vCenter (remote in the sense it's not in + * Compute Engine). The inventory describes the list of existing VMs in that + * source. Note that this operation lists the VMs on the remote source, as + * opposed to listing the MigratingVms resources in the vmmigration service. + * + * The async variant is {@see VmMigrationClient::fetchInventoryAsync()} . + * + * @example samples/V1/VmMigrationClient/fetch_inventory.php + * + * @param FetchInventoryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 FetchInventoryResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchInventory(FetchInventoryRequest $request, array $callOptions = []): FetchInventoryResponse + { + return $this->startApiCall('FetchInventory', $request, $callOptions)->wait(); + } + + /** + * Marks a migration as completed, deleting migration resources that are no + * longer being used. Only applicable after cutover is done. + * + * The async variant is {@see VmMigrationClient::finalizeMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/finalize_migration.php + * + * @param FinalizeMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function finalizeMigration(FinalizeMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('FinalizeMigration', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single CloneJob. + * + * The async variant is {@see VmMigrationClient::getCloneJobAsync()} . + * + * @example samples/V1/VmMigrationClient/get_clone_job.php + * + * @param GetCloneJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 CloneJob + * + * @throws ApiException Thrown if the API call fails. + */ + public function getCloneJob(GetCloneJobRequest $request, array $callOptions = []): CloneJob + { + return $this->startApiCall('GetCloneJob', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single CutoverJob. + * + * The async variant is {@see VmMigrationClient::getCutoverJobAsync()} . + * + * @example samples/V1/VmMigrationClient/get_cutover_job.php + * + * @param GetCutoverJobRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 CutoverJob + * + * @throws ApiException Thrown if the API call fails. + */ + public function getCutoverJob(GetCutoverJobRequest $request, array $callOptions = []): CutoverJob + { + return $this->startApiCall('GetCutoverJob', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single DatacenterConnector. + * + * The async variant is {@see VmMigrationClient::getDatacenterConnectorAsync()} . + * + * @example samples/V1/VmMigrationClient/get_datacenter_connector.php + * + * @param GetDatacenterConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 DatacenterConnector + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDatacenterConnector(GetDatacenterConnectorRequest $request, array $callOptions = []): DatacenterConnector + { + return $this->startApiCall('GetDatacenterConnector', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Group. + * + * The async variant is {@see VmMigrationClient::getGroupAsync()} . + * + * @example samples/V1/VmMigrationClient/get_group.php + * + * @param GetGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Group + * + * @throws ApiException Thrown if the API call fails. + */ + public function getGroup(GetGroupRequest $request, array $callOptions = []): Group + { + return $this->startApiCall('GetGroup', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single MigratingVm. + * + * The async variant is {@see VmMigrationClient::getMigratingVmAsync()} . + * + * @example samples/V1/VmMigrationClient/get_migrating_vm.php + * + * @param GetMigratingVmRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 MigratingVm + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMigratingVm(GetMigratingVmRequest $request, array $callOptions = []): MigratingVm + { + return $this->startApiCall('GetMigratingVm', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single ReplicationCycle. + * + * The async variant is {@see VmMigrationClient::getReplicationCycleAsync()} . + * + * @example samples/V1/VmMigrationClient/get_replication_cycle.php + * + * @param GetReplicationCycleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ReplicationCycle + * + * @throws ApiException Thrown if the API call fails. + */ + public function getReplicationCycle(GetReplicationCycleRequest $request, array $callOptions = []): ReplicationCycle + { + return $this->startApiCall('GetReplicationCycle', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Source. + * + * The async variant is {@see VmMigrationClient::getSourceAsync()} . + * + * @example samples/V1/VmMigrationClient/get_source.php + * + * @param GetSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Source + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSource(GetSourceRequest $request, array $callOptions = []): Source + { + return $this->startApiCall('GetSource', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * The async variant is {@see VmMigrationClient::getTargetProjectAsync()} . + * + * @example samples/V1/VmMigrationClient/get_target_project.php + * + * @param GetTargetProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 TargetProject + * + * @throws ApiException Thrown if the API call fails. + */ + public function getTargetProject(GetTargetProjectRequest $request, array $callOptions = []): TargetProject + { + return $this->startApiCall('GetTargetProject', $request, $callOptions)->wait(); + } + + /** + * Gets a single Utilization Report. + * + * The async variant is {@see VmMigrationClient::getUtilizationReportAsync()} . + * + * @example samples/V1/VmMigrationClient/get_utilization_report.php + * + * @param GetUtilizationReportRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 UtilizationReport + * + * @throws ApiException Thrown if the API call fails. + */ + public function getUtilizationReport(GetUtilizationReportRequest $request, array $callOptions = []): UtilizationReport + { + return $this->startApiCall('GetUtilizationReport', $request, $callOptions)->wait(); + } + + /** + * Lists CloneJobs of a given migrating VM. + * + * The async variant is {@see VmMigrationClient::listCloneJobsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_clone_jobs.php + * + * @param ListCloneJobsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listCloneJobs(ListCloneJobsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCloneJobs', $request, $callOptions); + } + + /** + * Lists CutoverJobs of a given migrating VM. + * + * The async variant is {@see VmMigrationClient::listCutoverJobsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_cutover_jobs.php + * + * @param ListCutoverJobsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listCutoverJobs(ListCutoverJobsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCutoverJobs', $request, $callOptions); + } + + /** + * Lists DatacenterConnectors in a given Source. + * + * The async variant is {@see VmMigrationClient::listDatacenterConnectorsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_datacenter_connectors.php + * + * @param ListDatacenterConnectorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatacenterConnectors(ListDatacenterConnectorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDatacenterConnectors', $request, $callOptions); + } + + /** + * Lists Groups in a given project and location. + * + * The async variant is {@see VmMigrationClient::listGroupsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_groups.php + * + * @param ListGroupsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listGroups(ListGroupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListGroups', $request, $callOptions); + } + + /** + * Lists MigratingVms in a given Source. + * + * The async variant is {@see VmMigrationClient::listMigratingVmsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_migrating_vms.php + * + * @param ListMigratingVmsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listMigratingVms(ListMigratingVmsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMigratingVms', $request, $callOptions); + } + + /** + * Lists ReplicationCycles in a given MigratingVM. + * + * The async variant is {@see VmMigrationClient::listReplicationCyclesAsync()} . + * + * @example samples/V1/VmMigrationClient/list_replication_cycles.php + * + * @param ListReplicationCyclesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listReplicationCycles(ListReplicationCyclesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListReplicationCycles', $request, $callOptions); + } + + /** + * Lists Sources in a given project and location. + * + * The async variant is {@see VmMigrationClient::listSourcesAsync()} . + * + * @example samples/V1/VmMigrationClient/list_sources.php + * + * @param ListSourcesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSources(ListSourcesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSources', $request, $callOptions); + } + + /** + * Lists TargetProjects in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * The async variant is {@see VmMigrationClient::listTargetProjectsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_target_projects.php + * + * @param ListTargetProjectsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTargetProjects(ListTargetProjectsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTargetProjects', $request, $callOptions); + } + + /** + * Lists Utilization Reports of the given Source. + * + * The async variant is {@see VmMigrationClient::listUtilizationReportsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_utilization_reports.php + * + * @param ListUtilizationReportsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listUtilizationReports(ListUtilizationReportsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListUtilizationReports', $request, $callOptions); + } + + /** + * Pauses a migration for a VM. If cycle tasks are running they will be + * cancelled, preserving source task data. Further replication cycles will not + * be triggered while the VM is paused. + * + * The async variant is {@see VmMigrationClient::pauseMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/pause_migration.php + * + * @param PauseMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function pauseMigration(PauseMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('PauseMigration', $request, $callOptions)->wait(); + } + + /** + * Removes a MigratingVm from a Group. + * + * The async variant is {@see VmMigrationClient::removeGroupMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/remove_group_migration.php + * + * @param RemoveGroupMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function removeGroupMigration(RemoveGroupMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RemoveGroupMigration', $request, $callOptions)->wait(); + } + + /** + * Resumes a migration for a VM. When called on a paused migration, will start + * the process of uploading data and creating snapshots; when called on a + * completed cut-over migration, will update the migration to active state and + * start the process of uploading data and creating snapshots. + * + * The async variant is {@see VmMigrationClient::resumeMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/resume_migration.php + * + * @param ResumeMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function resumeMigration(ResumeMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ResumeMigration', $request, $callOptions)->wait(); + } + + /** + * Starts migration for a VM. Starts the process of uploading + * data and creating snapshots, in replication cycles scheduled by the policy. + * + * The async variant is {@see VmMigrationClient::startMigrationAsync()} . + * + * @example samples/V1/VmMigrationClient/start_migration.php + * + * @param StartMigrationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function startMigration(StartMigrationRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('StartMigration', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single Group. + * + * The async variant is {@see VmMigrationClient::updateGroupAsync()} . + * + * @example samples/V1/VmMigrationClient/update_group.php + * + * @param UpdateGroupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateGroup(UpdateGroupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateGroup', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single MigratingVm. + * + * The async variant is {@see VmMigrationClient::updateMigratingVmAsync()} . + * + * @example samples/V1/VmMigrationClient/update_migrating_vm.php + * + * @param UpdateMigratingVmRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateMigratingVm(UpdateMigratingVmRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateMigratingVm', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single Source. + * + * The async variant is {@see VmMigrationClient::updateSourceAsync()} . + * + * @example samples/V1/VmMigrationClient/update_source.php + * + * @param UpdateSourceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSource(UpdateSourceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateSource', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * The async variant is {@see VmMigrationClient::updateTargetProjectAsync()} . + * + * @example samples/V1/VmMigrationClient/update_target_project.php + * + * @param UpdateTargetProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateTargetProject(UpdateTargetProjectRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateTargetProject', $request, $callOptions)->wait(); + } + + /** + * Upgrades the appliance relate to this DatacenterConnector to the in-place + * updateable version. + * + * The async variant is {@see VmMigrationClient::upgradeApplianceAsync()} . + * + * @example samples/V1/VmMigrationClient/upgrade_appliance.php + * + * @param UpgradeApplianceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function upgradeAppliance(UpgradeApplianceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpgradeAppliance', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see VmMigrationClient::getLocationAsync()} . + * + * @example samples/V1/VmMigrationClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see VmMigrationClient::listLocationsAsync()} . + * + * @example samples/V1/VmMigrationClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/VmMigration/v1/src/V1/Gapic/VmMigrationGapicClient.php b/owl-bot-staging/VmMigration/v1/src/V1/Gapic/VmMigrationGapicClient.php new file mode 100644 index 00000000000..0c859acf2a7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/src/V1/Gapic/VmMigrationGapicClient.php @@ -0,0 +1,4101 @@ +groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + * $operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup); + * $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 = $vmMigrationClient->addGroupMigration($formattedGroup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\VMMigration\V1\Client\VmMigrationClient}. + */ +class VmMigrationGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.vmmigration.v1.VmMigration'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'vmmigration.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'vmmigration.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 static $cloneJobNameTemplate; + + private static $cutoverJobNameTemplate; + + private static $datacenterConnectorNameTemplate; + + private static $groupNameTemplate; + + private static $locationNameTemplate; + + private static $migratingVmNameTemplate; + + private static $replicationCycleNameTemplate; + + private static $sourceNameTemplate; + + private static $targetProjectNameTemplate; + + private static $utilizationReportNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vm_migration_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vm_migration_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vm_migration_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vm_migration_rest_client_config.php', + ], + ], + ]; + } + + private static function getCloneJobNameTemplate() + { + if (self::$cloneJobNameTemplate == null) { + self::$cloneJobNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}'); + } + + return self::$cloneJobNameTemplate; + } + + private static function getCutoverJobNameTemplate() + { + if (self::$cutoverJobNameTemplate == null) { + self::$cutoverJobNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}'); + } + + return self::$cutoverJobNameTemplate; + } + + private static function getDatacenterConnectorNameTemplate() + { + if (self::$datacenterConnectorNameTemplate == null) { + self::$datacenterConnectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}'); + } + + return self::$datacenterConnectorNameTemplate; + } + + private static function getGroupNameTemplate() + { + if (self::$groupNameTemplate == null) { + self::$groupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/groups/{group}'); + } + + return self::$groupNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getMigratingVmNameTemplate() + { + if (self::$migratingVmNameTemplate == null) { + self::$migratingVmNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}'); + } + + return self::$migratingVmNameTemplate; + } + + private static function getReplicationCycleNameTemplate() + { + if (self::$replicationCycleNameTemplate == null) { + self::$replicationCycleNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}'); + } + + return self::$replicationCycleNameTemplate; + } + + private static function getSourceNameTemplate() + { + if (self::$sourceNameTemplate == null) { + self::$sourceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}'); + } + + return self::$sourceNameTemplate; + } + + private static function getTargetProjectNameTemplate() + { + if (self::$targetProjectNameTemplate == null) { + self::$targetProjectNameTemplate = new PathTemplate('projects/{project}/locations/{location}/targetProjects/{target_project}'); + } + + return self::$targetProjectNameTemplate; + } + + private static function getUtilizationReportNameTemplate() + { + if (self::$utilizationReportNameTemplate == null) { + self::$utilizationReportNameTemplate = new PathTemplate('projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}'); + } + + return self::$utilizationReportNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'cloneJob' => self::getCloneJobNameTemplate(), + 'cutoverJob' => self::getCutoverJobNameTemplate(), + 'datacenterConnector' => self::getDatacenterConnectorNameTemplate(), + 'group' => self::getGroupNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'migratingVm' => self::getMigratingVmNameTemplate(), + 'replicationCycle' => self::getReplicationCycleNameTemplate(), + 'source' => self::getSourceNameTemplate(), + 'targetProject' => self::getTargetProjectNameTemplate(), + 'utilizationReport' => self::getUtilizationReportNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a clone_job + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $cloneJob + * + * @return string The formatted clone_job resource. + */ + public static function cloneJobName($project, $location, $source, $migratingVm, $cloneJob) + { + return self::getCloneJobNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'clone_job' => $cloneJob, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cutover_job + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $cutoverJob + * + * @return string The formatted cutover_job resource. + */ + public static function cutoverJobName($project, $location, $source, $migratingVm, $cutoverJob) + { + return self::getCutoverJobNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'cutover_job' => $cutoverJob, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * datacenter_connector resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $datacenterConnector + * + * @return string The formatted datacenter_connector resource. + */ + public static function datacenterConnectorName($project, $location, $source, $datacenterConnector) + { + return self::getDatacenterConnectorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'datacenter_connector' => $datacenterConnector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a group + * resource. + * + * @param string $project + * @param string $location + * @param string $group + * + * @return string The formatted group resource. + */ + public static function groupName($project, $location, $group) + { + return self::getGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'group' => $group, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a migrating_vm + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * + * @return string The formatted migrating_vm resource. + */ + public static function migratingVmName($project, $location, $source, $migratingVm) + { + return self::getMigratingVmNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * replication_cycle resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $migratingVm + * @param string $replicationCycle + * + * @return string The formatted replication_cycle resource. + */ + public static function replicationCycleName($project, $location, $source, $migratingVm, $replicationCycle) + { + return self::getReplicationCycleNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'migrating_vm' => $migratingVm, + 'replication_cycle' => $replicationCycle, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a source + * resource. + * + * @param string $project + * @param string $location + * @param string $source + * + * @return string The formatted source resource. + */ + public static function sourceName($project, $location, $source) + { + return self::getSourceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * target_project resource. + * + * @param string $project + * @param string $location + * @param string $targetProject + * + * @return string The formatted target_project resource. + */ + public static function targetProjectName($project, $location, $targetProject) + { + return self::getTargetProjectNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'target_project' => $targetProject, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * utilization_report resource. + * + * @param string $project + * @param string $location + * @param string $source + * @param string $utilizationReport + * + * @return string The formatted utilization_report resource. + */ + public static function utilizationReportName($project, $location, $source, $utilizationReport) + { + return self::getUtilizationReportNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'source' => $source, + 'utilization_report' => $utilizationReport, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cloneJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job} + * - cutoverJob: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job} + * - datacenterConnector: projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector} + * - group: projects/{project}/locations/{location}/groups/{group} + * - location: projects/{project}/locations/{location} + * - migratingVm: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm} + * - replicationCycle: projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle} + * - source: projects/{project}/locations/{location}/sources/{source} + * - targetProject: projects/{project}/locations/{location}/targetProjects/{target_project} + * - utilizationReport: projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'vmmigration.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); + } + + /** + * Adds a MigratingVm to a Group. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + * $operationResponse = $vmMigrationClient->addGroupMigration($formattedGroup); + * $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 = $vmMigrationClient->addGroupMigration($formattedGroup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'addGroupMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $group Required. The full path name of the Group to add to. + * @param array $optionalArgs { + * Optional. + * + * @type string $migratingVm + * The full path name of the MigratingVm to add. + * @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 addGroupMigration($group, array $optionalArgs = []) + { + $request = new AddGroupMigrationRequest(); + $requestParamHeaders = []; + $request->setGroup($group); + $requestParamHeaders['group'] = $group; + if (isset($optionalArgs['migratingVm'])) { + $request->setMigratingVm($optionalArgs['migratingVm']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('AddGroupMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Initiates the cancellation of a running clone job. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + * $operationResponse = $vmMigrationClient->cancelCloneJob($formattedName); + * $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 = $vmMigrationClient->cancelCloneJob($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'cancelCloneJob'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The clone job id + * @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 cancelCloneJob($name, array $optionalArgs = []) + { + $request = new CancelCloneJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CancelCloneJob', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Initiates the cancellation of a running cutover job. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + * $operationResponse = $vmMigrationClient->cancelCutoverJob($formattedName); + * $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 = $vmMigrationClient->cancelCutoverJob($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'cancelCutoverJob'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The cutover job id + * @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 cancelCutoverJob($name, array $optionalArgs = []) + { + $request = new CancelCutoverJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CancelCutoverJob', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Initiates a Clone of a specific migrating VM. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $cloneJobId = 'clone_job_id'; + * $cloneJob = new CloneJob(); + * $operationResponse = $vmMigrationClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); + * $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 = $vmMigrationClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createCloneJob'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Clone's parent. + * @param string $cloneJobId Required. The clone job identifier. + * @param CloneJob $cloneJob Required. The clone request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createCloneJob($parent, $cloneJobId, $cloneJob, array $optionalArgs = []) + { + $request = new CreateCloneJobRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setCloneJobId($cloneJobId); + $request->setCloneJob($cloneJob); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateCloneJob', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Initiates a Cutover of a specific migrating VM. + * The returned LRO is completed when the cutover job resource is created + * and the job is initiated. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $cutoverJobId = 'cutover_job_id'; + * $cutoverJob = new CutoverJob(); + * $operationResponse = $vmMigrationClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); + * $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 = $vmMigrationClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createCutoverJob'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Cutover's parent. + * @param string $cutoverJobId Required. The cutover job identifier. + * @param CutoverJob $cutoverJob Required. The cutover request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createCutoverJob($parent, $cutoverJobId, $cutoverJob, array $optionalArgs = []) + { + $request = new CreateCutoverJobRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setCutoverJobId($cutoverJobId); + $request->setCutoverJob($cutoverJob); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateCutoverJob', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new DatacenterConnector in a given Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $datacenterConnectorId = 'datacenter_connector_id'; + * $datacenterConnector = new DatacenterConnector(); + * $operationResponse = $vmMigrationClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); + * $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 = $vmMigrationClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createDatacenterConnector'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * @param string $datacenterConnectorId Required. The datacenterConnector identifier. + * @param DatacenterConnector $datacenterConnector Required. The create request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createDatacenterConnector($parent, $datacenterConnectorId, $datacenterConnector, array $optionalArgs = []) + { + $request = new CreateDatacenterConnectorRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setDatacenterConnectorId($datacenterConnectorId); + $request->setDatacenterConnector($datacenterConnector); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateDatacenterConnector', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Group in a given project and location. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $groupId = 'group_id'; + * $group = new Group(); + * $operationResponse = $vmMigrationClient->createGroup($formattedParent, $groupId, $group); + * $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 = $vmMigrationClient->createGroup($formattedParent, $groupId, $group); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Group's parent. + * @param string $groupId Required. The group identifier. + * @param Group $group Required. The create request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createGroup($parent, $groupId, $group, array $optionalArgs = []) + { + $request = new CreateGroupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setGroupId($groupId); + $request->setGroup($group); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateGroup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new MigratingVm in a given Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $migratingVmId = 'migrating_vm_id'; + * $migratingVm = new MigratingVm(); + * $operationResponse = $vmMigrationClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); + * $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 = $vmMigrationClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createMigratingVm'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The MigratingVm's parent. + * @param string $migratingVmId Required. The migratingVm identifier. + * @param MigratingVm $migratingVm Required. The create request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createMigratingVm($parent, $migratingVmId, $migratingVm, array $optionalArgs = []) + { + $request = new CreateMigratingVmRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setMigratingVmId($migratingVmId); + $request->setMigratingVm($migratingVm); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateMigratingVm', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new Source in a given project and location. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $sourceId = 'source_id'; + * $source = new Source(); + * $operationResponse = $vmMigrationClient->createSource($formattedParent, $sourceId, $source); + * $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 = $vmMigrationClient->createSource($formattedParent, $sourceId, $source); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createSource'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Source's parent. + * @param string $sourceId Required. The source identifier. + * @param Source $source Required. The create request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createSource($parent, $sourceId, $source, array $optionalArgs = []) + { + $request = new CreateSourceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSourceId($sourceId); + $request->setSource($source); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateSource', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new TargetProject in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $targetProjectId = 'target_project_id'; + * $targetProject = new TargetProject(); + * $operationResponse = $vmMigrationClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); + * $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 = $vmMigrationClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createTargetProject'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The TargetProject's parent. + * @param string $targetProjectId Required. The target_project identifier. + * @param TargetProject $targetProject Required. The create request body. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createTargetProject($parent, $targetProjectId, $targetProject, array $optionalArgs = []) + { + $request = new CreateTargetProjectRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTargetProjectId($targetProjectId); + $request->setTargetProject($targetProject); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateTargetProject', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new UtilizationReport. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $utilizationReport = new UtilizationReport(); + * $utilizationReportId = 'utilization_report_id'; + * $operationResponse = $vmMigrationClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); + * $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 = $vmMigrationClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'createUtilizationReport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Utilization Report's parent. + * @param UtilizationReport $utilizationReport Required. The report to create. + * @param string $utilizationReportId Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * + * This value maximum length is 63 characters, and valid characters + * are /[a-z][0-9]-/. It must start with an english letter and must not + * end with a hyphen. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createUtilizationReport($parent, $utilizationReport, $utilizationReportId, array $optionalArgs = []) + { + $request = new CreateUtilizationReportRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setUtilizationReport($utilizationReport); + $request->setUtilizationReportId($utilizationReportId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateUtilizationReport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single DatacenterConnector. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + * $operationResponse = $vmMigrationClient->deleteDatacenterConnector($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteDatacenterConnector($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteDatacenterConnector'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The DatacenterConnector name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteDatacenterConnector($name, array $optionalArgs = []) + { + $request = new DeleteDatacenterConnectorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteDatacenterConnector', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Group. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + * $operationResponse = $vmMigrationClient->deleteGroup($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteGroup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The Group name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteGroup($name, array $optionalArgs = []) + { + $request = new DeleteGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteGroup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single MigratingVm. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $operationResponse = $vmMigrationClient->deleteMigratingVm($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteMigratingVm($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteMigratingVm'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the MigratingVm. + * @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 deleteMigratingVm($name, array $optionalArgs = []) + { + $request = new DeleteMigratingVmRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteMigratingVm', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $operationResponse = $vmMigrationClient->deleteSource($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteSource($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteSource'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The Source name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteSource($name, array $optionalArgs = []) + { + $request = new DeleteSourceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteSource', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + * $operationResponse = $vmMigrationClient->deleteTargetProject($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteTargetProject($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteTargetProject'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The TargetProject name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteTargetProject($name, array $optionalArgs = []) + { + $request = new DeleteTargetProjectRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteTargetProject', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single Utilization Report. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + * $operationResponse = $vmMigrationClient->deleteUtilizationReport($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmMigrationClient->deleteUtilizationReport($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'deleteUtilizationReport'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The Utilization Report name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteUtilizationReport($name, array $optionalArgs = []) + { + $request = new DeleteUtilizationReportRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteUtilizationReport', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * List remote source's inventory of VMs. + * The remote source is the onprem vCenter (remote in the sense it's not in + * Compute Engine). The inventory describes the list of existing VMs in that + * source. Note that this operation lists the VMs on the remote source, as + * opposed to listing the MigratingVms resources in the vmmigration service. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedSource = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $response = $vmMigrationClient->fetchInventory($formattedSource); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $source Required. The name of the Source. + * @param array $optionalArgs { + * Optional. + * + * @type bool $forceRefresh + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * @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\VMMigration\V1\FetchInventoryResponse + * + * @throws ApiException if the remote call fails + */ + public function fetchInventory($source, array $optionalArgs = []) + { + $request = new FetchInventoryRequest(); + $requestParamHeaders = []; + $request->setSource($source); + $requestParamHeaders['source'] = $source; + if (isset($optionalArgs['forceRefresh'])) { + $request->setForceRefresh($optionalArgs['forceRefresh']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchInventory', FetchInventoryResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Marks a migration as completed, deleting migration resources that are no + * longer being used. Only applicable after cutover is done. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $operationResponse = $vmMigrationClient->finalizeMigration($formattedMigratingVm); + * $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 = $vmMigrationClient->finalizeMigration($formattedMigratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'finalizeMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $migratingVm Required. The name of the MigratingVm. + * @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 finalizeMigration($migratingVm, array $optionalArgs = []) + { + $request = new FinalizeMigrationRequest(); + $requestParamHeaders = []; + $request->setMigratingVm($migratingVm); + $requestParamHeaders['migrating_vm'] = $migratingVm; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('FinalizeMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single CloneJob. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + * $response = $vmMigrationClient->getCloneJob($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the CloneJob. + * @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\Cloud\VMMigration\V1\CloneJob + * + * @throws ApiException if the remote call fails + */ + public function getCloneJob($name, array $optionalArgs = []) + { + $request = new GetCloneJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetCloneJob', CloneJob::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single CutoverJob. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + * $response = $vmMigrationClient->getCutoverJob($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the CutoverJob. + * @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\Cloud\VMMigration\V1\CutoverJob + * + * @throws ApiException if the remote call fails + */ + public function getCutoverJob($name, array $optionalArgs = []) + { + $request = new GetCutoverJobRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetCutoverJob', CutoverJob::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single DatacenterConnector. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + * $response = $vmMigrationClient->getDatacenterConnector($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the DatacenterConnector. + * @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\Cloud\VMMigration\V1\DatacenterConnector + * + * @throws ApiException if the remote call fails + */ + public function getDatacenterConnector($name, array $optionalArgs = []) + { + $request = new GetDatacenterConnectorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDatacenterConnector', DatacenterConnector::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Group. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + * $response = $vmMigrationClient->getGroup($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The group name. + * @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\Cloud\VMMigration\V1\Group + * + * @throws ApiException if the remote call fails + */ + public function getGroup($name, array $optionalArgs = []) + { + $request = new GetGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGroup', Group::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single MigratingVm. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $response = $vmMigrationClient->getMigratingVm($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the MigratingVm. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * Optional. The level of details of the migrating VM. + * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\MigratingVmView} + * @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\VMMigration\V1\MigratingVm + * + * @throws ApiException if the remote call fails + */ + public function getMigratingVm($name, array $optionalArgs = []) + { + $request = new GetMigratingVmRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetMigratingVm', MigratingVm::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single ReplicationCycle. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); + * $response = $vmMigrationClient->getReplicationCycle($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the ReplicationCycle. + * @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\Cloud\VMMigration\V1\ReplicationCycle + * + * @throws ApiException if the remote call fails + */ + public function getReplicationCycle($name, array $optionalArgs = []) + { + $request = new GetReplicationCycleRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetReplicationCycle', ReplicationCycle::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $response = $vmMigrationClient->getSource($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The Source name. + * @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\Cloud\VMMigration\V1\Source + * + * @throws ApiException if the remote call fails + */ + public function getSource($name, array $optionalArgs = []) + { + $request = new GetSourceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSource', Source::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + * $response = $vmMigrationClient->getTargetProject($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The TargetProject name. + * @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\Cloud\VMMigration\V1\TargetProject + * + * @throws ApiException if the remote call fails + */ + public function getTargetProject($name, array $optionalArgs = []) + { + $request = new GetTargetProjectRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTargetProject', TargetProject::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a single Utilization Report. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedName = $vmMigrationClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + * $response = $vmMigrationClient->getUtilizationReport($formattedName); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $name Required. The Utilization Report name. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * Optional. The level of details of the report. + * Defaults to FULL + * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\UtilizationReportView} + * @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\VMMigration\V1\UtilizationReport + * + * @throws ApiException if the remote call fails + */ + public function getUtilizationReport($name, array $optionalArgs = []) + { + $request = new GetUtilizationReportRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetUtilizationReport', UtilizationReport::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists CloneJobs of a given migrating VM. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listCloneJobs($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listCloneJobs($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of source VMs. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listCloneJobs($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListCloneJobsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCloneJobs', $optionalArgs, ListCloneJobsResponse::class, $request); + } + + /** + * Lists CutoverJobs of a given migrating VM. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listCutoverJobs($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listCutoverJobs($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of migrating VMs. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listCutoverJobs($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListCutoverJobsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCutoverJobs', $optionalArgs, ListCutoverJobsResponse::class, $request); + } + + /** + * Lists DatacenterConnectors in a given Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listDatacenterConnectors($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listDatacenterConnectors($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of connectors. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDatacenterConnectors($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListDatacenterConnectorsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDatacenterConnectors', $optionalArgs, ListDatacenterConnectorsResponse::class, $request); + } + + /** + * Lists Groups in a given project and location. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listGroups($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listGroups($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of groups. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listGroups($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListGroupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListGroups', $optionalArgs, ListGroupsResponse::class, $request); + } + + /** + * Lists MigratingVms in a given Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listMigratingVms($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listMigratingVms($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of MigratingVms. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @type int $view + * Optional. The level of details of each migrating VM. + * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\MigratingVmView} + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listMigratingVms($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListMigratingVmsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListMigratingVms', $optionalArgs, ListMigratingVmsResponse::class, $request); + } + + /** + * Lists ReplicationCycles in a given MigratingVM. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listReplicationCycles($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listReplicationCycles($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of ReplicationCycles. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listReplicationCycles($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListReplicationCyclesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListReplicationCycles', $optionalArgs, ListReplicationCyclesResponse::class, $request); + } + + /** + * Lists Sources in a given project and location. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listSources($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listSources($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of sources. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSources($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListSourcesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSources', $optionalArgs, ListSourcesResponse::class, $request); + } + + /** + * Lists TargetProjects in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->locationName('[PROJECT]', '[LOCATION]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listTargetProjects($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listTargetProjects($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent, which owns this collection of targets. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTargetProjects($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListTargetProjectsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTargetProjects', $optionalArgs, ListTargetProjectsResponse::class, $request); + } + + /** + * Lists Utilization Reports of the given Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedParent = $vmMigrationClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + * $pageToken = 'page_token'; + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listUtilizationReports($formattedParent, $pageToken); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listUtilizationReports($formattedParent, $pageToken); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $parent Required. The Utilization Reports parent. + * @param string $pageToken A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * Optional. The level of details of each report. + * Defaults to BASIC. + * For allowed values, use constants defined on {@see \Google\Cloud\VMMigration\V1\UtilizationReportView} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $filter + * Optional. The filter request. + * @type string $orderBy + * Optional. the order by fields for the result. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listUtilizationReports($parent, $pageToken, array $optionalArgs = []) + { + $request = new ListUtilizationReportsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPageToken($pageToken); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListUtilizationReports', $optionalArgs, ListUtilizationReportsResponse::class, $request); + } + + /** + * Pauses a migration for a VM. If cycle tasks are running they will be + * cancelled, preserving source task data. Further replication cycles will not + * be triggered while the VM is paused. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $operationResponse = $vmMigrationClient->pauseMigration($formattedMigratingVm); + * $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 = $vmMigrationClient->pauseMigration($formattedMigratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'pauseMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $migratingVm Required. The name of the MigratingVm. + * @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 pauseMigration($migratingVm, array $optionalArgs = []) + { + $request = new PauseMigrationRequest(); + $requestParamHeaders = []; + $request->setMigratingVm($migratingVm); + $requestParamHeaders['migrating_vm'] = $migratingVm; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('PauseMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Removes a MigratingVm from a Group. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedGroup = $vmMigrationClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + * $operationResponse = $vmMigrationClient->removeGroupMigration($formattedGroup); + * $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 = $vmMigrationClient->removeGroupMigration($formattedGroup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'removeGroupMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $group Required. The name of the Group. + * @param array $optionalArgs { + * Optional. + * + * @type string $migratingVm + * The MigratingVm to remove. + * @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 removeGroupMigration($group, array $optionalArgs = []) + { + $request = new RemoveGroupMigrationRequest(); + $requestParamHeaders = []; + $request->setGroup($group); + $requestParamHeaders['group'] = $group; + if (isset($optionalArgs['migratingVm'])) { + $request->setMigratingVm($optionalArgs['migratingVm']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RemoveGroupMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Resumes a migration for a VM. When called on a paused migration, will start + * the process of uploading data and creating snapshots; when called on a + * completed cut-over migration, will update the migration to active state and + * start the process of uploading data and creating snapshots. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $operationResponse = $vmMigrationClient->resumeMigration($formattedMigratingVm); + * $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 = $vmMigrationClient->resumeMigration($formattedMigratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'resumeMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $migratingVm Required. The name of the MigratingVm. + * @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 resumeMigration($migratingVm, array $optionalArgs = []) + { + $request = new ResumeMigrationRequest(); + $requestParamHeaders = []; + $request->setMigratingVm($migratingVm); + $requestParamHeaders['migrating_vm'] = $migratingVm; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ResumeMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Starts migration for a VM. Starts the process of uploading + * data and creating snapshots, in replication cycles scheduled by the policy. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedMigratingVm = $vmMigrationClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + * $operationResponse = $vmMigrationClient->startMigration($formattedMigratingVm); + * $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 = $vmMigrationClient->startMigration($formattedMigratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'startMigration'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $migratingVm Required. The name of the MigratingVm. + * @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 startMigration($migratingVm, array $optionalArgs = []) + { + $request = new StartMigrationRequest(); + $requestParamHeaders = []; + $request->setMigratingVm($migratingVm); + $requestParamHeaders['migrating_vm'] = $migratingVm; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('StartMigration', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single Group. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $group = new Group(); + * $operationResponse = $vmMigrationClient->updateGroup($group); + * $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 = $vmMigrationClient->updateGroup($group); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateGroup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param Group $group Required. The update request body. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateGroup($group, array $optionalArgs = []) + { + $request = new UpdateGroupRequest(); + $requestParamHeaders = []; + $request->setGroup($group); + $requestParamHeaders['group.name'] = $group->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateGroup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single MigratingVm. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $migratingVm = new MigratingVm(); + * $operationResponse = $vmMigrationClient->updateMigratingVm($migratingVm); + * $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 = $vmMigrationClient->updateMigratingVm($migratingVm); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateMigratingVm'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param MigratingVm $migratingVm Required. The update request body. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateMigratingVm($migratingVm, array $optionalArgs = []) + { + $request = new UpdateMigratingVmRequest(); + $requestParamHeaders = []; + $request->setMigratingVm($migratingVm); + $requestParamHeaders['migrating_vm.name'] = $migratingVm->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateMigratingVm', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single Source. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $source = new Source(); + * $operationResponse = $vmMigrationClient->updateSource($source); + * $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 = $vmMigrationClient->updateSource($source); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateSource'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param Source $source Required. The update request body. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateSource($source, array $optionalArgs = []) + { + $request = new UpdateSourceRequest(); + $requestParamHeaders = []; + $request->setSource($source); + $requestParamHeaders['source.name'] = $source->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateSource', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $targetProject = new TargetProject(); + * $operationResponse = $vmMigrationClient->updateTargetProject($targetProject); + * $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 = $vmMigrationClient->updateTargetProject($targetProject); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'updateTargetProject'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param TargetProject $targetProject Required. The update request body. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateTargetProject($targetProject, array $optionalArgs = []) + { + $request = new UpdateTargetProjectRequest(); + $requestParamHeaders = []; + $request->setTargetProject($targetProject); + $requestParamHeaders['target_project.name'] = $targetProject->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateTargetProject', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Upgrades the appliance relate to this DatacenterConnector to the in-place + * updateable version. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $formattedDatacenterConnector = $vmMigrationClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + * $operationResponse = $vmMigrationClient->upgradeAppliance($formattedDatacenterConnector); + * $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 = $vmMigrationClient->upgradeAppliance($formattedDatacenterConnector); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmMigrationClient->resumeOperation($operationName, 'upgradeAppliance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param string $datacenterConnector Required. The DatacenterConnector name. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 upgradeAppliance($datacenterConnector, array $optionalArgs = []) + { + $request = new UpgradeApplianceRequest(); + $requestParamHeaders = []; + $request->setDatacenterConnector($datacenterConnector); + $requestParamHeaders['datacenter_connector'] = $datacenterConnector; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpgradeAppliance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * $response = $vmMigrationClient->getLocation(); + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $vmMigrationClient = new VmMigrationClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $vmMigrationClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmMigrationClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmMigrationClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/VmMigration/v1/src/V1/VmMigrationClient.php b/owl-bot-staging/VmMigration/v1/src/V1/VmMigrationClient.php new file mode 100644 index 00000000000..1f8f06e19b7 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/src/V1/VmMigrationClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.vmmigration.v1.VmMigration' => [ + 'AddGroupMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\AddGroupMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'group', + 'fieldAccessors' => [ + 'getGroup', + ], + ], + ], + ], + 'CancelCloneJob' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\CancelCloneJobResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CancelCutoverJob' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\CancelCutoverJobResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateCloneJob' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\CloneJob', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateCutoverJob' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\CutoverJob', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDatacenterConnector' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\DatacenterConnector', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateGroup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\Group', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateMigratingVm' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\MigratingVm', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSource' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\Source', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateTargetProject' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\TargetProject', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateUtilizationReport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\UtilizationReport', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteDatacenterConnector' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGroup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMigratingVm' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSource' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTargetProject' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteUtilizationReport' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'FinalizeMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\FinalizeMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'migrating_vm', + 'fieldAccessors' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'PauseMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\PauseMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'migrating_vm', + 'fieldAccessors' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'RemoveGroupMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\RemoveGroupMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'group', + 'fieldAccessors' => [ + 'getGroup', + ], + ], + ], + ], + 'ResumeMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\ResumeMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'migrating_vm', + 'fieldAccessors' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'StartMigration' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\StartMigrationResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'migrating_vm', + 'fieldAccessors' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\Group', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'group.name', + 'fieldAccessors' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + 'UpdateMigratingVm' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\MigratingVm', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'migrating_vm.name', + 'fieldAccessors' => [ + 'getMigratingVm', + 'getName', + ], + ], + ], + ], + 'UpdateSource' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\Source', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'source.name', + 'fieldAccessors' => [ + 'getSource', + 'getName', + ], + ], + ], + ], + 'UpdateTargetProject' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\TargetProject', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'target_project.name', + 'fieldAccessors' => [ + 'getTargetProject', + 'getName', + ], + ], + ], + ], + 'UpgradeAppliance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VMMigration\V1\UpgradeApplianceResponse', + 'metadataReturnType' => '\Google\Cloud\VMMigration\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'datacenter_connector', + 'fieldAccessors' => [ + 'getDatacenterConnector', + ], + ], + ], + ], + 'FetchInventory' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\FetchInventoryResponse', + 'headerParams' => [ + [ + 'keyName' => 'source', + 'fieldAccessors' => [ + 'getSource', + ], + ], + ], + ], + 'GetCloneJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\CloneJob', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetCutoverJob' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\CutoverJob', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDatacenterConnector' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\DatacenterConnector', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetGroup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\Group', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMigratingVm' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\MigratingVm', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetReplicationCycle' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ReplicationCycle', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSource' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\Source', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetTargetProject' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\TargetProject', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetUtilizationReport' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\UtilizationReport', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListCloneJobs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCloneJobs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListCloneJobsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListCutoverJobs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCutoverJobs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListCutoverJobsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatacenterConnectors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDatacenterConnectors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListDatacenterConnectorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListGroups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getGroups', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListGroupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMigratingVms' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMigratingVms', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListMigratingVmsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListReplicationCycles' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReplicationCycles', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListReplicationCyclesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListSources' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSources', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListSourcesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListTargetProjects' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTargetProjects', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListTargetProjectsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListUtilizationReports' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getUtilizationReports', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VMMigration\V1\ListUtilizationReportsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'cloneJob' => 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}', + 'cutoverJob' => 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}', + 'datacenterConnector' => 'projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}', + 'group' => 'projects/{project}/locations/{location}/groups/{group}', + 'location' => 'projects/{project}/locations/{location}', + 'migratingVm' => 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}', + 'replicationCycle' => 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}', + 'source' => 'projects/{project}/locations/{location}/sources/{source}', + 'targetProject' => 'projects/{project}/locations/{location}/targetProjects/{target_project}', + 'utilizationReport' => 'projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VmMigration/v1/src/V1/resources/vm_migration_rest_client_config.php b/owl-bot-staging/VmMigration/v1/src/V1/resources/vm_migration_rest_client_config.php new file mode 100644 index 00000000000..04df0194c57 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/src/V1/resources/vm_migration_rest_client_config.php @@ -0,0 +1,662 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.vmmigration.v1.VmMigration' => [ + 'AddGroupMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{group=projects/*/locations/*/groups/*}:addGroupMigration', + 'body' => '*', + 'placeholders' => [ + 'group' => [ + 'getters' => [ + 'getGroup', + ], + ], + ], + ], + 'CancelCloneJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*/cloneJobs/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelCutoverJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*/cutoverJobs/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateCloneJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*/migratingVms/*}/cloneJobs', + 'body' => 'clone_job', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'clone_job_id', + ], + ], + 'CreateCutoverJob' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*/migratingVms/*}/cutoverJobs', + 'body' => 'cutover_job', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cutover_job_id', + ], + ], + 'CreateDatacenterConnector' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/datacenterConnectors', + 'body' => 'datacenter_connector', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'datacenter_connector_id', + ], + ], + 'CreateGroup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/groups', + 'body' => 'group', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'group_id', + ], + ], + 'CreateMigratingVm' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/migratingVms', + 'body' => 'migrating_vm', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'migrating_vm_id', + ], + ], + 'CreateSource' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/sources', + 'body' => 'source', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'source_id', + ], + ], + 'CreateTargetProject' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/targetProjects', + 'body' => 'target_project', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'target_project_id', + ], + ], + 'CreateUtilizationReport' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/utilizationReports', + 'body' => 'utilization_report', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'utilization_report_id', + ], + ], + 'DeleteDatacenterConnector' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/datacenterConnectors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteGroup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/groups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMigratingVm' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteSource' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteTargetProject' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/targetProjects/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteUtilizationReport' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/utilizationReports/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FetchInventory' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{source=projects/*/locations/*/sources/*}:fetchInventory', + 'placeholders' => [ + 'source' => [ + 'getters' => [ + 'getSource', + ], + ], + ], + ], + 'FinalizeMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{migrating_vm=projects/*/locations/*/sources/*/migratingVms/*}:finalizeMigration', + 'body' => '*', + 'placeholders' => [ + 'migrating_vm' => [ + 'getters' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'GetCloneJob' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*/cloneJobs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCutoverJob' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*/cutoverJobs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDatacenterConnector' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/datacenterConnectors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetGroup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/groups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMigratingVm' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetReplicationCycle' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/migratingVms/*/replicationCycles/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSource' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTargetProject' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/targetProjects/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetUtilizationReport' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/sources/*/utilizationReports/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListCloneJobs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*/migratingVms/*}/cloneJobs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListCutoverJobs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*/migratingVms/*}/cutoverJobs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListDatacenterConnectors' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/datacenterConnectors', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListGroups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/groups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListMigratingVms' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/migratingVms', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListReplicationCycles' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*/migratingVms/*}/replicationCycles', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListSources' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/sources', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListTargetProjects' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/targetProjects', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'ListUtilizationReports' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/sources/*}/utilizationReports', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'page_token', + ], + ], + 'PauseMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{migrating_vm=projects/*/locations/*/sources/*/migratingVms/*}:pauseMigration', + 'body' => '*', + 'placeholders' => [ + 'migrating_vm' => [ + 'getters' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'RemoveGroupMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{group=projects/*/locations/*/groups/*}:removeGroupMigration', + 'body' => '*', + 'placeholders' => [ + 'group' => [ + 'getters' => [ + 'getGroup', + ], + ], + ], + ], + 'ResumeMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{migrating_vm=projects/*/locations/*/sources/*/migratingVms/*}:resumeMigration', + 'body' => '*', + 'placeholders' => [ + 'migrating_vm' => [ + 'getters' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'StartMigration' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{migrating_vm=projects/*/locations/*/sources/*/migratingVms/*}:startMigration', + 'body' => '*', + 'placeholders' => [ + 'migrating_vm' => [ + 'getters' => [ + 'getMigratingVm', + ], + ], + ], + ], + 'UpdateGroup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{group.name=projects/*/locations/*/groups/*}', + 'body' => 'group', + 'placeholders' => [ + 'group.name' => [ + 'getters' => [ + 'getGroup', + 'getName', + ], + ], + ], + ], + 'UpdateMigratingVm' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{migrating_vm.name=projects/*/locations/*/sources/*/migratingVms/*}', + 'body' => 'migrating_vm', + 'placeholders' => [ + 'migrating_vm.name' => [ + 'getters' => [ + 'getMigratingVm', + 'getName', + ], + ], + ], + ], + 'UpdateSource' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{source.name=projects/*/locations/*/sources/*}', + 'body' => 'source', + 'placeholders' => [ + 'source.name' => [ + 'getters' => [ + 'getSource', + 'getName', + ], + ], + ], + ], + 'UpdateTargetProject' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{target_project.name=projects/*/locations/*/targetProjects/*}', + 'body' => 'target_project', + 'placeholders' => [ + 'target_project.name' => [ + 'getters' => [ + 'getTargetProject', + 'getName', + ], + ], + ], + ], + 'UpgradeAppliance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{datacenter_connector=projects/*/locations/*/sources/*/datacenterConnectors/*}:upgradeAppliance', + 'body' => '*', + 'placeholders' => [ + 'datacenter_connector' => [ + 'getters' => [ + 'getDatacenterConnector', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VmMigration/v1/tests/Unit/V1/Client/VmMigrationClientTest.php b/owl-bot-staging/VmMigration/v1/tests/Unit/V1/Client/VmMigrationClientTest.php new file mode 100644 index 00000000000..93a8dadd9b5 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/tests/Unit/V1/Client/VmMigrationClientTest.php @@ -0,0 +1,5156 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VmMigrationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VmMigrationClient($options); + } + + /** @test */ + public function addGroupMigrationTest() + { + $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/addGroupMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AddGroupMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/addGroupMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new AddGroupMigrationRequest()) + ->setGroup($formattedGroup); + $response = $gapicClient->addGroupMigration($request); + $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.vmmigration.v1.VmMigration/AddGroupMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($formattedGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); + $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 addGroupMigrationExceptionTest() + { + $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/addGroupMigrationTest'); + $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 + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new AddGroupMigrationRequest()) + ->setGroup($formattedGroup); + $response = $gapicClient->addGroupMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); + 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 cancelCloneJobTest() + { + $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/cancelCloneJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new CancelCloneJobResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/cancelCloneJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $request = (new CancelCloneJobRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelCloneJob($request); + $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.vmmigration.v1.VmMigration/CancelCloneJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); + $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 cancelCloneJobExceptionTest() + { + $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/cancelCloneJobTest'); + $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 + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $request = (new CancelCloneJobRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelCloneJob($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); + 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 cancelCutoverJobTest() + { + $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/cancelCutoverJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new CancelCutoverJobResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/cancelCutoverJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $request = (new CancelCutoverJobRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelCutoverJob($request); + $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.vmmigration.v1.VmMigration/CancelCutoverJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); + $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 cancelCutoverJobExceptionTest() + { + $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/cancelCutoverJobTest'); + $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 + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $request = (new CancelCutoverJobRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelCutoverJob($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); + 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 createCloneJobTest() + { + $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/createCloneJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new CloneJob(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCloneJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cloneJobId = 'cloneJobId-1008685569'; + $cloneJob = new CloneJob(); + $request = (new CreateCloneJobRequest()) + ->setParent($formattedParent) + ->setCloneJobId($cloneJobId) + ->setCloneJob($cloneJob); + $response = $gapicClient->createCloneJob($request); + $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.vmmigration.v1.VmMigration/CreateCloneJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCloneJobId(); + $this->assertProtobufEquals($cloneJobId, $actualValue); + $actualValue = $actualApiRequestObject->getCloneJob(); + $this->assertProtobufEquals($cloneJob, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); + $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 createCloneJobExceptionTest() + { + $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/createCloneJobTest'); + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cloneJobId = 'cloneJobId-1008685569'; + $cloneJob = new CloneJob(); + $request = (new CreateCloneJobRequest()) + ->setParent($formattedParent) + ->setCloneJobId($cloneJobId) + ->setCloneJob($cloneJob); + $response = $gapicClient->createCloneJob($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); + 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 createCutoverJobTest() + { + $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/createCutoverJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $progressPercent = 2137894861; + $stateMessage = 'stateMessage29641305'; + $expectedResponse = new CutoverJob(); + $expectedResponse->setName($name); + $expectedResponse->setProgressPercent($progressPercent); + $expectedResponse->setStateMessage($stateMessage); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCutoverJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cutoverJobId = 'cutoverJobId504048422'; + $cutoverJob = new CutoverJob(); + $request = (new CreateCutoverJobRequest()) + ->setParent($formattedParent) + ->setCutoverJobId($cutoverJobId) + ->setCutoverJob($cutoverJob); + $response = $gapicClient->createCutoverJob($request); + $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.vmmigration.v1.VmMigration/CreateCutoverJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCutoverJobId(); + $this->assertProtobufEquals($cutoverJobId, $actualValue); + $actualValue = $actualApiRequestObject->getCutoverJob(); + $this->assertProtobufEquals($cutoverJob, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); + $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 createCutoverJobExceptionTest() + { + $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/createCutoverJobTest'); + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cutoverJobId = 'cutoverJobId504048422'; + $cutoverJob = new CutoverJob(); + $request = (new CreateCutoverJobRequest()) + ->setParent($formattedParent) + ->setCutoverJobId($cutoverJobId) + ->setCutoverJob($cutoverJob); + $response = $gapicClient->createCutoverJob($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); + 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 createDatacenterConnectorTest() + { + $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/createDatacenterConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $registrationId = 'registrationId-412573087'; + $serviceAccount = 'serviceAccount-1948028253'; + $version = 'version351608024'; + $bucket = 'bucket-1378203158'; + $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; + $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; + $expectedResponse = new DatacenterConnector(); + $expectedResponse->setName($name); + $expectedResponse->setRegistrationId($registrationId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setVersion($version); + $expectedResponse->setBucket($bucket); + $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); + $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDatacenterConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $datacenterConnectorId = 'datacenterConnectorId1629428237'; + $datacenterConnector = new DatacenterConnector(); + $request = (new CreateDatacenterConnectorRequest()) + ->setParent($formattedParent) + ->setDatacenterConnectorId($datacenterConnectorId) + ->setDatacenterConnector($datacenterConnector); + $response = $gapicClient->createDatacenterConnector($request); + $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.vmmigration.v1.VmMigration/CreateDatacenterConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDatacenterConnectorId(); + $this->assertProtobufEquals($datacenterConnectorId, $actualValue); + $actualValue = $actualApiRequestObject->getDatacenterConnector(); + $this->assertProtobufEquals($datacenterConnector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); + $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 createDatacenterConnectorExceptionTest() + { + $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/createDatacenterConnectorTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $datacenterConnectorId = 'datacenterConnectorId1629428237'; + $datacenterConnector = new DatacenterConnector(); + $request = (new CreateDatacenterConnectorRequest()) + ->setParent($formattedParent) + ->setDatacenterConnectorId($datacenterConnectorId) + ->setDatacenterConnector($datacenterConnector); + $response = $gapicClient->createDatacenterConnector($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); + 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 createGroupTest() + { + $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/createGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $groupId = 'groupId506361563'; + $group = new Group(); + $request = (new CreateGroupRequest()) + ->setParent($formattedParent) + ->setGroupId($groupId) + ->setGroup($group); + $response = $gapicClient->createGroup($request); + $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.vmmigration.v1.VmMigration/CreateGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGroupId(); + $this->assertProtobufEquals($groupId, $actualValue); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGroupTest'); + $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 createGroupExceptionTest() + { + $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/createGroupTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $groupId = 'groupId506361563'; + $group = new Group(); + $request = (new CreateGroupRequest()) + ->setParent($formattedParent) + ->setGroupId($groupId) + ->setGroup($group); + $response = $gapicClient->createGroup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGroupTest'); + 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 createMigratingVmTest() + { + $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/createMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $migratingVmId = 'migratingVmId-899085236'; + $migratingVm = new MigratingVm(); + $request = (new CreateMigratingVmRequest()) + ->setParent($formattedParent) + ->setMigratingVmId($migratingVmId) + ->setMigratingVm($migratingVm); + $response = $gapicClient->createMigratingVm($request); + $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.vmmigration.v1.VmMigration/CreateMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMigratingVmId(); + $this->assertProtobufEquals($migratingVmId, $actualValue); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($migratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); + $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 createMigratingVmExceptionTest() + { + $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/createMigratingVmTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $migratingVmId = 'migratingVmId-899085236'; + $migratingVm = new MigratingVm(); + $request = (new CreateMigratingVmRequest()) + ->setParent($formattedParent) + ->setMigratingVmId($migratingVmId) + ->setMigratingVm($migratingVm); + $response = $gapicClient->createMigratingVm($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); + 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 createSourceTest() + { + $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/createSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceId = 'sourceId-1698410561'; + $source = new Source(); + $request = (new CreateSourceRequest()) + ->setParent($formattedParent) + ->setSourceId($sourceId) + ->setSource($source); + $response = $gapicClient->createSource($request); + $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.vmmigration.v1.VmMigration/CreateSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceId(); + $this->assertProtobufEquals($sourceId, $actualValue); + $actualValue = $actualApiRequestObject->getSource(); + $this->assertProtobufEquals($source, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSourceTest'); + $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 createSourceExceptionTest() + { + $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/createSourceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceId = 'sourceId-1698410561'; + $source = new Source(); + $request = (new CreateSourceRequest()) + ->setParent($formattedParent) + ->setSourceId($sourceId) + ->setSource($source); + $response = $gapicClient->createSource($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSourceTest'); + 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 createTargetProjectTest() + { + $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/createTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetProjectId = 'targetProjectId1255314287'; + $targetProject = new TargetProject(); + $request = (new CreateTargetProjectRequest()) + ->setParent($formattedParent) + ->setTargetProjectId($targetProjectId) + ->setTargetProject($targetProject); + $response = $gapicClient->createTargetProject($request); + $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.vmmigration.v1.VmMigration/CreateTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTargetProjectId(); + $this->assertProtobufEquals($targetProjectId, $actualValue); + $actualValue = $actualApiRequestObject->getTargetProject(); + $this->assertProtobufEquals($targetProject, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); + $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 createTargetProjectExceptionTest() + { + $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/createTargetProjectTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetProjectId = 'targetProjectId1255314287'; + $targetProject = new TargetProject(); + $request = (new CreateTargetProjectRequest()) + ->setParent($formattedParent) + ->setTargetProjectId($targetProjectId) + ->setTargetProject($targetProject); + $response = $gapicClient->createTargetProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); + 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 createUtilizationReportTest() + { + $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/createUtilizationReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $vmCount = 261463431; + $expectedResponse = new UtilizationReport(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVmCount($vmCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createUtilizationReportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $utilizationReport = new UtilizationReport(); + $utilizationReportId = 'utilizationReportId-1346894295'; + $request = (new CreateUtilizationReportRequest()) + ->setParent($formattedParent) + ->setUtilizationReport($utilizationReport) + ->setUtilizationReportId($utilizationReportId); + $response = $gapicClient->createUtilizationReport($request); + $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.vmmigration.v1.VmMigration/CreateUtilizationReport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getUtilizationReport(); + $this->assertProtobufEquals($utilizationReport, $actualValue); + $actualValue = $actualApiRequestObject->getUtilizationReportId(); + $this->assertProtobufEquals($utilizationReportId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); + $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 createUtilizationReportExceptionTest() + { + $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/createUtilizationReportTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $utilizationReport = new UtilizationReport(); + $utilizationReportId = 'utilizationReportId-1346894295'; + $request = (new CreateUtilizationReportRequest()) + ->setParent($formattedParent) + ->setUtilizationReport($utilizationReport) + ->setUtilizationReportId($utilizationReportId); + $response = $gapicClient->createUtilizationReport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); + 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 deleteDatacenterConnectorTest() + { + $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/deleteDatacenterConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteDatacenterConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new DeleteDatacenterConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteDatacenterConnector($request); + $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.vmmigration.v1.VmMigration/DeleteDatacenterConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); + $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 deleteDatacenterConnectorExceptionTest() + { + $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/deleteDatacenterConnectorTest'); + $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 + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new DeleteDatacenterConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteDatacenterConnector($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); + 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 deleteGroupTest() + { + $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/deleteGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new DeleteGroupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteGroup($request); + $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.vmmigration.v1.VmMigration/DeleteGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); + $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 deleteGroupExceptionTest() + { + $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/deleteGroupTest'); + $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 + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new DeleteGroupRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteGroup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); + 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 deleteMigratingVmTest() + { + $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/deleteMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new DeleteMigratingVmRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteMigratingVm($request); + $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.vmmigration.v1.VmMigration/DeleteMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); + $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 deleteMigratingVmExceptionTest() + { + $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/deleteMigratingVmTest'); + $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 + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new DeleteMigratingVmRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteMigratingVm($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); + 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 deleteSourceTest() + { + $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/deleteSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new DeleteSourceRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteSource($request); + $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.vmmigration.v1.VmMigration/DeleteSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); + $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 deleteSourceExceptionTest() + { + $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/deleteSourceTest'); + $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 + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new DeleteSourceRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteSource($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); + 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 deleteTargetProjectTest() + { + $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/deleteTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $request = (new DeleteTargetProjectRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteTargetProject($request); + $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.vmmigration.v1.VmMigration/DeleteTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); + $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 deleteTargetProjectExceptionTest() + { + $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/deleteTargetProjectTest'); + $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 + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $request = (new DeleteTargetProjectRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteTargetProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); + 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 deleteUtilizationReportTest() + { + $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/deleteUtilizationReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteUtilizationReportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $request = (new DeleteUtilizationReportRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteUtilizationReport($request); + $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.vmmigration.v1.VmMigration/DeleteUtilizationReport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); + $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 deleteUtilizationReportExceptionTest() + { + $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/deleteUtilizationReportTest'); + $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 + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $request = (new DeleteUtilizationReportRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteUtilizationReport($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); + 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 fetchInventoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchInventoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new FetchInventoryRequest()) + ->setSource($formattedSource); + $response = $gapicClient->fetchInventory($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/FetchInventory', $actualFuncCall); + $actualValue = $actualRequestObject->getSource(); + $this->assertProtobufEquals($formattedSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchInventoryExceptionTest() + { + $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 + $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new FetchInventoryRequest()) + ->setSource($formattedSource); + try { + $gapicClient->fetchInventory($request); + // 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()); + } + + /** @test */ + public function finalizeMigrationTest() + { + $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/finalizeMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new FinalizeMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/finalizeMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new FinalizeMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->finalizeMigration($request); + $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.vmmigration.v1.VmMigration/FinalizeMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); + $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 finalizeMigrationExceptionTest() + { + $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/finalizeMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new FinalizeMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->finalizeMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); + 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 getCloneJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new CloneJob(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $request = (new GetCloneJobRequest()) + ->setName($formattedName); + $response = $gapicClient->getCloneJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCloneJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCloneJobExceptionTest() + { + $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 + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $request = (new GetCloneJobRequest()) + ->setName($formattedName); + try { + $gapicClient->getCloneJob($request); + // 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()); + } + + /** @test */ + public function getCutoverJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $progressPercent = 2137894861; + $stateMessage = 'stateMessage29641305'; + $expectedResponse = new CutoverJob(); + $expectedResponse->setName($name2); + $expectedResponse->setProgressPercent($progressPercent); + $expectedResponse->setStateMessage($stateMessage); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $request = (new GetCutoverJobRequest()) + ->setName($formattedName); + $response = $gapicClient->getCutoverJob($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCutoverJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCutoverJobExceptionTest() + { + $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 + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $request = (new GetCutoverJobRequest()) + ->setName($formattedName); + try { + $gapicClient->getCutoverJob($request); + // 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()); + } + + /** @test */ + public function getDatacenterConnectorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $registrationId = 'registrationId-412573087'; + $serviceAccount = 'serviceAccount-1948028253'; + $version = 'version351608024'; + $bucket = 'bucket-1378203158'; + $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; + $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; + $expectedResponse = new DatacenterConnector(); + $expectedResponse->setName($name2); + $expectedResponse->setRegistrationId($registrationId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setVersion($version); + $expectedResponse->setBucket($bucket); + $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); + $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new GetDatacenterConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->getDatacenterConnector($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetDatacenterConnector', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatacenterConnectorExceptionTest() + { + $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 + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new GetDatacenterConnectorRequest()) + ->setName($formattedName); + try { + $gapicClient->getDatacenterConnector($request); + // 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()); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setName($formattedName); + $response = $gapicClient->getGroup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $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 + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new GetGroupRequest()) + ->setName($formattedName); + try { + $gapicClient->getGroup($request); + // 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()); + } + + /** @test */ + public function getMigratingVmTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name2); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new GetMigratingVmRequest()) + ->setName($formattedName); + $response = $gapicClient->getMigratingVm($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetMigratingVm', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMigratingVmExceptionTest() + { + $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 + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new GetMigratingVmRequest()) + ->setName($formattedName); + try { + $gapicClient->getMigratingVm($request); + // 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()); + } + + /** @test */ + public function getReplicationCycleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $cycleNumber = 1095724862; + $progressPercent = 2137894861; + $expectedResponse = new ReplicationCycle(); + $expectedResponse->setName($name2); + $expectedResponse->setCycleNumber($cycleNumber); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); + $request = (new GetReplicationCycleRequest()) + ->setName($formattedName); + $response = $gapicClient->getReplicationCycle($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetReplicationCycle', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReplicationCycleExceptionTest() + { + $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 + $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); + $request = (new GetReplicationCycleRequest()) + ->setName($formattedName); + try { + $gapicClient->getReplicationCycle($request); + // 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()); + } + + /** @test */ + public function getSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new GetSourceRequest()) + ->setName($formattedName); + $response = $gapicClient->getSource($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetSource', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSourceExceptionTest() + { + $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 + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $request = (new GetSourceRequest()) + ->setName($formattedName); + try { + $gapicClient->getSource($request); + // 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()); + } + + /** @test */ + public function getTargetProjectTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name2); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $request = (new GetTargetProjectRequest()) + ->setName($formattedName); + $response = $gapicClient->getTargetProject($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetTargetProject', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTargetProjectExceptionTest() + { + $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 + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $request = (new GetTargetProjectRequest()) + ->setName($formattedName); + try { + $gapicClient->getTargetProject($request); + // 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()); + } + + /** @test */ + public function getUtilizationReportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $vmCount = 261463431; + $expectedResponse = new UtilizationReport(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVmCount($vmCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $request = (new GetUtilizationReportRequest()) + ->setName($formattedName); + $response = $gapicClient->getUtilizationReport($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetUtilizationReport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUtilizationReportExceptionTest() + { + $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 + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $request = (new GetUtilizationReportRequest()) + ->setName($formattedName); + try { + $gapicClient->getUtilizationReport($request); + // 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()); + } + + /** @test */ + public function listCloneJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cloneJobsElement = new CloneJob(); + $cloneJobs = [ + $cloneJobsElement, + ]; + $expectedResponse = new ListCloneJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCloneJobs($cloneJobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListCloneJobsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listCloneJobs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCloneJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCloneJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCloneJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListCloneJobsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listCloneJobs($request); + // 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()); + } + + /** @test */ + public function listCutoverJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cutoverJobsElement = new CutoverJob(); + $cutoverJobs = [ + $cutoverJobsElement, + ]; + $expectedResponse = new ListCutoverJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCutoverJobs($cutoverJobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListCutoverJobsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listCutoverJobs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCutoverJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCutoverJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCutoverJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListCutoverJobsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listCutoverJobs($request); + // 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()); + } + + /** @test */ + public function listDatacenterConnectorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $datacenterConnectorsElement = new DatacenterConnector(); + $datacenterConnectors = [ + $datacenterConnectorsElement, + ]; + $expectedResponse = new ListDatacenterConnectorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatacenterConnectors($datacenterConnectors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListDatacenterConnectorsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listDatacenterConnectors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatacenterConnectors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListDatacenterConnectors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatacenterConnectorsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListDatacenterConnectorsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listDatacenterConnectors($request); + // 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()); + } + + /** @test */ + public function listGroupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $groupsElement = new Group(); + $groups = [ + $groupsElement, + ]; + $expectedResponse = new ListGroupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGroups($groups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListGroupsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listGroups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListGroups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListGroupsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listGroups($request); + // 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()); + } + + /** @test */ + public function listMigratingVmsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $migratingVmsElement = new MigratingVm(); + $migratingVms = [ + $migratingVmsElement, + ]; + $expectedResponse = new ListMigratingVmsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMigratingVms($migratingVms); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListMigratingVmsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listMigratingVms($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMigratingVms()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListMigratingVms', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMigratingVmsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListMigratingVmsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listMigratingVms($request); + // 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()); + } + + /** @test */ + public function listReplicationCyclesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $replicationCyclesElement = new ReplicationCycle(); + $replicationCycles = [ + $replicationCyclesElement, + ]; + $expectedResponse = new ListReplicationCyclesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReplicationCycles($replicationCycles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListReplicationCyclesRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listReplicationCycles($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReplicationCycles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListReplicationCycles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReplicationCyclesExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListReplicationCyclesRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listReplicationCycles($request); + // 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()); + } + + /** @test */ + public function listSourcesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $sourcesElement = new Source(); + $sources = [ + $sourcesElement, + ]; + $expectedResponse = new ListSourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSources($sources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListSourcesRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listSources($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListSources', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSourcesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListSourcesRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listSources($request); + // 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()); + } + + /** @test */ + public function listTargetProjectsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $targetProjectsElement = new TargetProject(); + $targetProjects = [ + $targetProjectsElement, + ]; + $expectedResponse = new ListTargetProjectsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTargetProjects($targetProjects); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListTargetProjectsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listTargetProjects($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTargetProjects()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListTargetProjects', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTargetProjectsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListTargetProjectsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listTargetProjects($request); + // 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()); + } + + /** @test */ + public function listUtilizationReportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $utilizationReportsElement = new UtilizationReport(); + $utilizationReports = [ + $utilizationReportsElement, + ]; + $expectedResponse = new ListUtilizationReportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUtilizationReports($utilizationReports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListUtilizationReportsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + $response = $gapicClient->listUtilizationReports($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUtilizationReports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListUtilizationReports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUtilizationReportsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $request = (new ListUtilizationReportsRequest()) + ->setParent($formattedParent) + ->setPageToken($pageToken); + try { + $gapicClient->listUtilizationReports($request); + // 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()); + } + + /** @test */ + public function pauseMigrationTest() + { + $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/pauseMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new PauseMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/pauseMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new PauseMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->pauseMigration($request); + $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.vmmigration.v1.VmMigration/PauseMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); + $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 pauseMigrationExceptionTest() + { + $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/pauseMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new PauseMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->pauseMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); + 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 removeGroupMigrationTest() + { + $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/removeGroupMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RemoveGroupMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/removeGroupMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new RemoveGroupMigrationRequest()) + ->setGroup($formattedGroup); + $response = $gapicClient->removeGroupMigration($request); + $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.vmmigration.v1.VmMigration/RemoveGroupMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($formattedGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); + $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 removeGroupMigrationExceptionTest() + { + $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/removeGroupMigrationTest'); + $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 + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new RemoveGroupMigrationRequest()) + ->setGroup($formattedGroup); + $response = $gapicClient->removeGroupMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); + 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 resumeMigrationTest() + { + $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/resumeMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ResumeMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resumeMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new ResumeMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->resumeMigration($request); + $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.vmmigration.v1.VmMigration/ResumeMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); + $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 resumeMigrationExceptionTest() + { + $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/resumeMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new ResumeMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->resumeMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); + 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 startMigrationTest() + { + $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/startMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new StartMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new StartMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->startMigration($request); + $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.vmmigration.v1.VmMigration/StartMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startMigrationTest'); + $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 startMigrationExceptionTest() + { + $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/startMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $request = (new StartMigrationRequest()) + ->setMigratingVm($formattedMigratingVm); + $response = $gapicClient->startMigration($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startMigrationTest'); + 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 updateGroupTest() + { + $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/updateGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $group = new Group(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + $response = $gapicClient->updateGroup($request); + $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.vmmigration.v1.VmMigration/UpdateGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGroupTest'); + $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 updateGroupExceptionTest() + { + $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/updateGroupTest'); + $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 + $group = new Group(); + $request = (new UpdateGroupRequest()) + ->setGroup($group); + $response = $gapicClient->updateGroup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGroupTest'); + 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 updateMigratingVmTest() + { + $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/updateMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $migratingVm = new MigratingVm(); + $request = (new UpdateMigratingVmRequest()) + ->setMigratingVm($migratingVm); + $response = $gapicClient->updateMigratingVm($request); + $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.vmmigration.v1.VmMigration/UpdateMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($migratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); + $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 updateMigratingVmExceptionTest() + { + $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/updateMigratingVmTest'); + $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 + $migratingVm = new MigratingVm(); + $request = (new UpdateMigratingVmRequest()) + ->setMigratingVm($migratingVm); + $response = $gapicClient->updateMigratingVm($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); + 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 updateSourceTest() + { + $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/updateSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $source = new Source(); + $request = (new UpdateSourceRequest()) + ->setSource($source); + $response = $gapicClient->updateSource($request); + $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.vmmigration.v1.VmMigration/UpdateSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getSource(); + $this->assertProtobufEquals($source, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSourceTest'); + $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 updateSourceExceptionTest() + { + $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/updateSourceTest'); + $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 + $source = new Source(); + $request = (new UpdateSourceRequest()) + ->setSource($source); + $response = $gapicClient->updateSource($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSourceTest'); + 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 updateTargetProjectTest() + { + $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/updateTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $targetProject = new TargetProject(); + $request = (new UpdateTargetProjectRequest()) + ->setTargetProject($targetProject); + $response = $gapicClient->updateTargetProject($request); + $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.vmmigration.v1.VmMigration/UpdateTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getTargetProject(); + $this->assertProtobufEquals($targetProject, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); + $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 updateTargetProjectExceptionTest() + { + $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/updateTargetProjectTest'); + $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 + $targetProject = new TargetProject(); + $request = (new UpdateTargetProjectRequest()) + ->setTargetProject($targetProject); + $response = $gapicClient->updateTargetProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); + 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 upgradeApplianceTest() + { + $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/upgradeApplianceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new UpgradeApplianceResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/upgradeApplianceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new UpgradeApplianceRequest()) + ->setDatacenterConnector($formattedDatacenterConnector); + $response = $gapicClient->upgradeAppliance($request); + $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.vmmigration.v1.VmMigration/UpgradeAppliance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatacenterConnector(); + $this->assertProtobufEquals($formattedDatacenterConnector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); + $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 upgradeApplianceExceptionTest() + { + $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/upgradeApplianceTest'); + $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 + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $request = (new UpgradeApplianceRequest()) + ->setDatacenterConnector($formattedDatacenterConnector); + $response = $gapicClient->upgradeAppliance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function addGroupMigrationAsyncTest() + { + $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/addGroupMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AddGroupMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/addGroupMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $request = (new AddGroupMigrationRequest()) + ->setGroup($formattedGroup); + $response = $gapicClient->addGroupMigrationAsync($request)->wait(); + $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.vmmigration.v1.VmMigration/AddGroupMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($formattedGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); + $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()); + } +} diff --git a/owl-bot-staging/VmMigration/v1/tests/Unit/V1/VmMigrationClientTest.php b/owl-bot-staging/VmMigration/v1/tests/Unit/V1/VmMigrationClientTest.php new file mode 100644 index 00000000000..6dc403b9752 --- /dev/null +++ b/owl-bot-staging/VmMigration/v1/tests/Unit/V1/VmMigrationClientTest.php @@ -0,0 +1,4806 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VmMigrationClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VmMigrationClient($options); + } + + /** @test */ + public function addGroupMigrationTest() + { + $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/addGroupMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new AddGroupMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/addGroupMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->addGroupMigration($formattedGroup); + $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.vmmigration.v1.VmMigration/AddGroupMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($formattedGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); + $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 addGroupMigrationExceptionTest() + { + $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/addGroupMigrationTest'); + $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 + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->addGroupMigration($formattedGroup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/addGroupMigrationTest'); + 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 cancelCloneJobTest() + { + $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/cancelCloneJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new CancelCloneJobResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/cancelCloneJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $response = $gapicClient->cancelCloneJob($formattedName); + $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.vmmigration.v1.VmMigration/CancelCloneJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); + $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 cancelCloneJobExceptionTest() + { + $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/cancelCloneJobTest'); + $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 + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $response = $gapicClient->cancelCloneJob($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCloneJobTest'); + 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 cancelCutoverJobTest() + { + $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/cancelCutoverJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new CancelCutoverJobResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/cancelCutoverJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $response = $gapicClient->cancelCutoverJob($formattedName); + $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.vmmigration.v1.VmMigration/CancelCutoverJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); + $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 cancelCutoverJobExceptionTest() + { + $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/cancelCutoverJobTest'); + $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 + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $response = $gapicClient->cancelCutoverJob($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/cancelCutoverJobTest'); + 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 createCloneJobTest() + { + $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/createCloneJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new CloneJob(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCloneJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cloneJobId = 'cloneJobId-1008685569'; + $cloneJob = new CloneJob(); + $response = $gapicClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); + $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.vmmigration.v1.VmMigration/CreateCloneJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCloneJobId(); + $this->assertProtobufEquals($cloneJobId, $actualValue); + $actualValue = $actualApiRequestObject->getCloneJob(); + $this->assertProtobufEquals($cloneJob, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); + $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 createCloneJobExceptionTest() + { + $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/createCloneJobTest'); + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cloneJobId = 'cloneJobId-1008685569'; + $cloneJob = new CloneJob(); + $response = $gapicClient->createCloneJob($formattedParent, $cloneJobId, $cloneJob); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCloneJobTest'); + 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 createCutoverJobTest() + { + $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/createCutoverJobTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $progressPercent = 2137894861; + $stateMessage = 'stateMessage29641305'; + $expectedResponse = new CutoverJob(); + $expectedResponse->setName($name); + $expectedResponse->setProgressPercent($progressPercent); + $expectedResponse->setStateMessage($stateMessage); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCutoverJobTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cutoverJobId = 'cutoverJobId504048422'; + $cutoverJob = new CutoverJob(); + $response = $gapicClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); + $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.vmmigration.v1.VmMigration/CreateCutoverJob', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCutoverJobId(); + $this->assertProtobufEquals($cutoverJobId, $actualValue); + $actualValue = $actualApiRequestObject->getCutoverJob(); + $this->assertProtobufEquals($cutoverJob, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); + $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 createCutoverJobExceptionTest() + { + $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/createCutoverJobTest'); + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $cutoverJobId = 'cutoverJobId504048422'; + $cutoverJob = new CutoverJob(); + $response = $gapicClient->createCutoverJob($formattedParent, $cutoverJobId, $cutoverJob); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCutoverJobTest'); + 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 createDatacenterConnectorTest() + { + $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/createDatacenterConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $registrationId = 'registrationId-412573087'; + $serviceAccount = 'serviceAccount-1948028253'; + $version = 'version351608024'; + $bucket = 'bucket-1378203158'; + $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; + $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; + $expectedResponse = new DatacenterConnector(); + $expectedResponse->setName($name); + $expectedResponse->setRegistrationId($registrationId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setVersion($version); + $expectedResponse->setBucket($bucket); + $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); + $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDatacenterConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $datacenterConnectorId = 'datacenterConnectorId1629428237'; + $datacenterConnector = new DatacenterConnector(); + $response = $gapicClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); + $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.vmmigration.v1.VmMigration/CreateDatacenterConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDatacenterConnectorId(); + $this->assertProtobufEquals($datacenterConnectorId, $actualValue); + $actualValue = $actualApiRequestObject->getDatacenterConnector(); + $this->assertProtobufEquals($datacenterConnector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); + $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 createDatacenterConnectorExceptionTest() + { + $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/createDatacenterConnectorTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $datacenterConnectorId = 'datacenterConnectorId1629428237'; + $datacenterConnector = new DatacenterConnector(); + $response = $gapicClient->createDatacenterConnector($formattedParent, $datacenterConnectorId, $datacenterConnector); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatacenterConnectorTest'); + 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 createGroupTest() + { + $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/createGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $groupId = 'groupId506361563'; + $group = new Group(); + $response = $gapicClient->createGroup($formattedParent, $groupId, $group); + $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.vmmigration.v1.VmMigration/CreateGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getGroupId(); + $this->assertProtobufEquals($groupId, $actualValue); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGroupTest'); + $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 createGroupExceptionTest() + { + $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/createGroupTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $groupId = 'groupId506361563'; + $group = new Group(); + $response = $gapicClient->createGroup($formattedParent, $groupId, $group); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createGroupTest'); + 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 createMigratingVmTest() + { + $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/createMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $migratingVmId = 'migratingVmId-899085236'; + $migratingVm = new MigratingVm(); + $response = $gapicClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); + $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.vmmigration.v1.VmMigration/CreateMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMigratingVmId(); + $this->assertProtobufEquals($migratingVmId, $actualValue); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($migratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); + $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 createMigratingVmExceptionTest() + { + $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/createMigratingVmTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $migratingVmId = 'migratingVmId-899085236'; + $migratingVm = new MigratingVm(); + $response = $gapicClient->createMigratingVm($formattedParent, $migratingVmId, $migratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createMigratingVmTest'); + 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 createSourceTest() + { + $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/createSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceId = 'sourceId-1698410561'; + $source = new Source(); + $response = $gapicClient->createSource($formattedParent, $sourceId, $source); + $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.vmmigration.v1.VmMigration/CreateSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSourceId(); + $this->assertProtobufEquals($sourceId, $actualValue); + $actualValue = $actualApiRequestObject->getSource(); + $this->assertProtobufEquals($source, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSourceTest'); + $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 createSourceExceptionTest() + { + $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/createSourceTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $sourceId = 'sourceId-1698410561'; + $source = new Source(); + $response = $gapicClient->createSource($formattedParent, $sourceId, $source); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSourceTest'); + 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 createTargetProjectTest() + { + $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/createTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetProjectId = 'targetProjectId1255314287'; + $targetProject = new TargetProject(); + $response = $gapicClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); + $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.vmmigration.v1.VmMigration/CreateTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getTargetProjectId(); + $this->assertProtobufEquals($targetProjectId, $actualValue); + $actualValue = $actualApiRequestObject->getTargetProject(); + $this->assertProtobufEquals($targetProject, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); + $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 createTargetProjectExceptionTest() + { + $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/createTargetProjectTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $targetProjectId = 'targetProjectId1255314287'; + $targetProject = new TargetProject(); + $response = $gapicClient->createTargetProject($formattedParent, $targetProjectId, $targetProject); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createTargetProjectTest'); + 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 createUtilizationReportTest() + { + $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/createUtilizationReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $vmCount = 261463431; + $expectedResponse = new UtilizationReport(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVmCount($vmCount); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createUtilizationReportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $utilizationReport = new UtilizationReport(); + $utilizationReportId = 'utilizationReportId-1346894295'; + $response = $gapicClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); + $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.vmmigration.v1.VmMigration/CreateUtilizationReport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getUtilizationReport(); + $this->assertProtobufEquals($utilizationReport, $actualValue); + $actualValue = $actualApiRequestObject->getUtilizationReportId(); + $this->assertProtobufEquals($utilizationReportId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); + $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 createUtilizationReportExceptionTest() + { + $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/createUtilizationReportTest'); + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $utilizationReport = new UtilizationReport(); + $utilizationReportId = 'utilizationReportId-1346894295'; + $response = $gapicClient->createUtilizationReport($formattedParent, $utilizationReport, $utilizationReportId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createUtilizationReportTest'); + 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 deleteDatacenterConnectorTest() + { + $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/deleteDatacenterConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteDatacenterConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $response = $gapicClient->deleteDatacenterConnector($formattedName); + $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.vmmigration.v1.VmMigration/DeleteDatacenterConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); + $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 deleteDatacenterConnectorExceptionTest() + { + $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/deleteDatacenterConnectorTest'); + $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 + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $response = $gapicClient->deleteDatacenterConnector($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteDatacenterConnectorTest'); + 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 deleteGroupTest() + { + $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/deleteGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->deleteGroup($formattedName); + $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.vmmigration.v1.VmMigration/DeleteGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); + $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 deleteGroupExceptionTest() + { + $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/deleteGroupTest'); + $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 + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->deleteGroup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteGroupTest'); + 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 deleteMigratingVmTest() + { + $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/deleteMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->deleteMigratingVm($formattedName); + $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.vmmigration.v1.VmMigration/DeleteMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); + $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 deleteMigratingVmExceptionTest() + { + $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/deleteMigratingVmTest'); + $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 + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->deleteMigratingVm($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMigratingVmTest'); + 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 deleteSourceTest() + { + $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/deleteSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $response = $gapicClient->deleteSource($formattedName); + $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.vmmigration.v1.VmMigration/DeleteSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); + $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 deleteSourceExceptionTest() + { + $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/deleteSourceTest'); + $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 + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $response = $gapicClient->deleteSource($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSourceTest'); + 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 deleteTargetProjectTest() + { + $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/deleteTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $response = $gapicClient->deleteTargetProject($formattedName); + $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.vmmigration.v1.VmMigration/DeleteTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); + $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 deleteTargetProjectExceptionTest() + { + $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/deleteTargetProjectTest'); + $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 + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $response = $gapicClient->deleteTargetProject($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteTargetProjectTest'); + 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 deleteUtilizationReportTest() + { + $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/deleteUtilizationReportTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteUtilizationReportTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $response = $gapicClient->deleteUtilizationReport($formattedName); + $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.vmmigration.v1.VmMigration/DeleteUtilizationReport', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); + $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 deleteUtilizationReportExceptionTest() + { + $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/deleteUtilizationReportTest'); + $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 + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $response = $gapicClient->deleteUtilizationReport($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteUtilizationReportTest'); + 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 fetchInventoryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchInventoryResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $response = $gapicClient->fetchInventory($formattedSource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/FetchInventory', $actualFuncCall); + $actualValue = $actualRequestObject->getSource(); + $this->assertProtobufEquals($formattedSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchInventoryExceptionTest() + { + $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 + $formattedSource = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + try { + $gapicClient->fetchInventory($formattedSource); + // 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()); + } + + /** @test */ + public function finalizeMigrationTest() + { + $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/finalizeMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new FinalizeMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/finalizeMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->finalizeMigration($formattedMigratingVm); + $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.vmmigration.v1.VmMigration/FinalizeMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); + $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 finalizeMigrationExceptionTest() + { + $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/finalizeMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->finalizeMigration($formattedMigratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/finalizeMigrationTest'); + 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 getCloneJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new CloneJob(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + $response = $gapicClient->getCloneJob($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCloneJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCloneJobExceptionTest() + { + $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 + $formattedName = $gapicClient->cloneJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CLONE_JOB]'); + try { + $gapicClient->getCloneJob($formattedName); + // 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()); + } + + /** @test */ + public function getCutoverJobTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $progressPercent = 2137894861; + $stateMessage = 'stateMessage29641305'; + $expectedResponse = new CutoverJob(); + $expectedResponse->setName($name2); + $expectedResponse->setProgressPercent($progressPercent); + $expectedResponse->setStateMessage($stateMessage); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + $response = $gapicClient->getCutoverJob($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetCutoverJob', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCutoverJobExceptionTest() + { + $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 + $formattedName = $gapicClient->cutoverJobName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[CUTOVER_JOB]'); + try { + $gapicClient->getCutoverJob($formattedName); + // 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()); + } + + /** @test */ + public function getDatacenterConnectorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $registrationId = 'registrationId-412573087'; + $serviceAccount = 'serviceAccount-1948028253'; + $version = 'version351608024'; + $bucket = 'bucket-1378203158'; + $applianceInfrastructureVersion = 'applianceInfrastructureVersion662625550'; + $applianceSoftwareVersion = 'applianceSoftwareVersion-641402222'; + $expectedResponse = new DatacenterConnector(); + $expectedResponse->setName($name2); + $expectedResponse->setRegistrationId($registrationId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setVersion($version); + $expectedResponse->setBucket($bucket); + $expectedResponse->setApplianceInfrastructureVersion($applianceInfrastructureVersion); + $expectedResponse->setApplianceSoftwareVersion($applianceSoftwareVersion); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $response = $gapicClient->getDatacenterConnector($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetDatacenterConnector', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatacenterConnectorExceptionTest() + { + $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 + $formattedName = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + try { + $gapicClient->getDatacenterConnector($formattedName); + // 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()); + } + + /** @test */ + public function getGroupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->getGroup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetGroup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getGroupExceptionTest() + { + $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 + $formattedName = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + try { + $gapicClient->getGroup($formattedName); + // 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()); + } + + /** @test */ + public function getMigratingVmTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name2); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->getMigratingVm($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetMigratingVm', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMigratingVmExceptionTest() + { + $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 + $formattedName = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + try { + $gapicClient->getMigratingVm($formattedName); + // 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()); + } + + /** @test */ + public function getReplicationCycleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $cycleNumber = 1095724862; + $progressPercent = 2137894861; + $expectedResponse = new ReplicationCycle(); + $expectedResponse->setName($name2); + $expectedResponse->setCycleNumber($cycleNumber); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); + $response = $gapicClient->getReplicationCycle($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetReplicationCycle', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getReplicationCycleExceptionTest() + { + $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 + $formattedName = $gapicClient->replicationCycleName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]', '[REPLICATION_CYCLE]'); + try { + $gapicClient->getReplicationCycle($formattedName); + // 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()); + } + + /** @test */ + public function getSourceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $response = $gapicClient->getSource($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetSource', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSourceExceptionTest() + { + $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 + $formattedName = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + try { + $gapicClient->getSource($formattedName); + // 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()); + } + + /** @test */ + public function getTargetProjectTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name2); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + $response = $gapicClient->getTargetProject($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetTargetProject', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getTargetProjectExceptionTest() + { + $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 + $formattedName = $gapicClient->targetProjectName('[PROJECT]', '[LOCATION]', '[TARGET_PROJECT]'); + try { + $gapicClient->getTargetProject($formattedName); + // 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()); + } + + /** @test */ + public function getUtilizationReportTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $vmCount = 261463431; + $expectedResponse = new UtilizationReport(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVmCount($vmCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + $response = $gapicClient->getUtilizationReport($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/GetUtilizationReport', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getUtilizationReportExceptionTest() + { + $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 + $formattedName = $gapicClient->utilizationReportName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[UTILIZATION_REPORT]'); + try { + $gapicClient->getUtilizationReport($formattedName); + // 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()); + } + + /** @test */ + public function listCloneJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cloneJobsElement = new CloneJob(); + $cloneJobs = [ + $cloneJobsElement, + ]; + $expectedResponse = new ListCloneJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCloneJobs($cloneJobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listCloneJobs($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCloneJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCloneJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCloneJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listCloneJobs($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listCutoverJobsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cutoverJobsElement = new CutoverJob(); + $cutoverJobs = [ + $cutoverJobsElement, + ]; + $expectedResponse = new ListCutoverJobsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCutoverJobs($cutoverJobs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listCutoverJobs($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCutoverJobs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListCutoverJobs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCutoverJobsExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listCutoverJobs($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listDatacenterConnectorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $datacenterConnectorsElement = new DatacenterConnector(); + $datacenterConnectors = [ + $datacenterConnectorsElement, + ]; + $expectedResponse = new ListDatacenterConnectorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatacenterConnectors($datacenterConnectors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listDatacenterConnectors($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatacenterConnectors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListDatacenterConnectors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatacenterConnectorsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listDatacenterConnectors($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listGroupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $groupsElement = new Group(); + $groups = [ + $groupsElement, + ]; + $expectedResponse = new ListGroupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setGroups($groups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listGroups($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getGroups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListGroups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listGroupsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listGroups($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listMigratingVmsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $migratingVmsElement = new MigratingVm(); + $migratingVms = [ + $migratingVmsElement, + ]; + $expectedResponse = new ListMigratingVmsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMigratingVms($migratingVms); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listMigratingVms($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMigratingVms()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListMigratingVms', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMigratingVmsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listMigratingVms($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listReplicationCyclesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $replicationCyclesElement = new ReplicationCycle(); + $replicationCycles = [ + $replicationCyclesElement, + ]; + $expectedResponse = new ListReplicationCyclesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReplicationCycles($replicationCycles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listReplicationCycles($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReplicationCycles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListReplicationCycles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listReplicationCyclesExceptionTest() + { + $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 + $formattedParent = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listReplicationCycles($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listSourcesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $sourcesElement = new Source(); + $sources = [ + $sourcesElement, + ]; + $expectedResponse = new ListSourcesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSources($sources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listSources($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListSources', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSourcesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listSources($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listTargetProjectsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $targetProjectsElement = new TargetProject(); + $targetProjects = [ + $targetProjectsElement, + ]; + $expectedResponse = new ListTargetProjectsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTargetProjects($targetProjects); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listTargetProjects($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTargetProjects()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListTargetProjects', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listTargetProjectsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listTargetProjects($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function listUtilizationReportsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $utilizationReportsElement = new UtilizationReport(); + $utilizationReports = [ + $utilizationReportsElement, + ]; + $expectedResponse = new ListUtilizationReportsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setUtilizationReports($utilizationReports); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + $response = $gapicClient->listUtilizationReports($formattedParent, $pageToken); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getUtilizationReports()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmmigration.v1.VmMigration/ListUtilizationReports', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPageToken(); + $this->assertProtobufEquals($pageToken, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listUtilizationReportsExceptionTest() + { + $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 + $formattedParent = $gapicClient->sourceName('[PROJECT]', '[LOCATION]', '[SOURCE]'); + $pageToken = 'pageToken1630607433'; + try { + $gapicClient->listUtilizationReports($formattedParent, $pageToken); + // 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()); + } + + /** @test */ + public function pauseMigrationTest() + { + $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/pauseMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new PauseMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/pauseMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->pauseMigration($formattedMigratingVm); + $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.vmmigration.v1.VmMigration/PauseMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); + $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 pauseMigrationExceptionTest() + { + $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/pauseMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->pauseMigration($formattedMigratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/pauseMigrationTest'); + 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 removeGroupMigrationTest() + { + $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/removeGroupMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new RemoveGroupMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/removeGroupMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->removeGroupMigration($formattedGroup); + $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.vmmigration.v1.VmMigration/RemoveGroupMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($formattedGroup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); + $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 removeGroupMigrationExceptionTest() + { + $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/removeGroupMigrationTest'); + $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 + $formattedGroup = $gapicClient->groupName('[PROJECT]', '[LOCATION]', '[GROUP]'); + $response = $gapicClient->removeGroupMigration($formattedGroup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/removeGroupMigrationTest'); + 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 resumeMigrationTest() + { + $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/resumeMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ResumeMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resumeMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->resumeMigration($formattedMigratingVm); + $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.vmmigration.v1.VmMigration/ResumeMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); + $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 resumeMigrationExceptionTest() + { + $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/resumeMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->resumeMigration($formattedMigratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resumeMigrationTest'); + 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 startMigrationTest() + { + $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/startMigrationTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new StartMigrationResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/startMigrationTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->startMigration($formattedMigratingVm); + $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.vmmigration.v1.VmMigration/StartMigration', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($formattedMigratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startMigrationTest'); + $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 startMigrationExceptionTest() + { + $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/startMigrationTest'); + $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 + $formattedMigratingVm = $gapicClient->migratingVmName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[MIGRATING_VM]'); + $response = $gapicClient->startMigration($formattedMigratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/startMigrationTest'); + 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 updateGroupTest() + { + $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/updateGroupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Group(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setDisplayName($displayName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateGroupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $group = new Group(); + $response = $gapicClient->updateGroup($group); + $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.vmmigration.v1.VmMigration/UpdateGroup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getGroup(); + $this->assertProtobufEquals($group, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGroupTest'); + $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 updateGroupExceptionTest() + { + $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/updateGroupTest'); + $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 + $group = new Group(); + $response = $gapicClient->updateGroup($group); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateGroupTest'); + 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 updateMigratingVmTest() + { + $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/updateMigratingVmTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceVmId = 'sourceVmId1673059967'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $group = 'group98629247'; + $expectedResponse = new MigratingVm(); + $expectedResponse->setName($name); + $expectedResponse->setSourceVmId($sourceVmId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setGroup($group); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMigratingVmTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $migratingVm = new MigratingVm(); + $response = $gapicClient->updateMigratingVm($migratingVm); + $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.vmmigration.v1.VmMigration/UpdateMigratingVm', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMigratingVm(); + $this->assertProtobufEquals($migratingVm, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); + $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 updateMigratingVmExceptionTest() + { + $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/updateMigratingVmTest'); + $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 + $migratingVm = new MigratingVm(); + $response = $gapicClient->updateMigratingVm($migratingVm); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMigratingVmTest'); + 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 updateSourceTest() + { + $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/updateSourceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new Source(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSourceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $source = new Source(); + $response = $gapicClient->updateSource($source); + $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.vmmigration.v1.VmMigration/UpdateSource', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getSource(); + $this->assertProtobufEquals($source, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSourceTest'); + $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 updateSourceExceptionTest() + { + $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/updateSourceTest'); + $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 + $source = new Source(); + $response = $gapicClient->updateSource($source); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSourceTest'); + 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 updateTargetProjectTest() + { + $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/updateTargetProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $project = 'project-309310695'; + $description = 'description-1724546052'; + $expectedResponse = new TargetProject(); + $expectedResponse->setName($name); + $expectedResponse->setProject($project); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateTargetProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $targetProject = new TargetProject(); + $response = $gapicClient->updateTargetProject($targetProject); + $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.vmmigration.v1.VmMigration/UpdateTargetProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getTargetProject(); + $this->assertProtobufEquals($targetProject, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); + $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 updateTargetProjectExceptionTest() + { + $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/updateTargetProjectTest'); + $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 + $targetProject = new TargetProject(); + $response = $gapicClient->updateTargetProject($targetProject); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateTargetProjectTest'); + 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 upgradeApplianceTest() + { + $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/upgradeApplianceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new UpgradeApplianceResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/upgradeApplianceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $response = $gapicClient->upgradeAppliance($formattedDatacenterConnector); + $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.vmmigration.v1.VmMigration/UpgradeAppliance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatacenterConnector(); + $this->assertProtobufEquals($formattedDatacenterConnector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); + $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 upgradeApplianceExceptionTest() + { + $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/upgradeApplianceTest'); + $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 + $formattedDatacenterConnector = $gapicClient->datacenterConnectorName('[PROJECT]', '[LOCATION]', '[SOURCE]', '[DATACENTER_CONNECTOR]'); + $response = $gapicClient->upgradeAppliance($formattedDatacenterConnector); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/upgradeApplianceTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/Vmwareengine.php b/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/Vmwareengine.php new file mode 100644 index 00000000000..9bf8d73c54c Binary files /dev/null and b/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/Vmwareengine.php differ diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/VmwareengineResources.php b/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/VmwareengineResources.php new file mode 100644 index 00000000000..46e6d32afdf Binary files /dev/null and b/owl-bot-staging/VmwareEngine/v1/proto/src/GPBMetadata/Google/Cloud/Vmwareengine/V1/VmwareengineResources.php differ diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster.php new file mode 100644 index 00000000000..090566a8295 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster.php @@ -0,0 +1,367 @@ +google.cloud.vmwareengine.v1.Cluster + */ +class Cluster extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this cluster. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. State of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. True if the cluster is a management cluster; false otherwise. + * There can only be one management cluster in a private cloud + * and it has to be the first one. + * + * Generated from protobuf field bool management = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $management = false; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 16 [(.google.api.field_behavior) = REQUIRED]; + */ + private $node_type_configs; + /** + * Optional. Configuration of a stretched cluster. Required for clusters that + * belong to a STRETCHED private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $stretched_cluster_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this cluster. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type int $state + * Output only. State of the resource. + * @type bool $management + * Output only. True if the cluster is a management cluster; false otherwise. + * There can only be one management cluster in a private cloud + * and it has to be the first one. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type array|\Google\Protobuf\Internal\MapField $node_type_configs + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * @type \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig $stretched_cluster_config + * Optional. Configuration of a stretched cluster. Required for clusters that + * belong to a STRETCHED private cloud. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this cluster. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this cluster. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. State of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Cluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. True if the cluster is a management cluster; false otherwise. + * There can only be one management cluster in a private cloud + * and it has to be the first one. + * + * Generated from protobuf field bool management = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getManagement() + { + return $this->management; + } + + /** + * Output only. True if the cluster is a management cluster; false otherwise. + * There can only be one management cluster in a private cloud + * and it has to be the first one. + * + * Generated from protobuf field bool management = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setManagement($var) + { + GPBUtil::checkBool($var); + $this->management = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 16 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getNodeTypeConfigs() + { + return $this->node_type_configs; + } + + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 16 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setNodeTypeConfigs($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\NodeTypeConfig::class); + $this->node_type_configs = $arr; + + return $this; + } + + /** + * Optional. Configuration of a stretched cluster. Required for clusters that + * belong to a STRETCHED private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig|null + */ + public function getStretchedClusterConfig() + { + return $this->stretched_cluster_config; + } + + public function hasStretchedClusterConfig() + { + return isset($this->stretched_cluster_config); + } + + public function clearStretchedClusterConfig() + { + unset($this->stretched_cluster_config); + } + + /** + * Optional. Configuration of a stretched cluster. Required for clusters that + * belong to a STRETCHED private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig $var + * @return $this + */ + public function setStretchedClusterConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig::class); + $this->stretched_cluster_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster/State.php new file mode 100644 index 00000000000..d4cfba91540 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Cluster/State.php @@ -0,0 +1,87 @@ +google.cloud.vmwareengine.v1.Cluster.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The Cluster is operational and can be used by the user. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The Cluster is being deployed. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * Adding or removing of a node to the cluster, any other cluster specific + * updates. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The Cluster is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The Cluster is undergoing maintenance, for example: a failed node is + * getting replaced. + * + * Generated from protobuf enum REPAIRING = 5; + */ + const REPAIRING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::REPAIRING => 'REPAIRING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Cluster_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateClusterRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateClusterRequest.php new file mode 100644 index 00000000000..9194b7c095a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateClusterRequest.php @@ -0,0 +1,306 @@ +google.cloud.vmwareengine.v1.CreateClusterRequest + */ +class CreateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The initial description of the new cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\Cluster $cluster Required. The initial description of the new cluster. + * @param string $clusterId Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateClusterRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\Cluster $cluster, string $clusterId): self + { + return (new self()) + ->setParent($parent) + ->setCluster($cluster) + ->setClusterId($clusterId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $cluster_id + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\Cluster $cluster + * Required. The initial description of the new cluster. + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The initial description of the new cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The initial description of the new cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAccessRuleRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAccessRuleRequest.php new file mode 100644 index 00000000000..ca58f7c3989 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAccessRuleRequest.php @@ -0,0 +1,313 @@ +google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest + */ +class CreateExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The initial description of a new external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_access_rule = null; + /** + * Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_access_rule_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_access_rule_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * Please see {@see VmwareEngineClient::networkPolicyName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $externalAccessRule Required. The initial description of a new external access rule. + * @param string $externalAccessRuleId Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateExternalAccessRuleRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $externalAccessRule, string $externalAccessRuleId): self + { + return (new self()) + ->setParent($parent) + ->setExternalAccessRule($externalAccessRule) + ->setExternalAccessRuleId($externalAccessRuleId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @type \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $external_access_rule + * Required. The initial description of a new external access rule. + * @type string $external_access_rule_id + * Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The initial description of a new external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ExternalAccessRule|null + */ + public function getExternalAccessRule() + { + return $this->external_access_rule; + } + + public function hasExternalAccessRule() + { + return isset($this->external_access_rule); + } + + public function clearExternalAccessRule() + { + unset($this->external_access_rule); + } + + /** + * Required. The initial description of a new external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $var + * @return $this + */ + public function setExternalAccessRule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule::class); + $this->external_access_rule = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_access_rule_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getExternalAccessRuleId() + { + return $this->external_access_rule_id; + } + + /** + * Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_access_rule_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setExternalAccessRuleId($var) + { + GPBUtil::checkString($var, True); + $this->external_access_rule_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAddressRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAddressRequest.php new file mode 100644 index 00000000000..a21a6b76744 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateExternalAddressRequest.php @@ -0,0 +1,313 @@ +google.cloud.vmwareengine.v1.CreateExternalAddressRequest + */ +class CreateExternalAddressRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The initial description of a new external IP address. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_address = null; + /** + * Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_address_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_address_id = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\ExternalAddress $externalAddress Required. The initial description of a new external IP address. + * @param string $externalAddressId Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateExternalAddressRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\ExternalAddress $externalAddress, string $externalAddressId): self + { + return (new self()) + ->setParent($parent) + ->setExternalAddress($externalAddress) + ->setExternalAddressId($externalAddressId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type \Google\Cloud\VmwareEngine\V1\ExternalAddress $external_address + * Required. The initial description of a new external IP address. + * @type string $external_address_id + * Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The initial description of a new external IP address. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ExternalAddress|null + */ + public function getExternalAddress() + { + return $this->external_address; + } + + public function hasExternalAddress() + { + return isset($this->external_address); + } + + public function clearExternalAddress() + { + unset($this->external_address); + } + + /** + * Required. The initial description of a new external IP address. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ExternalAddress $var + * @return $this + */ + public function setExternalAddress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ExternalAddress::class); + $this->external_address = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_address_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getExternalAddressId() + { + return $this->external_address_id; + } + + /** + * Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string external_address_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setExternalAddressId($var) + { + GPBUtil::checkString($var, True); + $this->external_address_id = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateHcxActivationKeyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateHcxActivationKeyRequest.php new file mode 100644 index 00000000000..7e2526646b8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateHcxActivationKeyRequest.php @@ -0,0 +1,313 @@ +google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest + */ +class CreateHcxActivationKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $hcx_activation_key = null; + /** + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string hcx_activation_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $hcx_activation_key_id = ''; + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\HcxActivationKey $hcxActivationKey Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * @param string $hcxActivationKeyId Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateHcxActivationKeyRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\HcxActivationKey $hcxActivationKey, string $hcxActivationKeyId): self + { + return (new self()) + ->setParent($parent) + ->setHcxActivationKey($hcxActivationKey) + ->setHcxActivationKeyId($hcxActivationKeyId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @type \Google\Cloud\VmwareEngine\V1\HcxActivationKey $hcx_activation_key + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * @type string $hcx_activation_key_id + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type string $request_id + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\HcxActivationKey|null + */ + public function getHcxActivationKey() + { + return $this->hcx_activation_key; + } + + public function hasHcxActivationKey() + { + return isset($this->hcx_activation_key); + } + + public function clearHcxActivationKey() + { + unset($this->hcx_activation_key); + } + + /** + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_key = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\HcxActivationKey $var + * @return $this + */ + public function setHcxActivationKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\HcxActivationKey::class); + $this->hcx_activation_key = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string hcx_activation_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getHcxActivationKeyId() + { + return $this->hcx_activation_key_id; + } + + /** + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string hcx_activation_key_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setHcxActivationKeyId($var) + { + GPBUtil::checkString($var, True); + $this->hcx_activation_key_id = $var; + + return $this; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateLoggingServerRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateLoggingServerRequest.php new file mode 100644 index 00000000000..c3b6ecf5311 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateLoggingServerRequest.php @@ -0,0 +1,313 @@ +google.cloud.vmwareengine.v1.CreateLoggingServerRequest + */ +class CreateLoggingServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The initial description of a new logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $logging_server = null; + /** + * Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string logging_server_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $logging_server_id = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\LoggingServer $loggingServer Required. The initial description of a new logging server. + * @param string $loggingServerId Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateLoggingServerRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\LoggingServer $loggingServer, string $loggingServerId): self + { + return (new self()) + ->setParent($parent) + ->setLoggingServer($loggingServer) + ->setLoggingServerId($loggingServerId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type \Google\Cloud\VmwareEngine\V1\LoggingServer $logging_server + * Required. The initial description of a new logging server. + * @type string $logging_server_id + * Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The initial description of a new logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\LoggingServer|null + */ + public function getLoggingServer() + { + return $this->logging_server; + } + + public function hasLoggingServer() + { + return isset($this->logging_server); + } + + public function clearLoggingServer() + { + unset($this->logging_server); + } + + /** + * Required. The initial description of a new logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\LoggingServer $var + * @return $this + */ + public function setLoggingServer($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\LoggingServer::class); + $this->logging_server = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string logging_server_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLoggingServerId() + { + return $this->logging_server_id; + } + + /** + * Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string logging_server_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLoggingServerId($var) + { + GPBUtil::checkString($var, True); + $this->logging_server_id = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateManagementDnsZoneBindingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateManagementDnsZoneBindingRequest.php new file mode 100644 index 00000000000..aa2ffc5ad33 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateManagementDnsZoneBindingRequest.php @@ -0,0 +1,317 @@ +google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest + */ +class CreateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The initial values for a new management DNS zone binding. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_dns_zone_binding = null; + /** + * Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string management_dns_zone_binding_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_dns_zone_binding_id = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $managementDnsZoneBinding Required. The initial values for a new management DNS zone binding. + * @param string $managementDnsZoneBindingId Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateManagementDnsZoneBindingRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $managementDnsZoneBinding, string $managementDnsZoneBindingId): self + { + return (new self()) + ->setParent($parent) + ->setManagementDnsZoneBinding($managementDnsZoneBinding) + ->setManagementDnsZoneBindingId($managementDnsZoneBindingId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $management_dns_zone_binding + * Required. The initial values for a new management DNS zone binding. + * @type string $management_dns_zone_binding_id + * Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The initial values for a new management DNS zone binding. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding|null + */ + public function getManagementDnsZoneBinding() + { + return $this->management_dns_zone_binding; + } + + public function hasManagementDnsZoneBinding() + { + return isset($this->management_dns_zone_binding); + } + + public function clearManagementDnsZoneBinding() + { + unset($this->management_dns_zone_binding); + } + + /** + * Required. The initial values for a new management DNS zone binding. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $var + * @return $this + */ + public function setManagementDnsZoneBinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding::class); + $this->management_dns_zone_binding = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string management_dns_zone_binding_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getManagementDnsZoneBindingId() + { + return $this->management_dns_zone_binding_id; + } + + /** + * Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string management_dns_zone_binding_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setManagementDnsZoneBindingId($var) + { + GPBUtil::checkString($var, True); + $this->management_dns_zone_binding_id = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPeeringRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPeeringRequest.php new file mode 100644 index 00000000000..f7c7bb30519 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPeeringRequest.php @@ -0,0 +1,308 @@ +google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest + */ +class CreateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_peering_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_peering_id = ''; + /** + * Required. The initial description of the new network peering. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_peering = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\NetworkPeering $networkPeering Required. The initial description of the new network peering. + * @param string $networkPeeringId Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateNetworkPeeringRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\NetworkPeering $networkPeering, string $networkPeeringId): self + { + return (new self()) + ->setParent($parent) + ->setNetworkPeering($networkPeering) + ->setNetworkPeeringId($networkPeeringId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @type string $network_peering_id + * Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\NetworkPeering $network_peering + * Required. The initial description of the new network peering. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_peering_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkPeeringId() + { + return $this->network_peering_id; + } + + /** + * Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_peering_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkPeeringId($var) + { + GPBUtil::checkString($var, True); + $this->network_peering_id = $var; + + return $this; + } + + /** + * Required. The initial description of the new network peering. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPeering|null + */ + public function getNetworkPeering() + { + return $this->network_peering; + } + + public function hasNetworkPeering() + { + return isset($this->network_peering); + } + + public function clearNetworkPeering() + { + unset($this->network_peering); + } + + /** + * Required. The initial description of the new network peering. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPeering $var + * @return $this + */ + public function setNetworkPeering($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPeering::class); + $this->network_peering = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPolicyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPolicyRequest.php new file mode 100644 index 00000000000..de757cee24d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateNetworkPolicyRequest.php @@ -0,0 +1,318 @@ +google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest + */ +class CreateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_policy_id = ''; + /** + * Required. The network policy configuration to use in the request. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_policy = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy $networkPolicy Required. The network policy configuration to use in the request. + * @param string $networkPolicyId Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateNetworkPolicyRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\NetworkPolicy $networkPolicy, string $networkPolicyId): self + { + return (new self()) + ->setParent($parent) + ->setNetworkPolicy($networkPolicy) + ->setNetworkPolicyId($networkPolicyId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * @type string $network_policy_id + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\NetworkPolicy $network_policy + * Required. The network policy configuration to use in the request. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkPolicyId() + { + return $this->network_policy_id; + } + + /** + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string network_policy_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkPolicyId($var) + { + GPBUtil::checkString($var, True); + $this->network_policy_id = $var; + + return $this; + } + + /** + * Required. The network policy configuration to use in the request. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPolicy|null + */ + public function getNetworkPolicy() + { + return $this->network_policy; + } + + public function hasNetworkPolicy() + { + return isset($this->network_policy); + } + + public function clearNetworkPolicy() + { + unset($this->network_policy); + } + + /** + * Required. The network policy configuration to use in the request. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy $var + * @return $this + */ + public function setNetworkPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPolicy::class); + $this->network_policy = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateCloudRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateCloudRequest.php new file mode 100644 index 00000000000..4b306cdb691 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateCloudRequest.php @@ -0,0 +1,306 @@ +google.cloud.vmwareengine.v1.CreatePrivateCloudRequest + */ +class CreatePrivateCloudRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_cloud_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_cloud_id = ''; + /** + * Required. The initial description of the new private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_cloud = null; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud $privateCloud Required. The initial description of the new private cloud. + * @param string $privateCloudId Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreatePrivateCloudRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\PrivateCloud $privateCloud, string $privateCloudId): self + { + return (new self()) + ->setParent($parent) + ->setPrivateCloud($privateCloud) + ->setPrivateCloudId($privateCloudId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @type string $private_cloud_id + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\PrivateCloud $private_cloud + * Required. The initial description of the new private cloud. + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_cloud_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPrivateCloudId() + { + return $this->private_cloud_id; + } + + /** + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_cloud_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPrivateCloudId($var) + { + GPBUtil::checkString($var, True); + $this->private_cloud_id = $var; + + return $this; + } + + /** + * Required. The initial description of the new private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\PrivateCloud|null + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + public function hasPrivateCloud() + { + return isset($this->private_cloud); + } + + public function clearPrivateCloud() + { + unset($this->private_cloud); + } + + /** + * Required. The initial description of the new private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\PrivateCloud::class); + $this->private_cloud = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateConnectionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateConnectionRequest.php new file mode 100644 index 00000000000..a86804b320b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreatePrivateConnectionRequest.php @@ -0,0 +1,308 @@ +google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest + */ +class CreatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_connection_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_connection_id = ''; + /** + * Required. The initial description of the new private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_connection = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\PrivateConnection $privateConnection Required. The initial description of the new private connection. + * @param string $privateConnectionId Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreatePrivateConnectionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\PrivateConnection $privateConnection, string $privateConnectionId): self + { + return (new self()) + ->setParent($parent) + ->setPrivateConnection($privateConnection) + ->setPrivateConnectionId($privateConnectionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * @type string $private_connection_id + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\PrivateConnection $private_connection + * Required. The initial description of the new private connection. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_connection_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPrivateConnectionId() + { + return $this->private_connection_id; + } + + /** + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string private_connection_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPrivateConnectionId($var) + { + GPBUtil::checkString($var, True); + $this->private_connection_id = $var; + + return $this; + } + + /** + * Required. The initial description of the new private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\PrivateConnection|null + */ + public function getPrivateConnection() + { + return $this->private_connection; + } + + public function hasPrivateConnection() + { + return isset($this->private_connection); + } + + public function clearPrivateConnection() + { + unset($this->private_connection); + } + + /** + * Required. The initial description of the new private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\PrivateConnection $var + * @return $this + */ + public function setPrivateConnection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection::class); + $this->private_connection = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateVmwareEngineNetworkRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateVmwareEngineNetworkRequest.php new file mode 100644 index 00000000000..ba26cffddd4 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/CreateVmwareEngineNetworkRequest.php @@ -0,0 +1,333 @@ +google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest + */ +class CreateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string vmware_engine_network_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $vmware_engine_network_id = ''; + /** + * Required. The initial description of the new VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $vmware_engine_network = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $parent Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmwareEngineNetwork Required. The initial description of the new VMware Engine network. + * @param string $vmwareEngineNetworkId Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * @return \Google\Cloud\VmwareEngine\V1\CreateVmwareEngineNetworkRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmwareEngineNetwork, string $vmwareEngineNetworkId): self + { + return (new self()) + ->setParent($parent) + ->setVmwareEngineNetwork($vmwareEngineNetwork) + ->setVmwareEngineNetworkId($vmwareEngineNetworkId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * @type string $vmware_engine_network_id + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @type \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmware_engine_network + * Required. The initial description of the new VMware Engine network. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string vmware_engine_network_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getVmwareEngineNetworkId() + { + return $this->vmware_engine_network_id; + } + + /** + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * + * Generated from protobuf field string vmware_engine_network_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setVmwareEngineNetworkId($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network_id = $var; + + return $this; + } + + /** + * Required. The initial description of the new VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork|null + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + public function hasVmwareEngineNetwork() + { + return isset($this->vmware_engine_network); + } + + public function clearVmwareEngineNetwork() + { + unset($this->vmware_engine_network); + } + + /** + * Required. The initial description of the new VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork::class); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Credentials.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Credentials.php new file mode 100644 index 00000000000..262d839c299 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Credentials.php @@ -0,0 +1,101 @@ +google.cloud.vmwareengine.v1.Credentials + */ +class Credentials extends \Google\Protobuf\Internal\Message +{ + /** + * Initial username. + * + * Generated from protobuf field string username = 1; + */ + protected $username = ''; + /** + * Initial password. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Initial username. + * @type string $password + * Initial password. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Initial username. + * + * Generated from protobuf field string username = 1; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Initial username. + * + * Generated from protobuf field string username = 1; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Initial password. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Initial password. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteClusterRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteClusterRequest.php new file mode 100644 index 00000000000..9338e958e48 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteClusterRequest.php @@ -0,0 +1,140 @@ +google.cloud.vmwareengine.v1.DeleteClusterRequest + */ +class DeleteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * Please see {@see VmwareEngineClient::clusterName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteClusterRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAccessRuleRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAccessRuleRequest.php new file mode 100644 index 00000000000..0b810d04d2e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAccessRuleRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest + */ +class DeleteExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * Please see {@see VmwareEngineClient::externalAccessRuleName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteExternalAccessRuleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAddressRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAddressRequest.php new file mode 100644 index 00000000000..1c37bf2f2a3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteExternalAddressRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteExternalAddressRequest + */ +class DeleteExternalAddressRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * Please see {@see VmwareEngineClient::externalAddressName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteExternalAddressRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteLoggingServerRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteLoggingServerRequest.php new file mode 100644 index 00000000000..ed81af1f507 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteLoggingServerRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteLoggingServerRequest + */ +class DeleteLoggingServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * Please see {@see VmwareEngineClient::loggingServerName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteLoggingServerRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteManagementDnsZoneBindingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteManagementDnsZoneBindingRequest.php new file mode 100644 index 00000000000..492d3b27eff --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteManagementDnsZoneBindingRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest + */ +class DeleteManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * Please see {@see VmwareEngineClient::managementDnsZoneBindingName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteManagementDnsZoneBindingRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPeeringRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPeeringRequest.php new file mode 100644 index 00000000000..1e47b474ef7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPeeringRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest + */ +class DeleteNetworkPeeringRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * Please see {@see VmwareEngineClient::networkPeeringName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteNetworkPeeringRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPolicyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPolicyRequest.php new file mode 100644 index 00000000000..557ee72de84 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteNetworkPolicyRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest + */ +class DeleteNetworkPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * Please see {@see VmwareEngineClient::networkPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteNetworkPolicyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateCloudRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateCloudRequest.php new file mode 100644 index 00000000000..4421609c05c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateCloudRequest.php @@ -0,0 +1,262 @@ +google.cloud.vmwareengine.v1.DeletePrivateCloudRequest + */ +class DeletePrivateCloudRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * + * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + /** + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * + * Generated from protobuf field optional int32 delay_hours = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $delay_hours = null; + + /** + * @param string $name Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeletePrivateCloudRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $force + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * @type int $delay_hours + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * + * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * + * Generated from protobuf field bool force = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + + /** + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * + * Generated from protobuf field optional int32 delay_hours = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDelayHours() + { + return isset($this->delay_hours) ? $this->delay_hours : 0; + } + + public function hasDelayHours() + { + return isset($this->delay_hours); + } + + public function clearDelayHours() + { + unset($this->delay_hours); + } + + /** + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * + * Generated from protobuf field optional int32 delay_hours = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDelayHours($var) + { + GPBUtil::checkInt32($var); + $this->delay_hours = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateConnectionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateConnectionRequest.php new file mode 100644 index 00000000000..58bb810feba --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeletePrivateConnectionRequest.php @@ -0,0 +1,180 @@ +google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest + */ +class DeletePrivateConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * Please see {@see VmwareEngineClient::privateConnectionName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeletePrivateConnectionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteVmwareEngineNetworkRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteVmwareEngineNetworkRequest.php new file mode 100644 index 00000000000..27b7a9e393f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DeleteVmwareEngineNetworkRequest.php @@ -0,0 +1,226 @@ +google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest + */ +class DeleteVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * @param string $name Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * Please see {@see VmwareEngineClient::vmwareEngineNetworkName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\DeleteVmwareEngineNetworkRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsBindPermission.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsBindPermission.php new file mode 100644 index 00000000000..64797809c80 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsBindPermission.php @@ -0,0 +1,130 @@ +google.cloud.vmwareengine.v1.DnsBindPermission + */ +class DnsBindPermission extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Output only. The name of the resource which stores the + * users/service accounts having the permission to bind to the corresponding + * intranet VPC of the consumer project. DnsBindPermission is a global + * resource and location can only be global. Resource names are schemeless + * URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Users/Service accounts which have access for binding on the + * intranet VPC project corresponding to the consumer project. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Principal principals = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $principals; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Output only. The name of the resource which stores the + * users/service accounts having the permission to bind to the corresponding + * intranet VPC of the consumer project. DnsBindPermission is a global + * resource and location can only be global. Resource names are schemeless + * URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @type array<\Google\Cloud\VmwareEngine\V1\Principal>|\Google\Protobuf\Internal\RepeatedField $principals + * Output only. Users/Service accounts which have access for binding on the + * intranet VPC project corresponding to the consumer project. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Output only. The name of the resource which stores the + * users/service accounts having the permission to bind to the corresponding + * intranet VPC of the consumer project. DnsBindPermission is a global + * resource and location can only be global. Resource names are schemeless + * URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Output only. The name of the resource which stores the + * users/service accounts having the permission to bind to the corresponding + * intranet VPC of the consumer project. DnsBindPermission is a global + * resource and location can only be global. Resource names are schemeless + * URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Users/Service accounts which have access for binding on the + * intranet VPC project corresponding to the consumer project. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Principal principals = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPrincipals() + { + return $this->principals; + } + + /** + * Output only. Users/Service accounts which have access for binding on the + * intranet VPC project corresponding to the consumer project. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Principal principals = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VmwareEngine\V1\Principal>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPrincipals($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\Principal::class); + $this->principals = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding.php new file mode 100644 index 00000000000..d21001a105d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding.php @@ -0,0 +1,207 @@ +google.cloud.vmwareengine.v1.DnsForwarding + */ +class DnsForwarding extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this DNS profile. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. List of domain mappings to configure + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.DnsForwarding.ForwardingRule forwarding_rules = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $forwarding_rules; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this DNS profile. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type array<\Google\Cloud\VmwareEngine\V1\DnsForwarding\ForwardingRule>|\Google\Protobuf\Internal\RepeatedField $forwarding_rules + * Required. List of domain mappings to configure + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this DNS profile. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this DNS profile. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. List of domain mappings to configure + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.DnsForwarding.ForwardingRule forwarding_rules = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getForwardingRules() + { + return $this->forwarding_rules; + } + + /** + * Required. List of domain mappings to configure + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.DnsForwarding.ForwardingRule forwarding_rules = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\VmwareEngine\V1\DnsForwarding\ForwardingRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setForwardingRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\DnsForwarding\ForwardingRule::class); + $this->forwarding_rules = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding/ForwardingRule.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding/ForwardingRule.php new file mode 100644 index 00000000000..efb832d58e9 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/DnsForwarding/ForwardingRule.php @@ -0,0 +1,107 @@ +google.cloud.vmwareengine.v1.DnsForwarding.ForwardingRule + */ +class ForwardingRule extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Domain used to resolve a `name_servers` list. + * + * Generated from protobuf field string domain = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $domain = ''; + /** + * Required. List of DNS servers to use for domain resolution + * + * Generated from protobuf field repeated string name_servers = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $name_servers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $domain + * Required. Domain used to resolve a `name_servers` list. + * @type array|\Google\Protobuf\Internal\RepeatedField $name_servers + * Required. List of DNS servers to use for domain resolution + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Domain used to resolve a `name_servers` list. + * + * Generated from protobuf field string domain = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDomain() + { + return $this->domain; + } + + /** + * Required. Domain used to resolve a `name_servers` list. + * + * Generated from protobuf field string domain = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDomain($var) + { + GPBUtil::checkString($var, True); + $this->domain = $var; + + return $this; + } + + /** + * Required. List of DNS servers to use for domain resolution + * + * Generated from protobuf field repeated string name_servers = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNameServers() + { + return $this->name_servers; + } + + /** + * Required. List of DNS servers to use for domain resolution + * + * Generated from protobuf field repeated string name_servers = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNameServers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->name_servers = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ForwardingRule::class, \Google\Cloud\VmwareEngine\V1\DnsForwarding_ForwardingRule::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule.php new file mode 100644 index 00000000000..3df395f4ba3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule.php @@ -0,0 +1,620 @@ +google.cloud.vmwareengine.v1.ExternalAccessRule + */ +class ExternalAccessRule extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this external access rule. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-provided description for this external access rule. + * + * Generated from protobuf field string description = 5; + */ + protected $description = ''; + /** + * External access rule priority, which determines the external access rule to + * use when multiple rules apply. If multiple rules have the same priority, + * their ordering is non-deterministic. If specific ordering is required, + * assign unique priorities to enforce such ordering. The external access rule + * priority is an integer from 100 to 4096, both inclusive. Lower integers + * indicate higher precedence. For example, a rule with priority `100` has + * higher precedence than a rule with priority `101`. + * + * Generated from protobuf field int32 priority = 6; + */ + protected $priority = 0; + /** + * The action that the external access rule performs. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.Action action = 7; + */ + protected $action = 0; + /** + * The IP protocol to which the external access rule applies. This value can + * be one of the following three protocol strings (not case-sensitive): + * `tcp`, `udp`, or `icmp`. + * + * Generated from protobuf field string ip_protocol = 8; + */ + protected $ip_protocol = ''; + /** + * If source ranges are specified, the external access rule applies only to + * traffic that has a source IP address in these ranges. These ranges can + * either be expressed in the CIDR format or as an IP address. As only inbound + * rules are supported, `ExternalAddress` resources cannot be the source IP + * addresses of an external access rule. To match all source addresses, + * specify `0.0.0.0/0`. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange source_ip_ranges = 9; + */ + private $source_ip_ranges; + /** + * A list of source ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all source ports, specify + * `["0-65535"]`. + * + * Generated from protobuf field repeated string source_ports = 10; + */ + private $source_ports; + /** + * If destination ranges are specified, the external access rule applies only + * to the traffic that has a destination IP address in these ranges. The + * specified IP addresses must have reserved external IP addresses in the + * scope of the parent network policy. To match all external IP addresses in + * the scope of the parent network policy, specify `0.0.0.0/0`. To match a + * specific external IP address, specify it using the + * `IpRange.external_address` property. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange destination_ip_ranges = 11; + */ + private $destination_ip_ranges; + /** + * A list of destination ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all destination ports, + * specify `["0-65535"]`. + * + * Generated from protobuf field repeated string destination_ports = 12; + */ + private $destination_ports; + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this external access rule. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $description + * User-provided description for this external access rule. + * @type int $priority + * External access rule priority, which determines the external access rule to + * use when multiple rules apply. If multiple rules have the same priority, + * their ordering is non-deterministic. If specific ordering is required, + * assign unique priorities to enforce such ordering. The external access rule + * priority is an integer from 100 to 4096, both inclusive. Lower integers + * indicate higher precedence. For example, a rule with priority `100` has + * higher precedence than a rule with priority `101`. + * @type int $action + * The action that the external access rule performs. + * @type string $ip_protocol + * The IP protocol to which the external access rule applies. This value can + * be one of the following three protocol strings (not case-sensitive): + * `tcp`, `udp`, or `icmp`. + * @type array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange>|\Google\Protobuf\Internal\RepeatedField $source_ip_ranges + * If source ranges are specified, the external access rule applies only to + * traffic that has a source IP address in these ranges. These ranges can + * either be expressed in the CIDR format or as an IP address. As only inbound + * rules are supported, `ExternalAddress` resources cannot be the source IP + * addresses of an external access rule. To match all source addresses, + * specify `0.0.0.0/0`. + * @type array|\Google\Protobuf\Internal\RepeatedField $source_ports + * A list of source ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all source ports, specify + * `["0-65535"]`. + * @type array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange>|\Google\Protobuf\Internal\RepeatedField $destination_ip_ranges + * If destination ranges are specified, the external access rule applies only + * to the traffic that has a destination IP address in these ranges. The + * specified IP addresses must have reserved external IP addresses in the + * scope of the parent network policy. To match all external IP addresses in + * the scope of the parent network policy, specify `0.0.0.0/0`. To match a + * specific external IP address, specify it using the + * `IpRange.external_address` property. + * @type array|\Google\Protobuf\Internal\RepeatedField $destination_ports + * A list of destination ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all destination ports, + * specify `["0-65535"]`. + * @type int $state + * Output only. The state of the resource. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this external access rule. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this external access rule. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-provided description for this external access rule. + * + * Generated from protobuf field string description = 5; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description for this external access rule. + * + * Generated from protobuf field string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * External access rule priority, which determines the external access rule to + * use when multiple rules apply. If multiple rules have the same priority, + * their ordering is non-deterministic. If specific ordering is required, + * assign unique priorities to enforce such ordering. The external access rule + * priority is an integer from 100 to 4096, both inclusive. Lower integers + * indicate higher precedence. For example, a rule with priority `100` has + * higher precedence than a rule with priority `101`. + * + * Generated from protobuf field int32 priority = 6; + * @return int + */ + public function getPriority() + { + return $this->priority; + } + + /** + * External access rule priority, which determines the external access rule to + * use when multiple rules apply. If multiple rules have the same priority, + * their ordering is non-deterministic. If specific ordering is required, + * assign unique priorities to enforce such ordering. The external access rule + * priority is an integer from 100 to 4096, both inclusive. Lower integers + * indicate higher precedence. For example, a rule with priority `100` has + * higher precedence than a rule with priority `101`. + * + * Generated from protobuf field int32 priority = 6; + * @param int $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkInt32($var); + $this->priority = $var; + + return $this; + } + + /** + * The action that the external access rule performs. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.Action action = 7; + * @return int + */ + public function getAction() + { + return $this->action; + } + + /** + * The action that the external access rule performs. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.Action action = 7; + * @param int $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule\Action::class); + $this->action = $var; + + return $this; + } + + /** + * The IP protocol to which the external access rule applies. This value can + * be one of the following three protocol strings (not case-sensitive): + * `tcp`, `udp`, or `icmp`. + * + * Generated from protobuf field string ip_protocol = 8; + * @return string + */ + public function getIpProtocol() + { + return $this->ip_protocol; + } + + /** + * The IP protocol to which the external access rule applies. This value can + * be one of the following three protocol strings (not case-sensitive): + * `tcp`, `udp`, or `icmp`. + * + * Generated from protobuf field string ip_protocol = 8; + * @param string $var + * @return $this + */ + public function setIpProtocol($var) + { + GPBUtil::checkString($var, True); + $this->ip_protocol = $var; + + return $this; + } + + /** + * If source ranges are specified, the external access rule applies only to + * traffic that has a source IP address in these ranges. These ranges can + * either be expressed in the CIDR format or as an IP address. As only inbound + * rules are supported, `ExternalAddress` resources cannot be the source IP + * addresses of an external access rule. To match all source addresses, + * specify `0.0.0.0/0`. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange source_ip_ranges = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSourceIpRanges() + { + return $this->source_ip_ranges; + } + + /** + * If source ranges are specified, the external access rule applies only to + * traffic that has a source IP address in these ranges. These ranges can + * either be expressed in the CIDR format or as an IP address. As only inbound + * rules are supported, `ExternalAddress` resources cannot be the source IP + * addresses of an external access rule. To match all source addresses, + * specify `0.0.0.0/0`. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange source_ip_ranges = 9; + * @param array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSourceIpRanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange::class); + $this->source_ip_ranges = $arr; + + return $this; + } + + /** + * A list of source ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all source ports, specify + * `["0-65535"]`. + * + * Generated from protobuf field repeated string source_ports = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSourcePorts() + { + return $this->source_ports; + } + + /** + * A list of source ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all source ports, specify + * `["0-65535"]`. + * + * Generated from protobuf field repeated string source_ports = 10; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSourcePorts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->source_ports = $arr; + + return $this; + } + + /** + * If destination ranges are specified, the external access rule applies only + * to the traffic that has a destination IP address in these ranges. The + * specified IP addresses must have reserved external IP addresses in the + * scope of the parent network policy. To match all external IP addresses in + * the scope of the parent network policy, specify `0.0.0.0/0`. To match a + * specific external IP address, specify it using the + * `IpRange.external_address` property. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange destination_ip_ranges = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationIpRanges() + { + return $this->destination_ip_ranges; + } + + /** + * If destination ranges are specified, the external access rule applies only + * to the traffic that has a destination IP address in these ranges. The + * specified IP addresses must have reserved external IP addresses in the + * scope of the parent network policy. To match all external IP addresses in + * the scope of the parent network policy, specify `0.0.0.0/0`. To match a + * specific external IP address, specify it using the + * `IpRange.external_address` property. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange destination_ip_ranges = 11; + * @param array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationIpRanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule\IpRange::class); + $this->destination_ip_ranges = $arr; + + return $this; + } + + /** + * A list of destination ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all destination ports, + * specify `["0-65535"]`. + * + * Generated from protobuf field repeated string destination_ports = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationPorts() + { + return $this->destination_ports; + } + + /** + * A list of destination ports to which the external access rule applies. This + * field is only applicable for the UDP or TCP protocol. + * Each entry must be either an integer or a range. For example: `["22"]`, + * `["80","443"]`, or `["12345-12349"]`. To match all destination ports, + * specify `["0-65535"]`. + * + * Generated from protobuf field repeated string destination_ports = 12; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationPorts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->destination_ports = $arr; + + return $this; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/Action.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/Action.php new file mode 100644 index 00000000000..550c0dc3422 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/Action.php @@ -0,0 +1,65 @@ +google.cloud.vmwareengine.v1.ExternalAccessRule.Action + */ +class Action +{ + /** + * Defaults to allow. + * + * Generated from protobuf enum ACTION_UNSPECIFIED = 0; + */ + const ACTION_UNSPECIFIED = 0; + /** + * Allows connections that match the other specified components. + * + * Generated from protobuf enum ALLOW = 1; + */ + const ALLOW = 1; + /** + * Blocks connections that match the other specified components. + * + * Generated from protobuf enum DENY = 2; + */ + const DENY = 2; + + private static $valueToName = [ + self::ACTION_UNSPECIFIED => 'ACTION_UNSPECIFIED', + self::ALLOW => 'ALLOW', + self::DENY => 'DENY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Action::class, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule_Action::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/IpRange.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/IpRange.php new file mode 100644 index 00000000000..efa4769037a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/IpRange.php @@ -0,0 +1,159 @@ +google.cloud.vmwareengine.v1.ExternalAccessRule.IpRange + */ +class IpRange extends \Google\Protobuf\Internal\Message +{ + protected $ip_range; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ip_address + * A single IP address. For example: `10.0.0.5`. + * @type string $ip_address_range + * An IP address range in the CIDR format. For example: `10.0.0.0/24`. + * @type string $external_address + * The name of an `ExternalAddress` resource. The external address must + * have been reserved in the scope of this external access rule's parent + * network policy. Provide the external address name in the form of + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}`. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * A single IP address. For example: `10.0.0.5`. + * + * Generated from protobuf field string ip_address = 1; + * @return string + */ + public function getIpAddress() + { + return $this->readOneof(1); + } + + public function hasIpAddress() + { + return $this->hasOneof(1); + } + + /** + * A single IP address. For example: `10.0.0.5`. + * + * Generated from protobuf field string ip_address = 1; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * An IP address range in the CIDR format. For example: `10.0.0.0/24`. + * + * Generated from protobuf field string ip_address_range = 2; + * @return string + */ + public function getIpAddressRange() + { + return $this->readOneof(2); + } + + public function hasIpAddressRange() + { + return $this->hasOneof(2); + } + + /** + * An IP address range in the CIDR format. For example: `10.0.0.0/24`. + * + * Generated from protobuf field string ip_address_range = 2; + * @param string $var + * @return $this + */ + public function setIpAddressRange($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The name of an `ExternalAddress` resource. The external address must + * have been reserved in the scope of this external access rule's parent + * network policy. Provide the external address name in the form of + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}`. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address`. + * + * Generated from protobuf field string external_address = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getExternalAddress() + { + return $this->readOneof(3); + } + + public function hasExternalAddress() + { + return $this->hasOneof(3); + } + + /** + * The name of an `ExternalAddress` resource. The external address must + * have been reserved in the scope of this external access rule's parent + * network policy. Provide the external address name in the form of + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}`. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address`. + * + * Generated from protobuf field string external_address = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setExternalAddress($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getIpRange() + { + return $this->whichOneof("ip_range"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IpRange::class, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule_IpRange::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/State.php new file mode 100644 index 00000000000..1b9722eda69 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAccessRule/State.php @@ -0,0 +1,78 @@ +google.cloud.vmwareengine.v1.ExternalAccessRule.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The rule is ready. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The rule is being created. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The rule is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The rule is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress.php new file mode 100644 index 00000000000..8d15877850b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress.php @@ -0,0 +1,342 @@ +google.cloud.vmwareengine.v1.ExternalAddress + */ +class ExternalAddress extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this external IP address. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * The internal IP address of a workload VM. + * + * Generated from protobuf field string internal_ip = 6; + */ + protected $internal_ip = ''; + /** + * Output only. The external IP address of a workload VM. + * + * Generated from protobuf field string external_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $external_ip = ''; + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 11; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this external IP address. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $internal_ip + * The internal IP address of a workload VM. + * @type string $external_ip + * Output only. The external IP address of a workload VM. + * @type int $state + * Output only. The state of the resource. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type string $description + * User-provided description for this resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this external IP address. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this external IP address. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The internal IP address of a workload VM. + * + * Generated from protobuf field string internal_ip = 6; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * The internal IP address of a workload VM. + * + * Generated from protobuf field string internal_ip = 6; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * Output only. The external IP address of a workload VM. + * + * Generated from protobuf field string external_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getExternalIp() + { + return $this->external_ip; + } + + /** + * Output only. The external IP address of a workload VM. + * + * Generated from protobuf field string external_ip = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setExternalIp($var) + { + GPBUtil::checkString($var, True); + $this->external_ip = $var; + + return $this; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\ExternalAddress\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 11; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 11; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress/State.php new file mode 100644 index 00000000000..97dea9cbf98 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ExternalAddress/State.php @@ -0,0 +1,78 @@ +google.cloud.vmwareengine.v1.ExternalAddress.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The address is ready. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The address is being created. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The address is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The address is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\ExternalAddress_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesRequest.php new file mode 100644 index 00000000000..33a7dc9f663 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesRequest.php @@ -0,0 +1,202 @@ +google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest + */ +class FetchNetworkPolicyExternalAddressesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string network_policy = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $network_policy = ''; + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $networkPolicy Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * Please see {@see VmwareEngineClient::networkPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\FetchNetworkPolicyExternalAddressesRequest + * + * @experimental + */ + public static function build(string $networkPolicy): self + { + return (new self()) + ->setNetworkPolicy($networkPolicy); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_policy + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @type int $page_size + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string network_policy = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getNetworkPolicy() + { + return $this->network_policy; + } + + /** + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string network_policy = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetworkPolicy($var) + { + GPBUtil::checkString($var, True); + $this->network_policy = $var; + + return $this; + } + + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesResponse.php new file mode 100644 index 00000000000..46faea61006 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/FetchNetworkPolicyExternalAddressesResponse.php @@ -0,0 +1,110 @@ +google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesResponse + */ +class FetchNetworkPolicyExternalAddressesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + */ + private $external_addresses; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\ExternalAddress>|\Google\Protobuf\Internal\RepeatedField $external_addresses + * A list of external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExternalAddresses() + { + return $this->external_addresses; + } + + /** + * A list of external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\ExternalAddress>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExternalAddresses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ExternalAddress::class); + $this->external_addresses = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetClusterRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetClusterRequest.php new file mode 100644 index 00000000000..765ce8ca31d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetClusterRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetClusterRequest + */ +class GetClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * Please see {@see VmwareEngineClient::clusterName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetClusterRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsBindPermissionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsBindPermissionRequest.php new file mode 100644 index 00000000000..b198700ee8d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsBindPermissionRequest.php @@ -0,0 +1,107 @@ +google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest + */ +class GetDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * Please see {@see VmwareEngineClient::dnsBindPermissionName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetDnsBindPermissionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsForwardingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsForwardingRequest.php new file mode 100644 index 00000000000..6b6e9442364 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetDnsForwardingRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetDnsForwardingRequest + */ +class GetDnsForwardingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * Please see {@see VmwareEngineClient::dnsForwardingName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetDnsForwardingRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAccessRuleRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAccessRuleRequest.php new file mode 100644 index 00000000000..4d0397c9063 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAccessRuleRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest + */ +class GetExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * Please see {@see VmwareEngineClient::externalAccessRuleName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetExternalAccessRuleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAddressRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAddressRequest.php new file mode 100644 index 00000000000..d75f2f69ca5 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetExternalAddressRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetExternalAddressRequest + */ +class GetExternalAddressRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * Please see {@see VmwareEngineClient::externalAddressName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetExternalAddressRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetHcxActivationKeyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetHcxActivationKeyRequest.php new file mode 100644 index 00000000000..d561638f4a5 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetHcxActivationKeyRequest.php @@ -0,0 +1,101 @@ +google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest + */ +class GetHcxActivationKeyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * Please see {@see VmwareEngineClient::hcxActivationKeyName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetHcxActivationKeyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetLoggingServerRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetLoggingServerRequest.php new file mode 100644 index 00000000000..ad4278ca8c8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetLoggingServerRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetLoggingServerRequest + */ +class GetLoggingServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * Please see {@see VmwareEngineClient::loggingServerName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetLoggingServerRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetManagementDnsZoneBindingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetManagementDnsZoneBindingRequest.php new file mode 100644 index 00000000000..f9dbac4170c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetManagementDnsZoneBindingRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest + */ +class GetManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * Please see {@see VmwareEngineClient::managementDnsZoneBindingName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetManagementDnsZoneBindingRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPeeringRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPeeringRequest.php new file mode 100644 index 00000000000..51572fd7732 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPeeringRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetNetworkPeeringRequest + */ +class GetNetworkPeeringRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * Please see {@see VmwareEngineClient::networkPeeringName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetNetworkPeeringRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPolicyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPolicyRequest.php new file mode 100644 index 00000000000..ca390af59e7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNetworkPolicyRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetNetworkPolicyRequest + */ +class GetNetworkPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * Please see {@see VmwareEngineClient::networkPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetNetworkPolicyRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeRequest.php new file mode 100644 index 00000000000..823d6372607 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeRequest.php @@ -0,0 +1,92 @@ +google.cloud.vmwareengine.v1.GetNodeRequest + */ +class GetNodeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * Please see {@see VmwareEngineClient::nodeName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetNodeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeTypeRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeTypeRequest.php new file mode 100644 index 00000000000..a117aa736a7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetNodeTypeRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetNodeTypeRequest + */ +class GetNodeTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * Please see {@see VmwareEngineClient::nodeTypeName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetNodeTypeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateCloudRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateCloudRequest.php new file mode 100644 index 00000000000..16b916600d3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateCloudRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetPrivateCloudRequest + */ +class GetPrivateCloudRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetPrivateCloudRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateConnectionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateConnectionRequest.php new file mode 100644 index 00000000000..2ca419dbafd --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetPrivateConnectionRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetPrivateConnectionRequest + */ +class GetPrivateConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * Please see {@see VmwareEngineClient::privateConnectionName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetPrivateConnectionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetSubnetRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetSubnetRequest.php new file mode 100644 index 00000000000..657585bb0c7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetSubnetRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetSubnetRequest + */ +class GetSubnetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * Please see {@see VmwareEngineClient::subnetName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetSubnetRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetVmwareEngineNetworkRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetVmwareEngineNetworkRequest.php new file mode 100644 index 00000000000..d9f69bd5c37 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GetVmwareEngineNetworkRequest.php @@ -0,0 +1,102 @@ +google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest + */ +class GetVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * Please see {@see VmwareEngineClient::vmwareEngineNetworkName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\GetVmwareEngineNetworkRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GrantDnsBindPermissionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GrantDnsBindPermissionRequest.php new file mode 100644 index 00000000000..b3fa012f224 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/GrantDnsBindPermissionRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest + */ +class GrantDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $principal = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * Please see {@see VmwareEngineClient::dnsBindPermissionName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\Principal $principal Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * @return \Google\Cloud\VmwareEngine\V1\GrantDnsBindPermissionRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\VmwareEngine\V1\Principal $principal): self + { + return (new self()) + ->setName($name) + ->setPrincipal($principal); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @type \Google\Cloud\VmwareEngine\V1\Principal $principal + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\Principal|null + */ + public function getPrincipal() + { + return $this->principal; + } + + public function hasPrincipal() + { + return isset($this->principal); + } + + public function clearPrincipal() + { + unset($this->principal); + } + + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\Principal $var + * @return $this + */ + public function setPrincipal($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Principal::class); + $this->principal = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx.php new file mode 100644 index 00000000000..2beef5b8868 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx.php @@ -0,0 +1,169 @@ +google.cloud.vmwareengine.v1.Hcx + */ +class Hcx extends \Google\Protobuf\Internal\Message +{ + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + */ + protected $internal_ip = ''; + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + */ + protected $fqdn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $internal_ip + * Internal IP address of the appliance. + * @type string $version + * Version of the appliance. + * @type int $state + * Output only. The state of the appliance. + * @type string $fqdn + * Fully qualified domain name of the appliance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Hcx\State::class); + $this->state = $var; + + return $this; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @return string + */ + public function getFqdn() + { + return $this->fqdn; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @param string $var + * @return $this + */ + public function setFqdn($var) + { + GPBUtil::checkString($var, True); + $this->fqdn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx/State.php new file mode 100644 index 00000000000..98ba3730325 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Hcx/State.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.Hcx.State + */ +class State +{ + /** + * Unspecified appliance state. This is the default value. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The appliance is operational and can be used. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The appliance is being deployed. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Hcx_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey.php new file mode 100644 index 00000000000..2ac89929e48 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey.php @@ -0,0 +1,236 @@ +google.cloud.vmwareengine.v1.HcxActivationKey + */ +class HcxActivationKey extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this HcxActivationKey. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of HCX activation key. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. State of HCX activation key. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. HCX activation key. + * + * Generated from protobuf field string activation_key = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $activation_key = ''; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this HcxActivationKey. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of HCX activation key. + * @type int $state + * Output only. State of HCX activation key. + * @type string $activation_key + * Output only. HCX activation key. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this HcxActivationKey. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this HcxActivationKey. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of HCX activation key. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of HCX activation key. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. State of HCX activation key. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of HCX activation key. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.HcxActivationKey.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\HcxActivationKey\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. HCX activation key. + * + * Generated from protobuf field string activation_key = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getActivationKey() + { + return $this->activation_key; + } + + /** + * Output only. HCX activation key. + * + * Generated from protobuf field string activation_key = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setActivationKey($var) + { + GPBUtil::checkString($var, True); + $this->activation_key = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey/State.php new file mode 100644 index 00000000000..403d108006b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/HcxActivationKey/State.php @@ -0,0 +1,71 @@ +google.cloud.vmwareengine.v1.HcxActivationKey.State + */ +class State +{ + /** + * Unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * State of a newly generated activation key. + * + * Generated from protobuf enum AVAILABLE = 1; + */ + const AVAILABLE = 1; + /** + * State of key when it has been used to activate HCX appliance. + * + * Generated from protobuf enum CONSUMED = 2; + */ + const CONSUMED = 2; + /** + * State of key when it is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::AVAILABLE => 'AVAILABLE', + self::CONSUMED => 'CONSUMED', + self::CREATING => 'CREATING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\HcxActivationKey_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersRequest.php new file mode 100644 index 00000000000..e5a2087e9eb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersRequest.php @@ -0,0 +1,322 @@ +google.cloud.vmwareengine.v1.ListClustersRequest + */ +class ListClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListClustersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @type string $filter + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersResponse.php new file mode 100644 index 00000000000..1db7f0ab927 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListClustersResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListClustersResponse + */ +class ListClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of private cloud clusters. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Cluster clusters = 1; + */ + private $clusters; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\Cluster>|\Google\Protobuf\Internal\RepeatedField $clusters + * A list of private cloud clusters. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of private cloud clusters. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Cluster clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClusters() + { + return $this->clusters; + } + + /** + * A list of private cloud clusters. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Cluster clusters = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\Cluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\Cluster::class); + $this->clusters = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesRequest.php new file mode 100644 index 00000000000..c4d4fa88615 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesRequest.php @@ -0,0 +1,366 @@ +google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest + */ +class ListExternalAccessRulesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * Please see {@see VmwareEngineClient::networkPolicyName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListExternalAccessRulesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @type int $page_size + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesResponse.php new file mode 100644 index 00000000000..a2083663850 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAccessRulesResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListExternalAccessRulesResponse + */ +class ListExternalAccessRulesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of external access firewall rules. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rules = 1; + */ + private $external_access_rules; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule>|\Google\Protobuf\Internal\RepeatedField $external_access_rules + * A list of external access firewall rules. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of external access firewall rules. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExternalAccessRules() + { + return $this->external_access_rules; + } + + /** + * A list of external access firewall rules. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rules = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\ExternalAccessRule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExternalAccessRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule::class); + $this->external_access_rules = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesRequest.php new file mode 100644 index 00000000000..068486baec1 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesRequest.php @@ -0,0 +1,367 @@ +google.cloud.vmwareengine.v1.ListExternalAddressesRequest + */ +class ListExternalAddressesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListExternalAddressesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesResponse.php new file mode 100644 index 00000000000..43b0db7791d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListExternalAddressesResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListExternalAddressesResponse + */ +class ListExternalAddressesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of external IP addresses. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + */ + private $external_addresses; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\ExternalAddress>|\Google\Protobuf\Internal\RepeatedField $external_addresses + * A list of external IP addresses. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of external IP addresses. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExternalAddresses() + { + return $this->external_addresses; + } + + /** + * A list of external IP addresses. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ExternalAddress external_addresses = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\ExternalAddress>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExternalAddresses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ExternalAddress::class); + $this->external_addresses = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysRequest.php new file mode 100644 index 00000000000..0a19130f8a2 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysRequest.php @@ -0,0 +1,203 @@ +google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest + */ +class ListHcxActivationKeysRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListHcxActivationKeysRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysResponse.php new file mode 100644 index 00000000000..d38aeee53fb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListHcxActivationKeysResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListHcxActivationKeysResponse + */ +class ListHcxActivationKeysResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of HCX activation keys. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_keys = 1; + */ + private $hcx_activation_keys; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\HcxActivationKey>|\Google\Protobuf\Internal\RepeatedField $hcx_activation_keys + * List of HCX activation keys. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * List of HCX activation keys. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_keys = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHcxActivationKeys() + { + return $this->hcx_activation_keys; + } + + /** + * List of HCX activation keys. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.HcxActivationKey hcx_activation_keys = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\HcxActivationKey>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHcxActivationKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\HcxActivationKey::class); + $this->hcx_activation_keys = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersRequest.php new file mode 100644 index 00000000000..84953a0b683 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersRequest.php @@ -0,0 +1,371 @@ +google.cloud.vmwareengine.v1.ListLoggingServersRequest + */ +class ListLoggingServersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListLoggingServersRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersResponse.php new file mode 100644 index 00000000000..549354db282 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListLoggingServersResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListLoggingServersResponse + */ +class ListLoggingServersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of Logging Servers. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LoggingServer logging_servers = 1; + */ + private $logging_servers; + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\LoggingServer>|\Google\Protobuf\Internal\RepeatedField $logging_servers + * A list of Logging Servers. + * @type string $next_page_token + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of Logging Servers. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LoggingServer logging_servers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLoggingServers() + { + return $this->logging_servers; + } + + /** + * A list of Logging Servers. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LoggingServer logging_servers = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\LoggingServer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLoggingServers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\LoggingServer::class); + $this->logging_servers = $arr; + + return $this; + } + + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsRequest.php new file mode 100644 index 00000000000..ab7704b5f7f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsRequest.php @@ -0,0 +1,371 @@ +google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest + */ +class ListManagementDnsZoneBindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListManagementDnsZoneBindingsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsResponse.php new file mode 100644 index 00000000000..96371ae524f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListManagementDnsZoneBindingsResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsResponse + */ +class ListManagementDnsZoneBindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of management DNS zone bindings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_bindings = 1; + */ + private $management_dns_zone_bindings; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding>|\Google\Protobuf\Internal\RepeatedField $management_dns_zone_bindings + * A list of management DNS zone bindings. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of management DNS zone bindings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_bindings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getManagementDnsZoneBindings() + { + return $this->management_dns_zone_bindings; + } + + /** + * A list of management DNS zone bindings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_bindings = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setManagementDnsZoneBindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding::class); + $this->management_dns_zone_bindings = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsRequest.php new file mode 100644 index 00000000000..38dce0b8e67 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsRequest.php @@ -0,0 +1,357 @@ +google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest + */ +class ListNetworkPeeringsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListNetworkPeeringsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @type int $page_size + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsResponse.php new file mode 100644 index 00000000000..23484cf1c0f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPeeringsResponse.php @@ -0,0 +1,140 @@ +google.cloud.vmwareengine.v1.ListNetworkPeeringsResponse + */ +class ListNetworkPeeringsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of network peerings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPeering network_peerings = 1; + */ + private $network_peerings; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\NetworkPeering>|\Google\Protobuf\Internal\RepeatedField $network_peerings + * A list of network peerings. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unreachable resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of network peerings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPeering network_peerings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkPeerings() + { + return $this->network_peerings; + } + + /** + * A list of network peerings. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPeering network_peerings = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\NetworkPeering>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkPeerings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\NetworkPeering::class); + $this->network_peerings = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesRequest.php new file mode 100644 index 00000000000..bee75e476e1 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesRequest.php @@ -0,0 +1,361 @@ +google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest + */ +class ListNetworkPoliciesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListNetworkPoliciesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @type int $page_size + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesResponse.php new file mode 100644 index 00000000000..abad447203f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNetworkPoliciesResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListNetworkPoliciesResponse + */ +class ListNetworkPoliciesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of network policies. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPolicy network_policies = 1; + */ + private $network_policies; + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\NetworkPolicy>|\Google\Protobuf\Internal\RepeatedField $network_policies + * A list of network policies. + * @type string $next_page_token + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of network policies. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPolicy network_policies = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNetworkPolicies() + { + return $this->network_policies; + } + + /** + * A list of network policies. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NetworkPolicy network_policies = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\NetworkPolicy>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNetworkPolicies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\NetworkPolicy::class); + $this->network_policies = $arr; + + return $this; + } + + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be send as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesRequest.php new file mode 100644 index 00000000000..d8b2a072333 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesRequest.php @@ -0,0 +1,312 @@ +google.cloud.vmwareengine.v1.ListNodeTypesRequest + */ +class ListNodeTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListNodeTypesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @type int $page_size + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesResponse.php new file mode 100644 index 00000000000..c8de39d538a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodeTypesResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListNodeTypesResponse + */ +class ListNodeTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of Node Types. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType node_types = 1; + */ + private $node_types; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\NodeType>|\Google\Protobuf\Internal\RepeatedField $node_types + * A list of Node Types. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of Node Types. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType node_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodeTypes() + { + return $this->node_types; + } + + /** + * A list of Node Types. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType node_types = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\NodeType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodeTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\NodeType::class); + $this->node_types = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesRequest.php new file mode 100644 index 00000000000..55daa226a1e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesRequest.php @@ -0,0 +1,198 @@ +google.cloud.vmwareengine.v1.ListNodesRequest + */ +class ListNodesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * Please see {@see VmwareEngineClient::clusterName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListNodesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @type int $page_size + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesResponse.php new file mode 100644 index 00000000000..790b31a63ed --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListNodesResponse.php @@ -0,0 +1,106 @@ +google.cloud.vmwareengine.v1.ListNodesResponse + */ +class ListNodesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The nodes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Node nodes = 1; + */ + private $nodes; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * The nodes. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * The nodes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Node nodes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * The nodes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Node nodes = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesRequest.php new file mode 100644 index 00000000000..55118727a6e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesRequest.php @@ -0,0 +1,239 @@ +google.cloud.vmwareengine.v1.ListPeeringRoutesRequest + */ +class ListPeeringRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * + * Generated from protobuf field string filter = 6; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * Please see {@see VmwareEngineClient::networkPeeringName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListPeeringRoutesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @type int $page_size + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * + * Generated from protobuf field string filter = 6; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * + * Generated from protobuf field string filter = 6; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesResponse.php new file mode 100644 index 00000000000..61112faa0ec --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPeeringRoutesResponse.php @@ -0,0 +1,106 @@ +google.cloud.vmwareengine.v1.ListPeeringRoutesResponse + */ +class ListPeeringRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + */ + private $peering_routes; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\PeeringRoute>|\Google\Protobuf\Internal\RepeatedField $peering_routes + * A list of peering routes. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPeeringRoutes() + { + return $this->peering_routes; + } + + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\PeeringRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPeeringRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\PeeringRoute::class); + $this->peering_routes = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsRequest.php new file mode 100644 index 00000000000..8e9d635b77b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsRequest.php @@ -0,0 +1,362 @@ +google.cloud.vmwareengine.v1.ListPrivateCloudsRequest + */ +class ListPrivateCloudsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListPrivateCloudsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @type int $page_size + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsResponse.php new file mode 100644 index 00000000000..bb0c02544fb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateCloudsResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListPrivateCloudsResponse + */ +class ListPrivateCloudsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of private clouds. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateCloud private_clouds = 1; + */ + private $private_clouds; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\PrivateCloud>|\Google\Protobuf\Internal\RepeatedField $private_clouds + * A list of private clouds. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of private clouds. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateCloud private_clouds = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPrivateClouds() + { + return $this->private_clouds; + } + + /** + * A list of private clouds. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateCloud private_clouds = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\PrivateCloud>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPrivateClouds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\PrivateCloud::class); + $this->private_clouds = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesRequest.php new file mode 100644 index 00000000000..fcb2b9941ab --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesRequest.php @@ -0,0 +1,189 @@ +google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest + */ +class ListPrivateConnectionPeeringRoutesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * Please see {@see VmwareEngineClient::privateConnectionName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListPrivateConnectionPeeringRoutesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @type int $page_size + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesResponse.php new file mode 100644 index 00000000000..7ae5850a3c6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionPeeringRoutesResponse.php @@ -0,0 +1,106 @@ +google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesResponse + */ +class ListPrivateConnectionPeeringRoutesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + */ + private $peering_routes; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\PeeringRoute>|\Google\Protobuf\Internal\RepeatedField $peering_routes + * A list of peering routes. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPeeringRoutes() + { + return $this->peering_routes; + } + + /** + * A list of peering routes. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PeeringRoute peering_routes = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\PeeringRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPeeringRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\PeeringRoute::class); + $this->peering_routes = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsRequest.php new file mode 100644 index 00000000000..7f5a5622e56 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsRequest.php @@ -0,0 +1,357 @@ +google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest + */ +class ListPrivateConnectionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListPrivateConnectionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @type int $page_size + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsResponse.php new file mode 100644 index 00000000000..2ce8e6c074a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListPrivateConnectionsResponse.php @@ -0,0 +1,140 @@ +google.cloud.vmwareengine.v1.ListPrivateConnectionsResponse + */ +class ListPrivateConnectionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of private connections. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateConnection private_connections = 1; + */ + private $private_connections; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\PrivateConnection>|\Google\Protobuf\Internal\RepeatedField $private_connections + * A list of private connections. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unreachable resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of private connections. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateConnection private_connections = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPrivateConnections() + { + return $this->private_connections; + } + + /** + * A list of private connections. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.PrivateConnection private_connections = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\PrivateConnection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPrivateConnections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\PrivateConnection::class); + $this->private_connections = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsRequest.php new file mode 100644 index 00000000000..8cd0a8dbe64 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsRequest.php @@ -0,0 +1,199 @@ +google.cloud.vmwareengine.v1.ListSubnetsRequest + */ +class ListSubnetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListSubnetsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type int $page_size + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsResponse.php new file mode 100644 index 00000000000..d6a41be2b73 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListSubnetsResponse.php @@ -0,0 +1,144 @@ +google.cloud.vmwareengine.v1.ListSubnetsResponse + */ +class ListSubnetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of subnets. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Subnet subnets = 1; + */ + private $subnets; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\Subnet>|\Google\Protobuf\Internal\RepeatedField $subnets + * A list of subnets. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached when making an aggregated query using + * wildcards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of subnets. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Subnet subnets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSubnets() + { + return $this->subnets; + } + + /** + * A list of subnets. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.Subnet subnets = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\Subnet>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSubnets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\Subnet::class); + $this->subnets = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached when making an aggregated query using + * wildcards. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksRequest.php new file mode 100644 index 00000000000..5d04a516277 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksRequest.php @@ -0,0 +1,357 @@ +google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest + */ +class ListVmwareEngineNetworksRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * Please see {@see VmwareEngineClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ListVmwareEngineNetworksRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @type int $page_size + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @type string $page_token + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @type string $order_by + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksResponse.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksResponse.php new file mode 100644 index 00000000000..0ca339105be --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ListVmwareEngineNetworksResponse.php @@ -0,0 +1,140 @@ +google.cloud.vmwareengine.v1.ListVmwareEngineNetworksResponse + */ +class ListVmwareEngineNetworksResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of VMware Engine networks. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_networks = 1; + */ + private $vmware_engine_networks; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork>|\Google\Protobuf\Internal\RepeatedField $vmware_engine_networks + * A list of VMware Engine networks. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unreachable resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * A list of VMware Engine networks. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_networks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVmwareEngineNetworks() + { + return $this->vmware_engine_networks; + } + + /** + * A list of VMware Engine networks. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_networks = 1; + * @param array<\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVmwareEngineNetworks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork::class); + $this->vmware_engine_networks = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata.php new file mode 100644 index 00000000000..599a522a3c3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata.php @@ -0,0 +1,69 @@ +google.cloud.vmwareengine.v1.LocationMetadata + */ +class LocationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Capabilities of this location. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LocationMetadata.Capability capabilities = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $capabilities; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $capabilities + * Output only. Capabilities of this location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Capabilities of this location. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LocationMetadata.Capability capabilities = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCapabilities() + { + return $this->capabilities; + } + + /** + * Output only. Capabilities of this location. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.LocationMetadata.Capability capabilities = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCapabilities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VmwareEngine\V1\LocationMetadata\Capability::class); + $this->capabilities = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata/Capability.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata/Capability.php new file mode 100644 index 00000000000..b02dac2f136 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LocationMetadata/Capability.php @@ -0,0 +1,58 @@ +google.cloud.vmwareengine.v1.LocationMetadata.Capability + */ +class Capability +{ + /** + * The default value. This value is used if the capability is omitted or + * unknown. + * + * Generated from protobuf enum CAPABILITY_UNSPECIFIED = 0; + */ + const CAPABILITY_UNSPECIFIED = 0; + /** + * Stretch clusters are supported in this location. + * + * Generated from protobuf enum STRETCHED_CLUSTERS = 1; + */ + const STRETCHED_CLUSTERS = 1; + + private static $valueToName = [ + self::CAPABILITY_UNSPECIFIED => 'CAPABILITY_UNSPECIFIED', + self::STRETCHED_CLUSTERS => 'STRETCHED_CLUSTERS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Capability::class, \Google\Cloud\VmwareEngine\V1\LocationMetadata_Capability::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer.php new file mode 100644 index 00000000000..e064acbab3d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer.php @@ -0,0 +1,349 @@ +google.cloud.vmwareengine.v1.LoggingServer + */ +class LoggingServer extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this logging server. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. Fully-qualified domain name (FQDN) or IP Address of the logging + * server. + * + * Generated from protobuf field string hostname = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $hostname = ''; + /** + * Required. Port number at which the logging server receives logs. + * + * Generated from protobuf field int32 port = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $port = 0; + /** + * Required. Protocol used by vCenter to send logs to a logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.Protocol protocol = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $protocol = 0; + /** + * Required. The type of component that produces logs that will be forwarded + * to this logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.SourceType source_type = 10 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $source_type = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this logging server. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $hostname + * Required. Fully-qualified domain name (FQDN) or IP Address of the logging + * server. + * @type int $port + * Required. Port number at which the logging server receives logs. + * @type int $protocol + * Required. Protocol used by vCenter to send logs to a logging server. + * @type int $source_type + * Required. The type of component that produces logs that will be forwarded + * to this logging server. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this logging server. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this logging server. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. Fully-qualified domain name (FQDN) or IP Address of the logging + * server. + * + * Generated from protobuf field string hostname = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Required. Fully-qualified domain name (FQDN) or IP Address of the logging + * server. + * + * Generated from protobuf field string hostname = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setHostname($var) + { + GPBUtil::checkString($var, True); + $this->hostname = $var; + + return $this; + } + + /** + * Required. Port number at which the logging server receives logs. + * + * Generated from protobuf field int32 port = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPort() + { + return $this->port; + } + + /** + * Required. Port number at which the logging server receives logs. + * + * Generated from protobuf field int32 port = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPort($var) + { + GPBUtil::checkInt32($var); + $this->port = $var; + + return $this; + } + + /** + * Required. Protocol used by vCenter to send logs to a logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.Protocol protocol = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getProtocol() + { + return $this->protocol; + } + + /** + * Required. Protocol used by vCenter to send logs to a logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.Protocol protocol = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setProtocol($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\LoggingServer\Protocol::class); + $this->protocol = $var; + + return $this; + } + + /** + * Required. The type of component that produces logs that will be forwarded + * to this logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.SourceType source_type = 10 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * Required. The type of component that produces logs that will be forwarded + * to this logging server. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer.SourceType source_type = 10 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\LoggingServer\SourceType::class); + $this->source_type = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/Protocol.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/Protocol.php new file mode 100644 index 00000000000..053a8a06c30 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/Protocol.php @@ -0,0 +1,65 @@ +google.cloud.vmwareengine.v1.LoggingServer.Protocol + */ +class Protocol +{ + /** + * Unspecified communications protocol. This is the default value. + * + * Generated from protobuf enum PROTOCOL_UNSPECIFIED = 0; + */ + const PROTOCOL_UNSPECIFIED = 0; + /** + * UDP + * + * Generated from protobuf enum UDP = 1; + */ + const UDP = 1; + /** + * TCP + * + * Generated from protobuf enum TCP = 2; + */ + const TCP = 2; + + private static $valueToName = [ + self::PROTOCOL_UNSPECIFIED => 'PROTOCOL_UNSPECIFIED', + self::UDP => 'UDP', + self::TCP => 'TCP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Protocol::class, \Google\Cloud\VmwareEngine\V1\LoggingServer_Protocol::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/SourceType.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/SourceType.php new file mode 100644 index 00000000000..3c9f92ff659 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/LoggingServer/SourceType.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.LoggingServer.SourceType + */ +class SourceType +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum SOURCE_TYPE_UNSPECIFIED = 0; + */ + const SOURCE_TYPE_UNSPECIFIED = 0; + /** + * Logs produced by ESXI hosts + * + * Generated from protobuf enum ESXI = 1; + */ + const ESXI = 1; + /** + * Logs produced by vCenter server + * + * Generated from protobuf enum VCSA = 2; + */ + const VCSA = 2; + + private static $valueToName = [ + self::SOURCE_TYPE_UNSPECIFIED => 'SOURCE_TYPE_UNSPECIFIED', + self::ESXI => 'ESXI', + self::VCSA => 'VCSA', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SourceType::class, \Google\Cloud\VmwareEngine\V1\LoggingServer_SourceType::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding.php new file mode 100644 index 00000000000..d2a7a7f295a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding.php @@ -0,0 +1,370 @@ +google.cloud.vmwareengine.v1.ManagementDnsZoneBinding + */ +class ManagementDnsZoneBinding extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this binding. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 13; + */ + protected $description = ''; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + protected $bind_network; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this binding. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type int $state + * Output only. The state of the resource. + * @type string $description + * User-provided description for this resource. + * @type string $vpc_network + * Network to bind is a standard consumer VPC. + * Specify the name in the following form for consumer + * VPC network: `projects/{project}/global/networks/{network_id}`. + * `{project}` can either be a project number or a project ID. + * @type string $vmware_engine_network + * Network to bind is a VMware Engine network. + * Specify the name in the following form for VMware engine network: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * `{project}` can either be a project number or a project ID. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this binding. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this binding. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding\State::class); + $this->state = $var; + + return $this; + } + + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 13; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description for this resource. + * + * Generated from protobuf field string description = 13; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Network to bind is a standard consumer VPC. + * Specify the name in the following form for consumer + * VPC network: `projects/{project}/global/networks/{network_id}`. + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vpc_network = 14 [(.google.api.resource_reference) = { + * @return string + */ + public function getVpcNetwork() + { + return $this->readOneof(14); + } + + public function hasVpcNetwork() + { + return $this->hasOneof(14); + } + + /** + * Network to bind is a standard consumer VPC. + * Specify the name in the following form for consumer + * VPC network: `projects/{project}/global/networks/{network_id}`. + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vpc_network = 14 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVpcNetwork($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * Network to bind is a VMware Engine network. + * Specify the name in the following form for VMware engine network: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 15 [(.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetwork() + { + return $this->readOneof(15); + } + + public function hasVmwareEngineNetwork() + { + return $this->hasOneof(15); + } + + /** + * Network to bind is a VMware Engine network. + * Specify the name in the following form for VMware engine network: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 15 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * @return string + */ + public function getBindNetwork() + { + return $this->whichOneof("bind_network"); + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding/State.php new file mode 100644 index 00000000000..5b605adbdcb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ManagementDnsZoneBinding/State.php @@ -0,0 +1,86 @@ +google.cloud.vmwareengine.v1.ManagementDnsZoneBinding.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The binding is ready. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The binding is being created. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The binding is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The binding is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The binding has failed. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkConfig.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkConfig.php new file mode 100644 index 00000000000..60536fcd180 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkConfig.php @@ -0,0 +1,260 @@ +google.cloud.vmwareengine.v1.NetworkConfig + */ +class NetworkConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Management CIDR used by VMware management appliances. + * + * Generated from protobuf field string management_cidr = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_cidr = ''; + /** + * Optional. The relative resource name of the VMware Engine network attached + * to the private cloud. Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network = ''; + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network_canonical = ''; + /** + * Output only. The IP address layout version of the management IP address + * range. Possible versions include: + * * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address + * layout used by some existing private clouds. This is no longer supported + * for new private clouds as it does not support all features. + * * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address + * layout used by all newly created private clouds. This version supports all + * current features. + * + * Generated from protobuf field int32 management_ip_address_layout_version = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $management_ip_address_layout_version = 0; + /** + * Output only. DNS Server IP of the Private Cloud. + * All DNS queries can be forwarded to this address for name resolution of + * Private Cloud's management entities like vCenter, NSX-T Manager and + * ESXi hosts. + * + * Generated from protobuf field string dns_server_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $dns_server_ip = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $management_cidr + * Required. Management CIDR used by VMware management appliances. + * @type string $vmware_engine_network + * Optional. The relative resource name of the VMware Engine network attached + * to the private cloud. Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * @type string $vmware_engine_network_canonical + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * @type int $management_ip_address_layout_version + * Output only. The IP address layout version of the management IP address + * range. Possible versions include: + * * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address + * layout used by some existing private clouds. This is no longer supported + * for new private clouds as it does not support all features. + * * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address + * layout used by all newly created private clouds. This version supports all + * current features. + * @type string $dns_server_ip + * Output only. DNS Server IP of the Private Cloud. + * All DNS queries can be forwarded to this address for name resolution of + * Private Cloud's management entities like vCenter, NSX-T Manager and + * ESXi hosts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Management CIDR used by VMware management appliances. + * + * Generated from protobuf field string management_cidr = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getManagementCidr() + { + return $this->management_cidr; + } + + /** + * Required. Management CIDR used by VMware management appliances. + * + * Generated from protobuf field string management_cidr = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setManagementCidr($var) + { + GPBUtil::checkString($var, True); + $this->management_cidr = $var; + + return $this; + } + + /** + * Optional. The relative resource name of the VMware Engine network attached + * to the private cloud. Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + /** + * Optional. The relative resource name of the VMware Engine network attached + * to the private cloud. Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetworkCanonical() + { + return $this->vmware_engine_network_canonical; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetworkCanonical($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network_canonical = $var; + + return $this; + } + + /** + * Output only. The IP address layout version of the management IP address + * range. Possible versions include: + * * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address + * layout used by some existing private clouds. This is no longer supported + * for new private clouds as it does not support all features. + * * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address + * layout used by all newly created private clouds. This version supports all + * current features. + * + * Generated from protobuf field int32 management_ip_address_layout_version = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getManagementIpAddressLayoutVersion() + { + return $this->management_ip_address_layout_version; + } + + /** + * Output only. The IP address layout version of the management IP address + * range. Possible versions include: + * * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address + * layout used by some existing private clouds. This is no longer supported + * for new private clouds as it does not support all features. + * * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address + * layout used by all newly created private clouds. This version supports all + * current features. + * + * Generated from protobuf field int32 management_ip_address_layout_version = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setManagementIpAddressLayoutVersion($var) + { + GPBUtil::checkInt32($var); + $this->management_ip_address_layout_version = $var; + + return $this; + } + + /** + * Output only. DNS Server IP of the Private Cloud. + * All DNS queries can be forwarded to this address for name resolution of + * Private Cloud's management entities like vCenter, NSX-T Manager and + * ESXi hosts. + * + * Generated from protobuf field string dns_server_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDnsServerIp() + { + return $this->dns_server_ip; + } + + /** + * Output only. DNS Server IP of the Private Cloud. + * All DNS queries can be forwarded to this address for name resolution of + * Private Cloud's management entities like vCenter, NSX-T Manager and + * ESXi hosts. + * + * Generated from protobuf field string dns_server_ip = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDnsServerIp($var) + { + GPBUtil::checkString($var, True); + $this->dns_server_ip = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering.php new file mode 100644 index 00000000000..75600189db3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering.php @@ -0,0 +1,775 @@ +google.cloud.vmwareengine.v1.NetworkPeering + */ +class NetworkPeering extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the network peering. NetworkPeering is a + * global resource and location can only be global. Resource names are + * scheme-less URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. The relative resource name of the network to peer with + * a standard VMware Engine network. The provided network can be a + * consumer VPC network or another standard VMware Engine network. If the + * `peer_network_type` is VMWARE_ENGINE_NETWORK, specify the name in the form: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * Otherwise specify the name in the form: + * `projects/{project}/global/networks/{network_id}`, where + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string peer_network = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $peer_network = ''; + /** + * Optional. True if custom routes are exported to the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool export_custom_routes = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $export_custom_routes = null; + /** + * Optional. True if custom routes are imported from the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool import_custom_routes = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $import_custom_routes = null; + /** + * Optional. True if full mesh connectivity is created and managed + * automatically between peered networks; false otherwise. Currently this + * field is always true because Google Compute Engine automatically creates + * and manages subnetwork routes between two VPC networks when peering state + * is 'ACTIVE'. + * + * Generated from protobuf field optional bool exchange_subnet_routes = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $exchange_subnet_routes = null; + /** + * Optional. True if all subnet routes with a public IP address range are + * exported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * exported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool export_custom_routes_with_public_ip = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $export_custom_routes_with_public_ip = null; + /** + * Optional. True if all subnet routes with public IP address range are + * imported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * imported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool import_custom_routes_with_public_ip = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $import_custom_routes_with_public_ip = null; + /** + * Output only. State of the network peering. This field + * has a value of 'ACTIVE' when there's a matching configuration in the peer + * network. New values may be added to this enum when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Output Only. Details about the current state of the network + * peering. + * + * Generated from protobuf field string state_details = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_details = ''; + /** + * Optional. Maximum transmission unit (MTU) in bytes. + * The default value is `1500`. If a value of `0` is provided for this field, + * VMware Engine uses the default value instead. + * + * Generated from protobuf field int32 peer_mtu = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $peer_mtu = 0; + /** + * Required. The type of the network to peer with the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.PeerNetworkType peer_network_type = 16 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $peer_network_type = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Required. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 20 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network = ''; + /** + * Optional. User-provided description for this network peering. + * + * Generated from protobuf field string description = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the network peering. NetworkPeering is a + * global resource and location can only be global. Resource names are + * scheme-less URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $peer_network + * Required. The relative resource name of the network to peer with + * a standard VMware Engine network. The provided network can be a + * consumer VPC network or another standard VMware Engine network. If the + * `peer_network_type` is VMWARE_ENGINE_NETWORK, specify the name in the form: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * Otherwise specify the name in the form: + * `projects/{project}/global/networks/{network_id}`, where + * `{project}` can either be a project number or a project ID. + * @type bool $export_custom_routes + * Optional. True if custom routes are exported to the peered network; + * false otherwise. The default value is true. + * @type bool $import_custom_routes + * Optional. True if custom routes are imported from the peered network; + * false otherwise. The default value is true. + * @type bool $exchange_subnet_routes + * Optional. True if full mesh connectivity is created and managed + * automatically between peered networks; false otherwise. Currently this + * field is always true because Google Compute Engine automatically creates + * and manages subnetwork routes between two VPC networks when peering state + * is 'ACTIVE'. + * @type bool $export_custom_routes_with_public_ip + * Optional. True if all subnet routes with a public IP address range are + * exported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * exported to peers and are not controlled by this field. + * @type bool $import_custom_routes_with_public_ip + * Optional. True if all subnet routes with public IP address range are + * imported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * imported to peers and are not controlled by this field. + * @type int $state + * Output only. State of the network peering. This field + * has a value of 'ACTIVE' when there's a matching configuration in the peer + * network. New values may be added to this enum when appropriate. + * @type string $state_details + * Output only. Output Only. Details about the current state of the network + * peering. + * @type int $peer_mtu + * Optional. Maximum transmission unit (MTU) in bytes. + * The default value is `1500`. If a value of `0` is provided for this field, + * VMware Engine uses the default value instead. + * @type int $peer_network_type + * Required. The type of the network to peer with the VMware Engine network. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type string $vmware_engine_network + * Required. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * @type string $description + * Optional. User-provided description for this network peering. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the network peering. NetworkPeering is a + * global resource and location can only be global. Resource names are + * scheme-less URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the network peering. NetworkPeering is a + * global resource and location can only be global. Resource names are + * scheme-less URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. The relative resource name of the network to peer with + * a standard VMware Engine network. The provided network can be a + * consumer VPC network or another standard VMware Engine network. If the + * `peer_network_type` is VMWARE_ENGINE_NETWORK, specify the name in the form: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * Otherwise specify the name in the form: + * `projects/{project}/global/networks/{network_id}`, where + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string peer_network = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPeerNetwork() + { + return $this->peer_network; + } + + /** + * Required. The relative resource name of the network to peer with + * a standard VMware Engine network. The provided network can be a + * consumer VPC network or another standard VMware Engine network. If the + * `peer_network_type` is VMWARE_ENGINE_NETWORK, specify the name in the form: + * `projects/{project}/locations/global/vmwareEngineNetworks/{vmware_engine_network_id}`. + * Otherwise specify the name in the form: + * `projects/{project}/global/networks/{network_id}`, where + * `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string peer_network = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPeerNetwork($var) + { + GPBUtil::checkString($var, True); + $this->peer_network = $var; + + return $this; + } + + /** + * Optional. True if custom routes are exported to the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool export_custom_routes = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExportCustomRoutes() + { + return isset($this->export_custom_routes) ? $this->export_custom_routes : false; + } + + public function hasExportCustomRoutes() + { + return isset($this->export_custom_routes); + } + + public function clearExportCustomRoutes() + { + unset($this->export_custom_routes); + } + + /** + * Optional. True if custom routes are exported to the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool export_custom_routes = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExportCustomRoutes($var) + { + GPBUtil::checkBool($var); + $this->export_custom_routes = $var; + + return $this; + } + + /** + * Optional. True if custom routes are imported from the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool import_custom_routes = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getImportCustomRoutes() + { + return isset($this->import_custom_routes) ? $this->import_custom_routes : false; + } + + public function hasImportCustomRoutes() + { + return isset($this->import_custom_routes); + } + + public function clearImportCustomRoutes() + { + unset($this->import_custom_routes); + } + + /** + * Optional. True if custom routes are imported from the peered network; + * false otherwise. The default value is true. + * + * Generated from protobuf field optional bool import_custom_routes = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setImportCustomRoutes($var) + { + GPBUtil::checkBool($var); + $this->import_custom_routes = $var; + + return $this; + } + + /** + * Optional. True if full mesh connectivity is created and managed + * automatically between peered networks; false otherwise. Currently this + * field is always true because Google Compute Engine automatically creates + * and manages subnetwork routes between two VPC networks when peering state + * is 'ACTIVE'. + * + * Generated from protobuf field optional bool exchange_subnet_routes = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExchangeSubnetRoutes() + { + return isset($this->exchange_subnet_routes) ? $this->exchange_subnet_routes : false; + } + + public function hasExchangeSubnetRoutes() + { + return isset($this->exchange_subnet_routes); + } + + public function clearExchangeSubnetRoutes() + { + unset($this->exchange_subnet_routes); + } + + /** + * Optional. True if full mesh connectivity is created and managed + * automatically between peered networks; false otherwise. Currently this + * field is always true because Google Compute Engine automatically creates + * and manages subnetwork routes between two VPC networks when peering state + * is 'ACTIVE'. + * + * Generated from protobuf field optional bool exchange_subnet_routes = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExchangeSubnetRoutes($var) + { + GPBUtil::checkBool($var); + $this->exchange_subnet_routes = $var; + + return $this; + } + + /** + * Optional. True if all subnet routes with a public IP address range are + * exported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * exported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool export_custom_routes_with_public_ip = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExportCustomRoutesWithPublicIp() + { + return isset($this->export_custom_routes_with_public_ip) ? $this->export_custom_routes_with_public_ip : false; + } + + public function hasExportCustomRoutesWithPublicIp() + { + return isset($this->export_custom_routes_with_public_ip); + } + + public function clearExportCustomRoutesWithPublicIp() + { + unset($this->export_custom_routes_with_public_ip); + } + + /** + * Optional. True if all subnet routes with a public IP address range are + * exported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * exported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool export_custom_routes_with_public_ip = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExportCustomRoutesWithPublicIp($var) + { + GPBUtil::checkBool($var); + $this->export_custom_routes_with_public_ip = $var; + + return $this; + } + + /** + * Optional. True if all subnet routes with public IP address range are + * imported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * imported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool import_custom_routes_with_public_ip = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getImportCustomRoutesWithPublicIp() + { + return isset($this->import_custom_routes_with_public_ip) ? $this->import_custom_routes_with_public_ip : false; + } + + public function hasImportCustomRoutesWithPublicIp() + { + return isset($this->import_custom_routes_with_public_ip); + } + + public function clearImportCustomRoutesWithPublicIp() + { + unset($this->import_custom_routes_with_public_ip); + } + + /** + * Optional. True if all subnet routes with public IP address range are + * imported; false otherwise. The default value is true. IPv4 special-use + * ranges (https://en.wikipedia.org/wiki/IPv4#Special_addresses) are always + * imported to peers and are not controlled by this field. + * + * Generated from protobuf field optional bool import_custom_routes_with_public_ip = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setImportCustomRoutesWithPublicIp($var) + { + GPBUtil::checkBool($var); + $this->import_custom_routes_with_public_ip = $var; + + return $this; + } + + /** + * Output only. State of the network peering. This field + * has a value of 'ACTIVE' when there's a matching configuration in the peer + * network. New values may be added to this enum when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the network peering. This field + * has a value of 'ACTIVE' when there's a matching configuration in the peer + * network. New values may be added to this enum when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\NetworkPeering\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Output Only. Details about the current state of the network + * peering. + * + * Generated from protobuf field string state_details = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStateDetails() + { + return $this->state_details; + } + + /** + * Output only. Output Only. Details about the current state of the network + * peering. + * + * Generated from protobuf field string state_details = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStateDetails($var) + { + GPBUtil::checkString($var, True); + $this->state_details = $var; + + return $this; + } + + /** + * Optional. Maximum transmission unit (MTU) in bytes. + * The default value is `1500`. If a value of `0` is provided for this field, + * VMware Engine uses the default value instead. + * + * Generated from protobuf field int32 peer_mtu = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPeerMtu() + { + return $this->peer_mtu; + } + + /** + * Optional. Maximum transmission unit (MTU) in bytes. + * The default value is `1500`. If a value of `0` is provided for this field, + * VMware Engine uses the default value instead. + * + * Generated from protobuf field int32 peer_mtu = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPeerMtu($var) + { + GPBUtil::checkInt32($var); + $this->peer_mtu = $var; + + return $this; + } + + /** + * Required. The type of the network to peer with the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.PeerNetworkType peer_network_type = 16 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPeerNetworkType() + { + return $this->peer_network_type; + } + + /** + * Required. The type of the network to peer with the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering.PeerNetworkType peer_network_type = 16 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPeerNetworkType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\NetworkPeering\PeerNetworkType::class); + $this->peer_network_type = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Required. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 20 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + /** + * Required. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 20 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Optional. User-provided description for this network peering. + * + * Generated from protobuf field string description = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. User-provided description for this network peering. + * + * Generated from protobuf field string description = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/PeerNetworkType.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/PeerNetworkType.php new file mode 100644 index 00000000000..93d30dc2f3e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/PeerNetworkType.php @@ -0,0 +1,97 @@ +google.cloud.vmwareengine.v1.NetworkPeering.PeerNetworkType + */ +class PeerNetworkType +{ + /** + * Unspecified + * + * Generated from protobuf enum PEER_NETWORK_TYPE_UNSPECIFIED = 0; + */ + const PEER_NETWORK_TYPE_UNSPECIFIED = 0; + /** + * Peering connection used for connecting to another VPC network established + * by the same user. For example, a peering connection to another VPC + * network in the same project or to an on-premises network. + * + * Generated from protobuf enum STANDARD = 1; + */ + const STANDARD = 1; + /** + * Peering connection used for connecting to another VMware Engine network. + * + * Generated from protobuf enum VMWARE_ENGINE_NETWORK = 2; + */ + const VMWARE_ENGINE_NETWORK = 2; + /** + * Peering connection used for establishing [private services + * access](https://cloud.google.com/vpc/docs/private-services-access). + * + * Generated from protobuf enum PRIVATE_SERVICES_ACCESS = 3; + */ + const PRIVATE_SERVICES_ACCESS = 3; + /** + * Peering connection used for connecting to NetApp Cloud Volumes. + * + * Generated from protobuf enum NETAPP_CLOUD_VOLUMES = 4; + */ + const NETAPP_CLOUD_VOLUMES = 4; + /** + * Peering connection used for connecting to third-party services. Most + * third-party services require manual setup of reverse peering on the VPC + * network associated with the third-party service. + * + * Generated from protobuf enum THIRD_PARTY_SERVICE = 5; + */ + const THIRD_PARTY_SERVICE = 5; + /** + * Peering connection used for connecting to Dell PowerScale Filers + * + * Generated from protobuf enum DELL_POWERSCALE = 6; + */ + const DELL_POWERSCALE = 6; + + private static $valueToName = [ + self::PEER_NETWORK_TYPE_UNSPECIFIED => 'PEER_NETWORK_TYPE_UNSPECIFIED', + self::STANDARD => 'STANDARD', + self::VMWARE_ENGINE_NETWORK => 'VMWARE_ENGINE_NETWORK', + self::PRIVATE_SERVICES_ACCESS => 'PRIVATE_SERVICES_ACCESS', + self::NETAPP_CLOUD_VOLUMES => 'NETAPP_CLOUD_VOLUMES', + self::THIRD_PARTY_SERVICE => 'THIRD_PARTY_SERVICE', + self::DELL_POWERSCALE => 'DELL_POWERSCALE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PeerNetworkType::class, \Google\Cloud\VmwareEngine\V1\NetworkPeering_PeerNetworkType::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/State.php new file mode 100644 index 00000000000..0fa3a933fb0 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPeering/State.php @@ -0,0 +1,78 @@ +google.cloud.vmwareengine.v1.NetworkPeering.State + */ +class State +{ + /** + * Unspecified network peering state. This is the default value. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The peering is not active. + * + * Generated from protobuf enum INACTIVE = 1; + */ + const INACTIVE = 1; + /** + * The peering is active. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The peering is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The peering is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::INACTIVE => 'INACTIVE', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\NetworkPeering_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy.php new file mode 100644 index 00000000000..a0706a1327c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy.php @@ -0,0 +1,470 @@ +google.cloud.vmwareengine.v1.NetworkPolicy + */ +class NetworkPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this network policy. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Network service that allows VMware workloads to access the internet. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService internet_access = 6; + */ + protected $internet_access = null; + /** + * Network service that allows External IP addresses to be assigned to VMware + * workloads. This service can only be enabled when `internet_access` is also + * enabled. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService external_ip = 7; + */ + protected $external_ip = null; + /** + * Required. IP address range in CIDR notation used to create internet access + * and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is + * required. The range cannot overlap with any prefixes either in the consumer + * VPC network or in use by the private clouds attached to that VPC network. + * + * Generated from protobuf field string edge_services_cidr = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $edge_services_cidr = ''; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Optional. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network = ''; + /** + * Optional. User-provided description for this network policy. + * + * Generated from protobuf field string description = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network_canonical = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this network policy. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService $internet_access + * Network service that allows VMware workloads to access the internet. + * @type \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService $external_ip + * Network service that allows External IP addresses to be assigned to VMware + * workloads. This service can only be enabled when `internet_access` is also + * enabled. + * @type string $edge_services_cidr + * Required. IP address range in CIDR notation used to create internet access + * and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is + * required. The range cannot overlap with any prefixes either in the consumer + * VPC network or in use by the private clouds attached to that VPC network. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type string $vmware_engine_network + * Optional. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * @type string $description + * Optional. User-provided description for this network policy. + * @type string $vmware_engine_network_canonical + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this network policy. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this network policy. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Network service that allows VMware workloads to access the internet. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService internet_access = 6; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService|null + */ + public function getInternetAccess() + { + return $this->internet_access; + } + + public function hasInternetAccess() + { + return isset($this->internet_access); + } + + public function clearInternetAccess() + { + unset($this->internet_access); + } + + /** + * Network service that allows VMware workloads to access the internet. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService internet_access = 6; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService $var + * @return $this + */ + public function setInternetAccess($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService::class); + $this->internet_access = $var; + + return $this; + } + + /** + * Network service that allows External IP addresses to be assigned to VMware + * workloads. This service can only be enabled when `internet_access` is also + * enabled. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService external_ip = 7; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService|null + */ + public function getExternalIp() + { + return $this->external_ip; + } + + public function hasExternalIp() + { + return isset($this->external_ip); + } + + public function clearExternalIp() + { + unset($this->external_ip); + } + + /** + * Network service that allows External IP addresses to be assigned to VMware + * workloads. This service can only be enabled when `internet_access` is also + * enabled. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService external_ip = 7; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService $var + * @return $this + */ + public function setExternalIp($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService::class); + $this->external_ip = $var; + + return $this; + } + + /** + * Required. IP address range in CIDR notation used to create internet access + * and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is + * required. The range cannot overlap with any prefixes either in the consumer + * VPC network or in use by the private clouds attached to that VPC network. + * + * Generated from protobuf field string edge_services_cidr = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEdgeServicesCidr() + { + return $this->edge_services_cidr; + } + + /** + * Required. IP address range in CIDR notation used to create internet access + * and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is + * required. The range cannot overlap with any prefixes either in the consumer + * VPC network or in use by the private clouds attached to that VPC network. + * + * Generated from protobuf field string edge_services_cidr = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEdgeServicesCidr($var) + { + GPBUtil::checkString($var, True); + $this->edge_services_cidr = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Optional. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + /** + * Optional. The relative resource name of the VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}` can either be a project number or a project ID. + * + * Generated from protobuf field string vmware_engine_network = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Optional. User-provided description for this network policy. + * + * Generated from protobuf field string description = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. User-provided description for this network policy. + * + * Generated from protobuf field string description = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetworkCanonical() + { + return $this->vmware_engine_network_canonical; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetworkCanonical($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network_canonical = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService.php new file mode 100644 index 00000000000..7569a32d83b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService.php @@ -0,0 +1,112 @@ +google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService + */ +class NetworkService extends \Google\Protobuf\Internal\Message +{ + /** + * True if the service is enabled; false otherwise. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + /** + * Output only. State of the service. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * True if the service is enabled; false otherwise. + * @type int $state + * Output only. State of the service. New values may be added to this enum + * when appropriate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * True if the service is enabled; false otherwise. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * True if the service is enabled; false otherwise. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * Output only. State of the service. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the service. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\NetworkPolicy\NetworkService\State::class); + $this->state = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NetworkService::class, \Google\Cloud\VmwareEngine\V1\NetworkPolicy_NetworkService::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService/State.php new file mode 100644 index 00000000000..7254794bb49 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NetworkPolicy/NetworkService/State.php @@ -0,0 +1,72 @@ +google.cloud.vmwareengine.v1.NetworkPolicy.NetworkService.State + */ +class State +{ + /** + * Unspecified service state. This is the default value. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Service is not provisioned. + * + * Generated from protobuf enum UNPROVISIONED = 1; + */ + const UNPROVISIONED = 1; + /** + * Service is in the process of being provisioned/deprovisioned. + * + * Generated from protobuf enum RECONCILING = 2; + */ + const RECONCILING = 2; + /** + * Service is active. + * + * Generated from protobuf enum ACTIVE = 3; + */ + const ACTIVE = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::UNPROVISIONED => 'UNPROVISIONED', + self::RECONCILING => 'RECONCILING', + self::ACTIVE => 'ACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\NetworkPolicy_NetworkService_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node.php new file mode 100644 index 00000000000..7967bc524fb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node.php @@ -0,0 +1,299 @@ +google.cloud.vmwareengine.v1.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this node. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster/nodes/my-node + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Fully qualified domain name of the node. + * + * Generated from protobuf field string fqdn = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $fqdn = ''; + /** + * Output only. Internal IP address of the node. + * + * Generated from protobuf field string internal_ip = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $internal_ip = ''; + /** + * Output only. The canonical identifier of the node type (corresponds to the + * `NodeType`). + * For example: standard-72. + * + * Generated from protobuf field string node_type_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $node_type_id = ''; + /** + * Output only. The version number of the VMware ESXi + * management component in this cluster. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $version = ''; + /** + * Output only. Customized number of cores + * + * Generated from protobuf field int64 custom_core_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $custom_core_count = 0; + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Node.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this node. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster/nodes/my-node + * @type string $fqdn + * Output only. Fully qualified domain name of the node. + * @type string $internal_ip + * Output only. Internal IP address of the node. + * @type string $node_type_id + * Output only. The canonical identifier of the node type (corresponds to the + * `NodeType`). + * For example: standard-72. + * @type string $version + * Output only. The version number of the VMware ESXi + * management component in this cluster. + * @type int|string $custom_core_count + * Output only. Customized number of cores + * @type int $state + * Output only. The state of the appliance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this node. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster/nodes/my-node + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this node. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster/nodes/my-node + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Fully qualified domain name of the node. + * + * Generated from protobuf field string fqdn = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFqdn() + { + return $this->fqdn; + } + + /** + * Output only. Fully qualified domain name of the node. + * + * Generated from protobuf field string fqdn = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFqdn($var) + { + GPBUtil::checkString($var, True); + $this->fqdn = $var; + + return $this; + } + + /** + * Output only. Internal IP address of the node. + * + * Generated from protobuf field string internal_ip = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * Output only. Internal IP address of the node. + * + * Generated from protobuf field string internal_ip = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * Output only. The canonical identifier of the node type (corresponds to the + * `NodeType`). + * For example: standard-72. + * + * Generated from protobuf field string node_type_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNodeTypeId() + { + return $this->node_type_id; + } + + /** + * Output only. The canonical identifier of the node type (corresponds to the + * `NodeType`). + * For example: standard-72. + * + * Generated from protobuf field string node_type_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNodeTypeId($var) + { + GPBUtil::checkString($var, True); + $this->node_type_id = $var; + + return $this; + } + + /** + * Output only. The version number of the VMware ESXi + * management component in this cluster. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Output only. The version number of the VMware ESXi + * management component in this cluster. + * + * Generated from protobuf field string version = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Output only. Customized number of cores + * + * Generated from protobuf field int64 custom_core_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getCustomCoreCount() + { + return $this->custom_core_count; + } + + /** + * Output only. Customized number of cores + * + * Generated from protobuf field int64 custom_core_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setCustomCoreCount($var) + { + GPBUtil::checkInt64($var); + $this->custom_core_count = $var; + + return $this; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Node.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Node.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Node\State::class); + $this->state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node/State.php new file mode 100644 index 00000000000..3c40d2fd6ab --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Node/State.php @@ -0,0 +1,78 @@ +google.cloud.vmwareengine.v1.Node.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Node is operational and can be used by the user. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Node is being provisioned. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * Node is in a failed state. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * Node is undergoing maintenance, e.g.: during private cloud upgrade. + * + * Generated from protobuf enum UPGRADING = 4; + */ + const UPGRADING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::FAILED => 'FAILED', + self::UPGRADING => 'UPGRADING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Node_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType.php new file mode 100644 index 00000000000..dd6e532b2ef --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType.php @@ -0,0 +1,439 @@ +google.cloud.vmwareengine.v1.NodeType + */ +class NodeType extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this node type. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The canonical identifier of the node type + * (corresponds to the `NodeType`). For example: standard-72. + * + * Generated from protobuf field string node_type_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $node_type_id = ''; + /** + * Output only. The friendly name for this node type. + * For example: ve1-standard-72 + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Output only. The total number of virtual CPUs in a single node. + * + * Generated from protobuf field int32 virtual_cpu_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $virtual_cpu_count = 0; + /** + * Output only. The total number of CPU cores in a single node. + * + * Generated from protobuf field int32 total_core_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $total_core_count = 0; + /** + * Output only. The amount of physical memory available, defined in GB. + * + * Generated from protobuf field int32 memory_gb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $memory_gb = 0; + /** + * Output only. The amount of storage available, defined in GB. + * + * Generated from protobuf field int32 disk_size_gb = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $disk_size_gb = 0; + /** + * Output only. List of possible values of custom core count. + * + * Generated from protobuf field repeated int32 available_custom_core_counts = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $available_custom_core_counts; + /** + * Output only. The type of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NodeType.Kind kind = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $kind = 0; + /** + * Output only. Families of the node type. + * For node types to be in the same cluster + * they must share at least one element in the `families`. + * + * Generated from protobuf field repeated string families = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $families; + /** + * Output only. Capabilities of this node type. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType.Capability capabilities = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $capabilities; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this node type. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * @type string $node_type_id + * Output only. The canonical identifier of the node type + * (corresponds to the `NodeType`). For example: standard-72. + * @type string $display_name + * Output only. The friendly name for this node type. + * For example: ve1-standard-72 + * @type int $virtual_cpu_count + * Output only. The total number of virtual CPUs in a single node. + * @type int $total_core_count + * Output only. The total number of CPU cores in a single node. + * @type int $memory_gb + * Output only. The amount of physical memory available, defined in GB. + * @type int $disk_size_gb + * Output only. The amount of storage available, defined in GB. + * @type array|\Google\Protobuf\Internal\RepeatedField $available_custom_core_counts + * Output only. List of possible values of custom core count. + * @type int $kind + * Output only. The type of the resource. + * @type array|\Google\Protobuf\Internal\RepeatedField $families + * Output only. Families of the node type. + * For node types to be in the same cluster + * they must share at least one element in the `families`. + * @type array|\Google\Protobuf\Internal\RepeatedField $capabilities + * Output only. Capabilities of this node type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this node type. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this node type. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The canonical identifier of the node type + * (corresponds to the `NodeType`). For example: standard-72. + * + * Generated from protobuf field string node_type_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNodeTypeId() + { + return $this->node_type_id; + } + + /** + * Output only. The canonical identifier of the node type + * (corresponds to the `NodeType`). For example: standard-72. + * + * Generated from protobuf field string node_type_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNodeTypeId($var) + { + GPBUtil::checkString($var, True); + $this->node_type_id = $var; + + return $this; + } + + /** + * Output only. The friendly name for this node type. + * For example: ve1-standard-72 + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The friendly name for this node type. + * For example: ve1-standard-72 + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. The total number of virtual CPUs in a single node. + * + * Generated from protobuf field int32 virtual_cpu_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVirtualCpuCount() + { + return $this->virtual_cpu_count; + } + + /** + * Output only. The total number of virtual CPUs in a single node. + * + * Generated from protobuf field int32 virtual_cpu_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVirtualCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->virtual_cpu_count = $var; + + return $this; + } + + /** + * Output only. The total number of CPU cores in a single node. + * + * Generated from protobuf field int32 total_core_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getTotalCoreCount() + { + return $this->total_core_count; + } + + /** + * Output only. The total number of CPU cores in a single node. + * + * Generated from protobuf field int32 total_core_count = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setTotalCoreCount($var) + { + GPBUtil::checkInt32($var); + $this->total_core_count = $var; + + return $this; + } + + /** + * Output only. The amount of physical memory available, defined in GB. + * + * Generated from protobuf field int32 memory_gb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getMemoryGb() + { + return $this->memory_gb; + } + + /** + * Output only. The amount of physical memory available, defined in GB. + * + * Generated from protobuf field int32 memory_gb = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setMemoryGb($var) + { + GPBUtil::checkInt32($var); + $this->memory_gb = $var; + + return $this; + } + + /** + * Output only. The amount of storage available, defined in GB. + * + * Generated from protobuf field int32 disk_size_gb = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDiskSizeGb() + { + return $this->disk_size_gb; + } + + /** + * Output only. The amount of storage available, defined in GB. + * + * Generated from protobuf field int32 disk_size_gb = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDiskSizeGb($var) + { + GPBUtil::checkInt32($var); + $this->disk_size_gb = $var; + + return $this; + } + + /** + * Output only. List of possible values of custom core count. + * + * Generated from protobuf field repeated int32 available_custom_core_counts = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAvailableCustomCoreCounts() + { + return $this->available_custom_core_counts; + } + + /** + * Output only. List of possible values of custom core count. + * + * Generated from protobuf field repeated int32 available_custom_core_counts = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAvailableCustomCoreCounts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->available_custom_core_counts = $arr; + + return $this; + } + + /** + * Output only. The type of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NodeType.Kind kind = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Output only. The type of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NodeType.Kind kind = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\NodeType\Kind::class); + $this->kind = $var; + + return $this; + } + + /** + * Output only. Families of the node type. + * For node types to be in the same cluster + * they must share at least one element in the `families`. + * + * Generated from protobuf field repeated string families = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFamilies() + { + return $this->families; + } + + /** + * Output only. Families of the node type. + * For node types to be in the same cluster + * they must share at least one element in the `families`. + * + * Generated from protobuf field repeated string families = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFamilies($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->families = $arr; + + return $this; + } + + /** + * Output only. Capabilities of this node type. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType.Capability capabilities = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCapabilities() + { + return $this->capabilities; + } + + /** + * Output only. Capabilities of this node type. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.NodeType.Capability capabilities = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCapabilities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\VmwareEngine\V1\NodeType\Capability::class); + $this->capabilities = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Capability.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Capability.php new file mode 100644 index 00000000000..9bdcbad5679 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Capability.php @@ -0,0 +1,58 @@ +google.cloud.vmwareengine.v1.NodeType.Capability + */ +class Capability +{ + /** + * The default value. This value is used if the capability is omitted or + * unknown. + * + * Generated from protobuf enum CAPABILITY_UNSPECIFIED = 0; + */ + const CAPABILITY_UNSPECIFIED = 0; + /** + * This node type supports stretch clusters. + * + * Generated from protobuf enum STRETCHED_CLUSTERS = 1; + */ + const STRETCHED_CLUSTERS = 1; + + private static $valueToName = [ + self::CAPABILITY_UNSPECIFIED => 'CAPABILITY_UNSPECIFIED', + self::STRETCHED_CLUSTERS => 'STRETCHED_CLUSTERS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Capability::class, \Google\Cloud\VmwareEngine\V1\NodeType_Capability::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Kind.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Kind.php new file mode 100644 index 00000000000..303da1b4321 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeType/Kind.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.NodeType.Kind + */ +class Kind +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum KIND_UNSPECIFIED = 0; + */ + const KIND_UNSPECIFIED = 0; + /** + * Standard HCI node. + * + * Generated from protobuf enum STANDARD = 1; + */ + const STANDARD = 1; + /** + * Storage only Node. + * + * Generated from protobuf enum STORAGE_ONLY = 2; + */ + const STORAGE_ONLY = 2; + + private static $valueToName = [ + self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', + self::STANDARD => 'STANDARD', + self::STORAGE_ONLY => 'STORAGE_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Kind::class, \Google\Cloud\VmwareEngine\V1\NodeType_Kind::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeTypeConfig.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeTypeConfig.php new file mode 100644 index 00000000000..5308613bd05 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/NodeTypeConfig.php @@ -0,0 +1,113 @@ +google.cloud.vmwareengine.v1.NodeTypeConfig + */ +class NodeTypeConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The number of nodes of this type in the cluster + * + * Generated from protobuf field int32 node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $node_count = 0; + /** + * Optional. Customized number of cores available to each node of the type. + * This number must always be one of `nodeType.availableCustomCoreCounts`. + * If zero is provided max value from `nodeType.availableCustomCoreCounts` + * will be used. + * + * Generated from protobuf field int32 custom_core_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $custom_core_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $node_count + * Required. The number of nodes of this type in the cluster + * @type int $custom_core_count + * Optional. Customized number of cores available to each node of the type. + * This number must always be one of `nodeType.availableCustomCoreCounts`. + * If zero is provided max value from `nodeType.availableCustomCoreCounts` + * will be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The number of nodes of this type in the cluster + * + * Generated from protobuf field int32 node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getNodeCount() + { + return $this->node_count; + } + + /** + * Required. The number of nodes of this type in the cluster + * + * Generated from protobuf field int32 node_count = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->node_count = $var; + + return $this; + } + + /** + * Optional. Customized number of cores available to each node of the type. + * This number must always be one of `nodeType.availableCustomCoreCounts`. + * If zero is provided max value from `nodeType.availableCustomCoreCounts` + * will be used. + * + * Generated from protobuf field int32 custom_core_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCustomCoreCount() + { + return $this->custom_core_count; + } + + /** + * Optional. Customized number of cores available to each node of the type. + * This number must always be one of `nodeType.availableCustomCoreCounts`. + * If zero is provided max value from `nodeType.availableCustomCoreCounts` + * will be used. + * + * Generated from protobuf field int32 custom_core_count = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCustomCoreCount($var) + { + GPBUtil::checkInt32($var); + $this->custom_core_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx.php new file mode 100644 index 00000000000..21cfc707615 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx.php @@ -0,0 +1,169 @@ +google.cloud.vmwareengine.v1.Nsx + */ +class Nsx extends \Google\Protobuf\Internal\Message +{ + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + */ + protected $internal_ip = ''; + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + */ + protected $fqdn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $internal_ip + * Internal IP address of the appliance. + * @type string $version + * Version of the appliance. + * @type int $state + * Output only. The state of the appliance. + * @type string $fqdn + * Fully qualified domain name of the appliance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Nsx\State::class); + $this->state = $var; + + return $this; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @return string + */ + public function getFqdn() + { + return $this->fqdn; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @param string $var + * @return $this + */ + public function setFqdn($var) + { + GPBUtil::checkString($var, True); + $this->fqdn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx/State.php new file mode 100644 index 00000000000..768f7cb3f32 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Nsx/State.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.Nsx.State + */ +class State +{ + /** + * Unspecified appliance state. This is the default value. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The appliance is operational and can be used. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The appliance is being deployed. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Nsx_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/OperationMetadata.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/OperationMetadata.php new file mode 100644 index 00000000000..a520f27cb3e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/OperationMetadata.php @@ -0,0 +1,311 @@ +google.cloud.vmwareengine.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. True if the user has requested cancellation + * of the operation; false otherwise. + * Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. True if the user has requested cancellation + * of the operation; false otherwise. + * Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. True if the user has requested cancellation + * of the operation; false otherwise. + * Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. True if the user has requested cancellation + * of the operation; false otherwise. + * Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute.php new file mode 100644 index 00000000000..ed79b2063cd --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute.php @@ -0,0 +1,273 @@ +google.cloud.vmwareengine.v1.PeeringRoute + */ +class PeeringRoute extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Destination range of the peering route in CIDR notation. + * + * Generated from protobuf field string dest_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $dest_range = ''; + /** + * Output only. Type of the route in the peer VPC network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Type type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = 0; + /** + * Output only. Region containing the next hop of the peering route. This + * field only applies to dynamic routes in the peer VPC network. + * + * Generated from protobuf field string next_hop_region = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_hop_region = ''; + /** + * Output only. The priority of the peering route. + * + * Generated from protobuf field int64 priority = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $priority = 0; + /** + * Output only. True if the peering route has been imported from a peered + * VPC network; false otherwise. The import happens if the field + * `NetworkPeering.importCustomRoutes` is true for this network, + * `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and + * the import does not result in a route conflict. + * + * Generated from protobuf field bool imported = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $imported = false; + /** + * Output only. Direction of the routes exchanged with the peer network, from + * the VMware Engine network perspective: + * * Routes of direction `INCOMING` are imported from the peer network. + * * Routes of direction `OUTGOING` are exported from the intranet VPC network + * of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Direction direction = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $direction = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $dest_range + * Output only. Destination range of the peering route in CIDR notation. + * @type int $type + * Output only. Type of the route in the peer VPC network. + * @type string $next_hop_region + * Output only. Region containing the next hop of the peering route. This + * field only applies to dynamic routes in the peer VPC network. + * @type int|string $priority + * Output only. The priority of the peering route. + * @type bool $imported + * Output only. True if the peering route has been imported from a peered + * VPC network; false otherwise. The import happens if the field + * `NetworkPeering.importCustomRoutes` is true for this network, + * `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and + * the import does not result in a route conflict. + * @type int $direction + * Output only. Direction of the routes exchanged with the peer network, from + * the VMware Engine network perspective: + * * Routes of direction `INCOMING` are imported from the peer network. + * * Routes of direction `OUTGOING` are exported from the intranet VPC network + * of the VMware Engine network. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Destination range of the peering route in CIDR notation. + * + * Generated from protobuf field string dest_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDestRange() + { + return $this->dest_range; + } + + /** + * Output only. Destination range of the peering route in CIDR notation. + * + * Generated from protobuf field string dest_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDestRange($var) + { + GPBUtil::checkString($var, True); + $this->dest_range = $var; + + return $this; + } + + /** + * Output only. Type of the route in the peer VPC network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Type type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. Type of the route in the peer VPC network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Type type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PeeringRoute\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. Region containing the next hop of the peering route. This + * field only applies to dynamic routes in the peer VPC network. + * + * Generated from protobuf field string next_hop_region = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextHopRegion() + { + return $this->next_hop_region; + } + + /** + * Output only. Region containing the next hop of the peering route. This + * field only applies to dynamic routes in the peer VPC network. + * + * Generated from protobuf field string next_hop_region = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextHopRegion($var) + { + GPBUtil::checkString($var, True); + $this->next_hop_region = $var; + + return $this; + } + + /** + * Output only. The priority of the peering route. + * + * Generated from protobuf field int64 priority = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getPriority() + { + return $this->priority; + } + + /** + * Output only. The priority of the peering route. + * + * Generated from protobuf field int64 priority = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkInt64($var); + $this->priority = $var; + + return $this; + } + + /** + * Output only. True if the peering route has been imported from a peered + * VPC network; false otherwise. The import happens if the field + * `NetworkPeering.importCustomRoutes` is true for this network, + * `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and + * the import does not result in a route conflict. + * + * Generated from protobuf field bool imported = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getImported() + { + return $this->imported; + } + + /** + * Output only. True if the peering route has been imported from a peered + * VPC network; false otherwise. The import happens if the field + * `NetworkPeering.importCustomRoutes` is true for this network, + * `NetworkPeering.exportCustomRoutes` is true for the peer VPC network, and + * the import does not result in a route conflict. + * + * Generated from protobuf field bool imported = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setImported($var) + { + GPBUtil::checkBool($var); + $this->imported = $var; + + return $this; + } + + /** + * Output only. Direction of the routes exchanged with the peer network, from + * the VMware Engine network perspective: + * * Routes of direction `INCOMING` are imported from the peer network. + * * Routes of direction `OUTGOING` are exported from the intranet VPC network + * of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Direction direction = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDirection() + { + return $this->direction; + } + + /** + * Output only. Direction of the routes exchanged with the peer network, from + * the VMware Engine network perspective: + * * Routes of direction `INCOMING` are imported from the peer network. + * * Routes of direction `OUTGOING` are exported from the intranet VPC network + * of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PeeringRoute.Direction direction = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDirection($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PeeringRoute\Direction::class); + $this->direction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Direction.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Direction.php new file mode 100644 index 00000000000..ca4028e3774 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Direction.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.PeeringRoute.Direction + */ +class Direction +{ + /** + * Unspecified exchanged routes direction. This is default. + * + * Generated from protobuf enum DIRECTION_UNSPECIFIED = 0; + */ + const DIRECTION_UNSPECIFIED = 0; + /** + * Routes imported from the peer network. + * + * Generated from protobuf enum INCOMING = 1; + */ + const INCOMING = 1; + /** + * Routes exported to the peer network. + * + * Generated from protobuf enum OUTGOING = 2; + */ + const OUTGOING = 2; + + private static $valueToName = [ + self::DIRECTION_UNSPECIFIED => 'DIRECTION_UNSPECIFIED', + self::INCOMING => 'INCOMING', + self::OUTGOING => 'OUTGOING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Direction::class, \Google\Cloud\VmwareEngine\V1\PeeringRoute_Direction::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Type.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Type.php new file mode 100644 index 00000000000..cda62b924e8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PeeringRoute/Type.php @@ -0,0 +1,72 @@ +google.cloud.vmwareengine.v1.PeeringRoute.Type + */ +class Type +{ + /** + * Unspecified peering route type. This is the default value. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Dynamic routes in the peer network. + * + * Generated from protobuf enum DYNAMIC_PEERING_ROUTE = 1; + */ + const DYNAMIC_PEERING_ROUTE = 1; + /** + * Static routes in the peer network. + * + * Generated from protobuf enum STATIC_PEERING_ROUTE = 2; + */ + const STATIC_PEERING_ROUTE = 2; + /** + * Created, updated, and removed automatically by Google Cloud when subnets + * are created, modified, or deleted in the peer network. + * + * Generated from protobuf enum SUBNET_PEERING_ROUTE = 3; + */ + const SUBNET_PEERING_ROUTE = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::DYNAMIC_PEERING_ROUTE => 'DYNAMIC_PEERING_ROUTE', + self::STATIC_PEERING_ROUTE => 'STATIC_PEERING_ROUTE', + self::SUBNET_PEERING_ROUTE => 'SUBNET_PEERING_ROUTE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VmwareEngine\V1\PeeringRoute_Type::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Principal.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Principal.php new file mode 100644 index 00000000000..5b096e7b45d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Principal.php @@ -0,0 +1,109 @@ +google.cloud.vmwareengine.v1.Principal + */ +class Principal extends \Google\Protobuf\Internal\Message +{ + protected $principal; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $user + * The user who needs to be granted permission. + * @type string $service_account + * The service account which needs to be granted the permission. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * The user who needs to be granted permission. + * + * Generated from protobuf field string user = 1; + * @return string + */ + public function getUser() + { + return $this->readOneof(1); + } + + public function hasUser() + { + return $this->hasOneof(1); + } + + /** + * The user who needs to be granted permission. + * + * Generated from protobuf field string user = 1; + * @param string $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The service account which needs to be granted the permission. + * + * Generated from protobuf field string service_account = 2; + * @return string + */ + public function getServiceAccount() + { + return $this->readOneof(2); + } + + public function hasServiceAccount() + { + return $this->hasOneof(2); + } + + /** + * The service account which needs to be granted the permission. + * + * Generated from protobuf field string service_account = 2; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getPrincipal() + { + return $this->whichOneof("principal"); + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud.php new file mode 100644 index 00000000000..1e778c35400 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud.php @@ -0,0 +1,637 @@ +google.cloud.vmwareengine.v1.PrivateCloud + */ +class PrivateCloud extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this private cloud. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Time when the resource was scheduled for deletion. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Output only. Time when the resource will be irreversibly deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expire_time = null; + /** + * Output only. State of the resource. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. Network configuration of the private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkConfig network_config = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_config = null; + /** + * Required. Input only. The management cluster for this private cloud. + * This field is required during creation of the private cloud to provide + * details for the default cluster. + * The following fields can't be changed after private cloud creation: + * `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.ManagementCluster management_cluster = 10 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = REQUIRED]; + */ + protected $management_cluster = null; + /** + * User-provided description for this private cloud. + * + * Generated from protobuf field string description = 11; + */ + protected $description = ''; + /** + * Output only. HCX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx hcx = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $hcx = null; + /** + * Output only. NSX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx nsx = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $nsx = null; + /** + * Output only. Vcenter appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter vcenter = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $vcenter = null; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Optional. Type of the private cloud. Defaults to STANDARD. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.Type type = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this private cloud. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Time when the resource was scheduled for deletion. + * @type \Google\Protobuf\Timestamp $expire_time + * Output only. Time when the resource will be irreversibly deleted. + * @type int $state + * Output only. State of the resource. New values may be added to this enum + * when appropriate. + * @type \Google\Cloud\VmwareEngine\V1\NetworkConfig $network_config + * Required. Network configuration of the private cloud. + * @type \Google\Cloud\VmwareEngine\V1\PrivateCloud\ManagementCluster $management_cluster + * Required. Input only. The management cluster for this private cloud. + * This field is required during creation of the private cloud to provide + * details for the default cluster. + * The following fields can't be changed after private cloud creation: + * `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. + * @type string $description + * User-provided description for this private cloud. + * @type \Google\Cloud\VmwareEngine\V1\Hcx $hcx + * Output only. HCX appliance. + * @type \Google\Cloud\VmwareEngine\V1\Nsx $nsx + * Output only. NSX appliance. + * @type \Google\Cloud\VmwareEngine\V1\Vcenter $vcenter + * Output only. Vcenter appliance. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type int $type + * Optional. Type of the private cloud. Defaults to STANDARD. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this private cloud. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this private cloud. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. Time when the resource was scheduled for deletion. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Time when the resource was scheduled for deletion. + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Output only. Time when the resource will be irreversibly deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Output only. Time when the resource will be irreversibly deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Output only. State of the resource. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the resource. New values may be added to this enum + * when appropriate. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateCloud\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. Network configuration of the private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkConfig network_config = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\NetworkConfig|null + */ + public function getNetworkConfig() + { + return $this->network_config; + } + + public function hasNetworkConfig() + { + return isset($this->network_config); + } + + public function clearNetworkConfig() + { + unset($this->network_config); + } + + /** + * Required. Network configuration of the private cloud. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkConfig network_config = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\NetworkConfig $var + * @return $this + */ + public function setNetworkConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkConfig::class); + $this->network_config = $var; + + return $this; + } + + /** + * Required. Input only. The management cluster for this private cloud. + * This field is required during creation of the private cloud to provide + * details for the default cluster. + * The following fields can't be changed after private cloud creation: + * `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.ManagementCluster management_cluster = 10 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\PrivateCloud\ManagementCluster|null + */ + public function getManagementCluster() + { + return $this->management_cluster; + } + + public function hasManagementCluster() + { + return isset($this->management_cluster); + } + + public function clearManagementCluster() + { + unset($this->management_cluster); + } + + /** + * Required. Input only. The management cluster for this private cloud. + * This field is required during creation of the private cloud to provide + * details for the default cluster. + * The following fields can't be changed after private cloud creation: + * `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.ManagementCluster management_cluster = 10 [(.google.api.field_behavior) = INPUT_ONLY, (.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud\ManagementCluster $var + * @return $this + */ + public function setManagementCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\PrivateCloud\ManagementCluster::class); + $this->management_cluster = $var; + + return $this; + } + + /** + * User-provided description for this private cloud. + * + * Generated from protobuf field string description = 11; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description for this private cloud. + * + * Generated from protobuf field string description = 11; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. HCX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx hcx = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VmwareEngine\V1\Hcx|null + */ + public function getHcx() + { + return $this->hcx; + } + + public function hasHcx() + { + return isset($this->hcx); + } + + public function clearHcx() + { + unset($this->hcx); + } + + /** + * Output only. HCX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Hcx hcx = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VmwareEngine\V1\Hcx $var + * @return $this + */ + public function setHcx($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Hcx::class); + $this->hcx = $var; + + return $this; + } + + /** + * Output only. NSX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx nsx = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VmwareEngine\V1\Nsx|null + */ + public function getNsx() + { + return $this->nsx; + } + + public function hasNsx() + { + return isset($this->nsx); + } + + public function clearNsx() + { + unset($this->nsx); + } + + /** + * Output only. NSX appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Nsx nsx = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VmwareEngine\V1\Nsx $var + * @return $this + */ + public function setNsx($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Nsx::class); + $this->nsx = $var; + + return $this; + } + + /** + * Output only. Vcenter appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter vcenter = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\VmwareEngine\V1\Vcenter|null + */ + public function getVcenter() + { + return $this->vcenter; + } + + public function hasVcenter() + { + return isset($this->vcenter); + } + + public function clearVcenter() + { + unset($this->vcenter); + } + + /** + * Output only. Vcenter appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter vcenter = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\VmwareEngine\V1\Vcenter $var + * @return $this + */ + public function setVcenter($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Vcenter::class); + $this->vcenter = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Optional. Type of the private cloud. Defaults to STANDARD. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.Type type = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. Type of the private cloud. Defaults to STANDARD. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud.Type type = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateCloud\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/ManagementCluster.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/ManagementCluster.php new file mode 100644 index 00000000000..df6000361aa --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/ManagementCluster.php @@ -0,0 +1,184 @@ +google.cloud.vmwareengine.v1.PrivateCloud.ManagementCluster + */ +class ManagementCluster extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user-provided identifier of the new `Cluster`. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC + * 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) + * + * Generated from protobuf field string cluster_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $node_type_configs; + /** + * Optional. Configuration of a stretched cluster. Required for STRETCHED + * private clouds. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $stretched_cluster_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cluster_id + * Required. The user-provided identifier of the new `Cluster`. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC + * 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) + * @type array|\Google\Protobuf\Internal\MapField $node_type_configs + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * @type \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig $stretched_cluster_config + * Optional. Configuration of a stretched cluster. Required for STRETCHED + * private clouds. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user-provided identifier of the new `Cluster`. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC + * 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) + * + * Generated from protobuf field string cluster_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. The user-provided identifier of the new `Cluster`. + * The identifier must meet the following requirements: + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC + * 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5) + * + * Generated from protobuf field string cluster_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getNodeTypeConfigs() + { + return $this->node_type_configs; + } + + /** + * Required. The map of cluster node types in this cluster, where the key is + * canonical identifier of the node type (corresponds to the `NodeType`). + * + * Generated from protobuf field map node_type_configs = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setNodeTypeConfigs($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\NodeTypeConfig::class); + $this->node_type_configs = $arr; + + return $this; + } + + /** + * Optional. Configuration of a stretched cluster. Required for STRETCHED + * private clouds. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig|null + */ + public function getStretchedClusterConfig() + { + return $this->stretched_cluster_config; + } + + public function hasStretchedClusterConfig() + { + return isset($this->stretched_cluster_config); + } + + public function clearStretchedClusterConfig() + { + unset($this->stretched_cluster_config); + } + + /** + * Optional. Configuration of a stretched cluster. Required for STRETCHED + * private clouds. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.StretchedClusterConfig stretched_cluster_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig $var + * @return $this + */ + public function setStretchedClusterConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\StretchedClusterConfig::class); + $this->stretched_cluster_config = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ManagementCluster::class, \Google\Cloud\VmwareEngine\V1\PrivateCloud_ManagementCluster::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/State.php new file mode 100644 index 00000000000..d7c021d20ae --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/State.php @@ -0,0 +1,94 @@ +google.cloud.vmwareengine.v1.PrivateCloud.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The private cloud is ready. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The private cloud is being created. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The private cloud is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The private cloud is in failed state. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * The private cloud is scheduled for deletion. The deletion process can be + * cancelled by using the corresponding undelete method. + * + * Generated from protobuf enum DELETED = 6; + */ + const DELETED = 6; + /** + * The private cloud is irreversibly deleted and is being removed from the + * system. + * + * Generated from protobuf enum PURGING = 7; + */ + const PURGING = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::FAILED => 'FAILED', + self::DELETED => 'DELETED', + self::PURGING => 'PURGING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\PrivateCloud_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/Type.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/Type.php new file mode 100644 index 00000000000..2b7257917ef --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateCloud/Type.php @@ -0,0 +1,68 @@ +google.cloud.vmwareengine.v1.PrivateCloud.Type + */ +class Type +{ + /** + * Standard private is a zonal resource, with 3+ nodes. Default type. + * + * Generated from protobuf enum STANDARD = 0; + */ + const STANDARD = 0; + /** + * Time limited private cloud is a zonal resource, can have only 1 node and + * has limited life span. Will be deleted after defined period of time, + * can be converted into standard private cloud by expanding it up to 3 + * or more nodes. + * + * Generated from protobuf enum TIME_LIMITED = 1; + */ + const TIME_LIMITED = 1; + /** + * Stretched private cloud is a regional resource with redundancy, + * with a minimum of 6 nodes, nodes count has to be even. + * + * Generated from protobuf enum STRETCHED = 2; + */ + const STRETCHED = 2; + + private static $valueToName = [ + self::STANDARD => 'STANDARD', + self::TIME_LIMITED => 'TIME_LIMITED', + self::STRETCHED => 'STRETCHED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VmwareEngine\V1\PrivateCloud_Type::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection.php new file mode 100644 index 00000000000..c68b2badfa6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection.php @@ -0,0 +1,604 @@ +google.cloud.vmwareengine.v1.PrivateConnection + */ +class PrivateConnection extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the private connection. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. User-provided description for this private connection. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. State of the private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. The relative resource name of Legacy VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}`, `{location}` will be same as specified in private + * connection resource name and `{vmware_engine_network_id}` will be in the + * form of `{location}`-default e.g. + * projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. + * + * Generated from protobuf field string vmware_engine_network = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network = ''; + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 9 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $vmware_engine_network_canonical = ''; + /** + * Required. Private connection type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.Type type = 10 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Output only. VPC network peering id between given network VPC and + * VMwareEngineNetwork. + * + * Generated from protobuf field string peering_id = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $peering_id = ''; + /** + * Optional. Routing Mode. + * Default value is set to GLOBAL. + * For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or + * REGIONAL, for other types only GLOBAL is supported. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.RoutingMode routing_mode = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $routing_mode = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Required. Service network to create private connection. + * Specify the name in the following form: + * `projects/{project}/global/networks/{network_id}` + * For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking + * VPC, e.g. projects/project-tp/global/networks/servicenetworking. + * For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, + * e.g. projects/project-tp/global/networks/netapp-tenant-vpc. + * For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. + * projects/project-tp/global/networks/dell-tenant-vpc. + * For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or + * any other producer VPC to which the VMware Engine Network needs to be + * connected, e.g. projects/project/global/networks/vpc. + * + * Generated from protobuf field string service_network = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service_network = ''; + /** + * Output only. Peering state between service network and VMware Engine + * network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.PeeringState peering_state = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $peering_state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the private connection. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $description + * Optional. User-provided description for this private connection. + * @type int $state + * Output only. State of the private connection. + * @type string $vmware_engine_network + * Required. The relative resource name of Legacy VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}`, `{location}` will be same as specified in private + * connection resource name and `{vmware_engine_network_id}` will be in the + * form of `{location}`-default e.g. + * projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. + * @type string $vmware_engine_network_canonical + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * @type int $type + * Required. Private connection type. + * @type string $peering_id + * Output only. VPC network peering id between given network VPC and + * VMwareEngineNetwork. + * @type int $routing_mode + * Optional. Routing Mode. + * Default value is set to GLOBAL. + * For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or + * REGIONAL, for other types only GLOBAL is supported. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type string $service_network + * Required. Service network to create private connection. + * Specify the name in the following form: + * `projects/{project}/global/networks/{network_id}` + * For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking + * VPC, e.g. projects/project-tp/global/networks/servicenetworking. + * For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, + * e.g. projects/project-tp/global/networks/netapp-tenant-vpc. + * For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. + * projects/project-tp/global/networks/dell-tenant-vpc. + * For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or + * any other producer VPC to which the VMware Engine Network needs to be + * connected, e.g. projects/project/global/networks/vpc. + * @type int $peering_state + * Output only. Peering state between service network and VMware Engine + * network. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the private connection. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the private connection. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. User-provided description for this private connection. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. User-provided description for this private connection. + * + * Generated from protobuf field string description = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. State of the private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the private connection. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The relative resource name of Legacy VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}`, `{location}` will be same as specified in private + * connection resource name and `{vmware_engine_network_id}` will be in the + * form of `{location}`-default e.g. + * projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. + * + * Generated from protobuf field string vmware_engine_network = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + /** + * Required. The relative resource name of Legacy VMware Engine network. + * Specify the name in the following form: + * `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * where `{project}`, `{location}` will be same as specified in private + * connection resource name and `{vmware_engine_network_id}` will be in the + * form of `{location}`-default e.g. + * projects/project/locations/us-central1/vmwareEngineNetworks/us-central1-default. + * + * Generated from protobuf field string vmware_engine_network = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 9 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getVmwareEngineNetworkCanonical() + { + return $this->vmware_engine_network_canonical; + } + + /** + * Output only. The canonical name of the VMware Engine network in the form: + * `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}` + * + * Generated from protobuf field string vmware_engine_network_canonical = 9 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVmwareEngineNetworkCanonical($var) + { + GPBUtil::checkString($var, True); + $this->vmware_engine_network_canonical = $var; + + return $this; + } + + /** + * Required. Private connection type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.Type type = 10 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. Private connection type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.Type type = 10 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. VPC network peering id between given network VPC and + * VMwareEngineNetwork. + * + * Generated from protobuf field string peering_id = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPeeringId() + { + return $this->peering_id; + } + + /** + * Output only. VPC network peering id between given network VPC and + * VMwareEngineNetwork. + * + * Generated from protobuf field string peering_id = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPeeringId($var) + { + GPBUtil::checkString($var, True); + $this->peering_id = $var; + + return $this; + } + + /** + * Optional. Routing Mode. + * Default value is set to GLOBAL. + * For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or + * REGIONAL, for other types only GLOBAL is supported. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.RoutingMode routing_mode = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getRoutingMode() + { + return $this->routing_mode; + } + + /** + * Optional. Routing Mode. + * Default value is set to GLOBAL. + * For type = PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or + * REGIONAL, for other types only GLOBAL is supported. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.RoutingMode routing_mode = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setRoutingMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection\RoutingMode::class); + $this->routing_mode = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Required. Service network to create private connection. + * Specify the name in the following form: + * `projects/{project}/global/networks/{network_id}` + * For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking + * VPC, e.g. projects/project-tp/global/networks/servicenetworking. + * For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, + * e.g. projects/project-tp/global/networks/netapp-tenant-vpc. + * For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. + * projects/project-tp/global/networks/dell-tenant-vpc. + * For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or + * any other producer VPC to which the VMware Engine Network needs to be + * connected, e.g. projects/project/global/networks/vpc. + * + * Generated from protobuf field string service_network = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getServiceNetwork() + { + return $this->service_network; + } + + /** + * Required. Service network to create private connection. + * Specify the name in the following form: + * `projects/{project}/global/networks/{network_id}` + * For type = PRIVATE_SERVICE_ACCESS, this field represents servicenetworking + * VPC, e.g. projects/project-tp/global/networks/servicenetworking. + * For type = NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC, + * e.g. projects/project-tp/global/networks/netapp-tenant-vpc. + * For type = DELL_POWERSCALE, this field represent Dell service VPC, e.g. + * projects/project-tp/global/networks/dell-tenant-vpc. + * For type= THIRD_PARTY_SERVICE, this field could represent a consumer VPC or + * any other producer VPC to which the VMware Engine Network needs to be + * connected, e.g. projects/project/global/networks/vpc. + * + * Generated from protobuf field string service_network = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServiceNetwork($var) + { + GPBUtil::checkString($var, True); + $this->service_network = $var; + + return $this; + } + + /** + * Output only. Peering state between service network and VMware Engine + * network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.PeeringState peering_state = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getPeeringState() + { + return $this->peering_state; + } + + /** + * Output only. Peering state between service network and VMware Engine + * network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection.PeeringState peering_state = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setPeeringState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection\PeeringState::class); + $this->peering_state = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/PeeringState.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/PeeringState.php new file mode 100644 index 00000000000..d35b801f864 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/PeeringState.php @@ -0,0 +1,66 @@ +google.cloud.vmwareengine.v1.PrivateConnection.PeeringState + */ +class PeeringState +{ + /** + * The default value. This value is used if the peering state is omitted or + * unknown. + * + * Generated from protobuf enum PEERING_STATE_UNSPECIFIED = 0; + */ + const PEERING_STATE_UNSPECIFIED = 0; + /** + * The peering is in active state. + * + * Generated from protobuf enum PEERING_ACTIVE = 1; + */ + const PEERING_ACTIVE = 1; + /** + * The peering is in inactive state. + * + * Generated from protobuf enum PEERING_INACTIVE = 2; + */ + const PEERING_INACTIVE = 2; + + private static $valueToName = [ + self::PEERING_STATE_UNSPECIFIED => 'PEERING_STATE_UNSPECIFIED', + self::PEERING_ACTIVE => 'PEERING_ACTIVE', + self::PEERING_INACTIVE => 'PEERING_INACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PeeringState::class, \Google\Cloud\VmwareEngine\V1\PrivateConnection_PeeringState::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/RoutingMode.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/RoutingMode.php new file mode 100644 index 00000000000..2642d234cce --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/RoutingMode.php @@ -0,0 +1,68 @@ +google.cloud.vmwareengine.v1.PrivateConnection.RoutingMode + */ +class RoutingMode +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum ROUTING_MODE_UNSPECIFIED = 0; + */ + const ROUTING_MODE_UNSPECIFIED = 0; + /** + * Global Routing Mode + * + * Generated from protobuf enum GLOBAL = 1; + */ + const PBGLOBAL = 1; + /** + * Regional Routing Mode + * + * Generated from protobuf enum REGIONAL = 2; + */ + const REGIONAL = 2; + + private static $valueToName = [ + self::ROUTING_MODE_UNSPECIFIED => 'ROUTING_MODE_UNSPECIFIED', + self::PBGLOBAL => 'GLOBAL', + self::REGIONAL => 'REGIONAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RoutingMode::class, \Google\Cloud\VmwareEngine\V1\PrivateConnection_RoutingMode::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/State.php new file mode 100644 index 00000000000..dff8d99aa8f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/State.php @@ -0,0 +1,93 @@ +google.cloud.vmwareengine.v1.PrivateConnection.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The private connection is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The private connection is ready. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The private connection is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The private connection is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The private connection is not provisioned, since no private cloud is + * present for which this private connection is needed. + * + * Generated from protobuf enum UNPROVISIONED = 5; + */ + const UNPROVISIONED = 5; + /** + * The private connection is in failed state. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::UNPROVISIONED => 'UNPROVISIONED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\PrivateConnection_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/Type.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/Type.php new file mode 100644 index 00000000000..d1b00632a38 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/PrivateConnection/Type.php @@ -0,0 +1,79 @@ +google.cloud.vmwareengine.v1.PrivateConnection.Type + */ +class Type +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Connection used for establishing [private services + * access](https://cloud.google.com/vpc/docs/private-services-access). + * + * Generated from protobuf enum PRIVATE_SERVICE_ACCESS = 1; + */ + const PRIVATE_SERVICE_ACCESS = 1; + /** + * Connection used for connecting to NetApp Cloud Volumes. + * + * Generated from protobuf enum NETAPP_CLOUD_VOLUMES = 2; + */ + const NETAPP_CLOUD_VOLUMES = 2; + /** + * Connection used for connecting to Dell PowerScale. + * + * Generated from protobuf enum DELL_POWERSCALE = 3; + */ + const DELL_POWERSCALE = 3; + /** + * Connection used for connecting to third-party services. + * + * Generated from protobuf enum THIRD_PARTY_SERVICE = 4; + */ + const THIRD_PARTY_SERVICE = 4; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::PRIVATE_SERVICE_ACCESS => 'PRIVATE_SERVICE_ACCESS', + self::NETAPP_CLOUD_VOLUMES => 'NETAPP_CLOUD_VOLUMES', + self::DELL_POWERSCALE => 'DELL_POWERSCALE', + self::THIRD_PARTY_SERVICE => 'THIRD_PARTY_SERVICE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VmwareEngine\V1\PrivateConnection_Type::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RepairManagementDnsZoneBindingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RepairManagementDnsZoneBindingRequest.php new file mode 100644 index 00000000000..b438309f8d3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RepairManagementDnsZoneBindingRequest.php @@ -0,0 +1,179 @@ +google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest + */ +class RepairManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * Please see {@see VmwareEngineClient::managementDnsZoneBindingName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\RepairManagementDnsZoneBindingRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetNsxCredentialsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetNsxCredentialsRequest.php new file mode 100644 index 00000000000..9da98020007 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetNsxCredentialsRequest.php @@ -0,0 +1,185 @@ +google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest + */ +class ResetNsxCredentialsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $private_cloud = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $privateCloud Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ResetNsxCredentialsRequest + * + * @experimental + */ + public static function build(string $privateCloud): self + { + return (new self()) + ->setPrivateCloud($privateCloud); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_cloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkString($var, True); + $this->private_cloud = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetVcenterCredentialsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetVcenterCredentialsRequest.php new file mode 100644 index 00000000000..a39d63627f2 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ResetVcenterCredentialsRequest.php @@ -0,0 +1,251 @@ +google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest + */ +class ResetVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $private_cloud = ''; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $username = ''; + + /** + * @param string $privateCloud Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ResetVcenterCredentialsRequest + * + * @experimental + */ + public static function build(string $privateCloud): self + { + return (new self()) + ->setPrivateCloud($privateCloud); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_cloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $username + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + /** + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkString($var, True); + $this->private_cloud = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RevokeDnsBindPermissionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RevokeDnsBindPermissionRequest.php new file mode 100644 index 00000000000..564092bc2a7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/RevokeDnsBindPermissionRequest.php @@ -0,0 +1,241 @@ +google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest + */ +class RevokeDnsBindPermissionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $principal = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * Please see {@see VmwareEngineClient::dnsBindPermissionName()} for help formatting this field. + * @param \Google\Cloud\VmwareEngine\V1\Principal $principal Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * @return \Google\Cloud\VmwareEngine\V1\RevokeDnsBindPermissionRequest + * + * @experimental + */ + public static function build(string $name, \Google\Cloud\VmwareEngine\V1\Principal $principal): self + { + return (new self()) + ->setName($name) + ->setPrincipal($principal); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @type \Google\Cloud\VmwareEngine\V1\Principal $principal + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\Principal|null + */ + public function getPrincipal() + { + return $this->principal; + } + + public function hasPrincipal() + { + return isset($this->principal); + } + + public function clearPrincipal() + { + unset($this->principal); + } + + /** + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Principal principal = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\Principal $var + * @return $this + */ + public function setPrincipal($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Principal::class); + $this->principal = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowNsxCredentialsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowNsxCredentialsRequest.php new file mode 100644 index 00000000000..a84e71cca4c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowNsxCredentialsRequest.php @@ -0,0 +1,107 @@ +google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest + */ +class ShowNsxCredentialsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $private_cloud = ''; + + /** + * @param string $privateCloud Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ShowNsxCredentialsRequest + * + * @experimental + */ + public static function build(string $privateCloud): self + { + return (new self()) + ->setPrivateCloud($privateCloud); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_cloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkString($var, True); + $this->private_cloud = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowVcenterCredentialsRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowVcenterCredentialsRequest.php new file mode 100644 index 00000000000..5201c0e2b53 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/ShowVcenterCredentialsRequest.php @@ -0,0 +1,177 @@ +google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest + */ +class ShowVcenterCredentialsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $private_cloud = ''; + /** + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $username = ''; + + /** + * @param string $privateCloud Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\ShowVcenterCredentialsRequest + * + * @experimental + */ + public static function build(string $privateCloud): self + { + return (new self()) + ->setPrivateCloud($privateCloud); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $private_cloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $username + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + /** + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string private_cloud = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkString($var, True); + $this->private_cloud = $var; + + return $this; + } + + /** + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * + * Generated from protobuf field string username = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/StretchedClusterConfig.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/StretchedClusterConfig.php new file mode 100644 index 00000000000..fca19569c8e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/StretchedClusterConfig.php @@ -0,0 +1,133 @@ +google.cloud.vmwareengine.v1.StretchedClusterConfig + */ +class StretchedClusterConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Zone that will remain operational when connection between the two + * zones is lost. Specify the resource name of a zone that belongs to the + * region of the private cloud. For example: + * `projects/{project}/locations/europe-west3-a` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string preferred_location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $preferred_location = ''; + /** + * Required. Additional zone for a higher level of availability and load + * balancing. Specify the resource name of a zone that belongs to the region + * of the private cloud. For example: + * `projects/{project}/locations/europe-west3-b` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string secondary_location = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $secondary_location = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $preferred_location + * Required. Zone that will remain operational when connection between the two + * zones is lost. Specify the resource name of a zone that belongs to the + * region of the private cloud. For example: + * `projects/{project}/locations/europe-west3-a` where `{project}` can either + * be a project number or a project ID. + * @type string $secondary_location + * Required. Additional zone for a higher level of availability and load + * balancing. Specify the resource name of a zone that belongs to the region + * of the private cloud. For example: + * `projects/{project}/locations/europe-west3-b` where `{project}` can either + * be a project number or a project ID. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Required. Zone that will remain operational when connection between the two + * zones is lost. Specify the resource name of a zone that belongs to the + * region of the private cloud. For example: + * `projects/{project}/locations/europe-west3-a` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string preferred_location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPreferredLocation() + { + return $this->preferred_location; + } + + /** + * Required. Zone that will remain operational when connection between the two + * zones is lost. Specify the resource name of a zone that belongs to the + * region of the private cloud. For example: + * `projects/{project}/locations/europe-west3-a` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string preferred_location = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPreferredLocation($var) + { + GPBUtil::checkString($var, True); + $this->preferred_location = $var; + + return $this; + } + + /** + * Required. Additional zone for a higher level of availability and load + * balancing. Specify the resource name of a zone that belongs to the region + * of the private cloud. For example: + * `projects/{project}/locations/europe-west3-b` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string secondary_location = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSecondaryLocation() + { + return $this->secondary_location; + } + + /** + * Required. Additional zone for a higher level of availability and load + * balancing. Specify the resource name of a zone that belongs to the region + * of the private cloud. For example: + * `projects/{project}/locations/europe-west3-b` where `{project}` can either + * be a project number or a project ID. + * + * Generated from protobuf field string secondary_location = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecondaryLocation($var) + { + GPBUtil::checkString($var, True); + $this->secondary_location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet.php new file mode 100644 index 00000000000..dc5ded5f9a4 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet.php @@ -0,0 +1,262 @@ +google.cloud.vmwareengine.v1.Subnet + */ +class Subnet extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of this subnet. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The IP address range of the subnet in CIDR format '10.0.0.0/24'. + * + * Generated from protobuf field string ip_cidr_range = 7; + */ + protected $ip_cidr_range = ''; + /** + * The IP address of the gateway of this subnet. + * Must fall within the IP prefix defined above. + * + * Generated from protobuf field string gateway_ip = 8; + */ + protected $gateway_ip = ''; + /** + * Output only. The type of the subnet. For example "management" or + * "userDefined". + * + * Generated from protobuf field string type = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = ''; + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. VLAN ID of the VLAN on which the subnet is configured + * + * Generated from protobuf field int32 vlan_id = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $vlan_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of this subnet. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * @type string $ip_cidr_range + * The IP address range of the subnet in CIDR format '10.0.0.0/24'. + * @type string $gateway_ip + * The IP address of the gateway of this subnet. + * Must fall within the IP prefix defined above. + * @type string $type + * Output only. The type of the subnet. For example "management" or + * "userDefined". + * @type int $state + * Output only. The state of the resource. + * @type int $vlan_id + * Output only. VLAN ID of the VLAN on which the subnet is configured + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of this subnet. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of this subnet. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The IP address range of the subnet in CIDR format '10.0.0.0/24'. + * + * Generated from protobuf field string ip_cidr_range = 7; + * @return string + */ + public function getIpCidrRange() + { + return $this->ip_cidr_range; + } + + /** + * The IP address range of the subnet in CIDR format '10.0.0.0/24'. + * + * Generated from protobuf field string ip_cidr_range = 7; + * @param string $var + * @return $this + */ + public function setIpCidrRange($var) + { + GPBUtil::checkString($var, True); + $this->ip_cidr_range = $var; + + return $this; + } + + /** + * The IP address of the gateway of this subnet. + * Must fall within the IP prefix defined above. + * + * Generated from protobuf field string gateway_ip = 8; + * @return string + */ + public function getGatewayIp() + { + return $this->gateway_ip; + } + + /** + * The IP address of the gateway of this subnet. + * Must fall within the IP prefix defined above. + * + * Generated from protobuf field string gateway_ip = 8; + * @param string $var + * @return $this + */ + public function setGatewayIp($var) + { + GPBUtil::checkString($var, True); + $this->gateway_ip = $var; + + return $this; + } + + /** + * Output only. The type of the subnet. For example "management" or + * "userDefined". + * + * Generated from protobuf field string type = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. The type of the subnet. For example "management" or + * "userDefined". + * + * Generated from protobuf field string type = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the resource. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet.State state = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Subnet\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. VLAN ID of the VLAN on which the subnet is configured + * + * Generated from protobuf field int32 vlan_id = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getVlanId() + { + return $this->vlan_id; + } + + /** + * Output only. VLAN ID of the VLAN on which the subnet is configured + * + * Generated from protobuf field int32 vlan_id = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setVlanId($var) + { + GPBUtil::checkInt32($var); + $this->vlan_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet/State.php new file mode 100644 index 00000000000..41e7a6b5b77 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Subnet/State.php @@ -0,0 +1,93 @@ +google.cloud.vmwareengine.v1.Subnet.State + */ +class State +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The subnet is ready. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The subnet is being created. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The subnet is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The subnet is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * Changes requested in the last operation are being propagated. + * + * Generated from protobuf enum RECONCILING = 5; + */ + const RECONCILING = 5; + /** + * Last operation on the subnet did not succeed. Subnet's payload is + * reverted back to its most recent working state. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + self::RECONCILING => 'RECONCILING', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Subnet_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UndeletePrivateCloudRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UndeletePrivateCloudRequest.php new file mode 100644 index 00000000000..821fbcbc686 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UndeletePrivateCloudRequest.php @@ -0,0 +1,140 @@ +google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest + */ +class UndeletePrivateCloudRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param string $name Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * Please see {@see VmwareEngineClient::privateCloudName()} for help formatting this field. + * + * @return \Google\Cloud\VmwareEngine\V1\UndeletePrivateCloudRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateClusterRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateClusterRequest.php new file mode 100644 index 00000000000..badc304f082 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateClusterRequest.php @@ -0,0 +1,233 @@ +google.cloud.vmwareengine.v1.UpdateClusterRequest + */ +class UpdateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. The description of the cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\VmwareEngine\V1\Cluster $cluster Required. The description of the cluster. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateClusterRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\Cluster $cluster, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setCluster($cluster) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\Cluster $cluster + * Required. The description of the cluster. + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The description of the cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The description of the cluster. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateDnsForwardingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateDnsForwardingRequest.php new file mode 100644 index 00000000000..8d37ab7be38 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateDnsForwardingRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest + */ +class UpdateDnsForwardingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. DnsForwarding config details. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.DnsForwarding dns_forwarding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $dns_forwarding = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\DnsForwarding $dnsForwarding Required. DnsForwarding config details. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateDnsForwardingRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\DnsForwarding $dnsForwarding, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setDnsForwarding($dnsForwarding) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\DnsForwarding $dns_forwarding + * Required. DnsForwarding config details. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. DnsForwarding config details. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.DnsForwarding dns_forwarding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\DnsForwarding|null + */ + public function getDnsForwarding() + { + return $this->dns_forwarding; + } + + public function hasDnsForwarding() + { + return isset($this->dns_forwarding); + } + + public function clearDnsForwarding() + { + unset($this->dns_forwarding); + } + + /** + * Required. DnsForwarding config details. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.DnsForwarding dns_forwarding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\DnsForwarding $var + * @return $this + */ + public function setDnsForwarding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\DnsForwarding::class); + $this->dns_forwarding = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAccessRuleRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAccessRuleRequest.php new file mode 100644 index 00000000000..7012b7dd006 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAccessRuleRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest + */ +class UpdateExternalAccessRuleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. Description of the external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_access_rule = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $externalAccessRule Required. Description of the external access rule. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateExternalAccessRuleRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\ExternalAccessRule $externalAccessRule, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setExternalAccessRule($externalAccessRule) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $external_access_rule + * Required. Description of the external access rule. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Description of the external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ExternalAccessRule|null + */ + public function getExternalAccessRule() + { + return $this->external_access_rule; + } + + public function hasExternalAccessRule() + { + return isset($this->external_access_rule); + } + + public function clearExternalAccessRule() + { + unset($this->external_access_rule); + } + + /** + * Required. Description of the external access rule. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAccessRule external_access_rule = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ExternalAccessRule $var + * @return $this + */ + public function setExternalAccessRule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ExternalAccessRule::class); + $this->external_access_rule = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAddressRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAddressRequest.php new file mode 100644 index 00000000000..9b39c54b907 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateExternalAddressRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateExternalAddressRequest + */ +class UpdateExternalAddressRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. External IP address description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $external_address = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\ExternalAddress $externalAddress Required. External IP address description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateExternalAddressRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\ExternalAddress $externalAddress, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setExternalAddress($externalAddress) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\ExternalAddress $external_address + * Required. External IP address description. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. External IP address description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ExternalAddress|null + */ + public function getExternalAddress() + { + return $this->external_address; + } + + public function hasExternalAddress() + { + return isset($this->external_address); + } + + public function clearExternalAddress() + { + unset($this->external_address); + } + + /** + * Required. External IP address description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ExternalAddress external_address = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ExternalAddress $var + * @return $this + */ + public function setExternalAddress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ExternalAddress::class); + $this->external_address = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateLoggingServerRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateLoggingServerRequest.php new file mode 100644 index 00000000000..a1fa394ba6f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateLoggingServerRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateLoggingServerRequest + */ +class UpdateLoggingServerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. Logging server description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $logging_server = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\LoggingServer $loggingServer Required. Logging server description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateLoggingServerRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\LoggingServer $loggingServer, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setLoggingServer($loggingServer) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\LoggingServer $logging_server + * Required. Logging server description. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Logging server description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\LoggingServer|null + */ + public function getLoggingServer() + { + return $this->logging_server; + } + + public function hasLoggingServer() + { + return isset($this->logging_server); + } + + public function clearLoggingServer() + { + unset($this->logging_server); + } + + /** + * Required. Logging server description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.LoggingServer logging_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\LoggingServer $var + * @return $this + */ + public function setLoggingServer($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\LoggingServer::class); + $this->logging_server = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateManagementDnsZoneBindingRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateManagementDnsZoneBindingRequest.php new file mode 100644 index 00000000000..5080e3c59eb --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateManagementDnsZoneBindingRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest + */ +class UpdateManagementDnsZoneBindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. New values to update the management DNS zone binding with. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $management_dns_zone_binding = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $managementDnsZoneBinding Required. New values to update the management DNS zone binding with. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateManagementDnsZoneBindingRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $managementDnsZoneBinding, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setManagementDnsZoneBinding($managementDnsZoneBinding) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $management_dns_zone_binding + * Required. New values to update the management DNS zone binding with. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. New values to update the management DNS zone binding with. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding|null + */ + public function getManagementDnsZoneBinding() + { + return $this->management_dns_zone_binding; + } + + public function hasManagementDnsZoneBinding() + { + return isset($this->management_dns_zone_binding); + } + + public function clearManagementDnsZoneBinding() + { + unset($this->management_dns_zone_binding); + } + + /** + * Required. New values to update the management DNS zone binding with. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.ManagementDnsZoneBinding management_dns_zone_binding = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding $var + * @return $this + */ + public function setManagementDnsZoneBinding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding::class); + $this->management_dns_zone_binding = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPeeringRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPeeringRequest.php new file mode 100644 index 00000000000..cb753c3e50f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPeeringRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest + */ +class UpdateNetworkPeeringRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Network peering description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_peering = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\NetworkPeering $networkPeering Required. Network peering description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateNetworkPeeringRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\NetworkPeering $networkPeering, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setNetworkPeering($networkPeering) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\NetworkPeering $network_peering + * Required. Network peering description. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Network peering description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPeering|null + */ + public function getNetworkPeering() + { + return $this->network_peering; + } + + public function hasNetworkPeering() + { + return isset($this->network_peering); + } + + public function clearNetworkPeering() + { + unset($this->network_peering); + } + + /** + * Required. Network peering description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPeering network_peering = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPeering $var + * @return $this + */ + public function setNetworkPeering($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPeering::class); + $this->network_peering = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPolicyRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPolicyRequest.php new file mode 100644 index 00000000000..7fddaaad169 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateNetworkPolicyRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest + */ +class UpdateNetworkPolicyRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Network policy description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $network_policy = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy $networkPolicy Required. Network policy description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateNetworkPolicyRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\NetworkPolicy $networkPolicy, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setNetworkPolicy($networkPolicy) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\NetworkPolicy $network_policy + * Required. Network policy description. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Network policy description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\NetworkPolicy|null + */ + public function getNetworkPolicy() + { + return $this->network_policy; + } + + public function hasNetworkPolicy() + { + return isset($this->network_policy); + } + + public function clearNetworkPolicy() + { + unset($this->network_policy); + } + + /** + * Required. Network policy description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.NetworkPolicy network_policy = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\NetworkPolicy $var + * @return $this + */ + public function setNetworkPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\NetworkPolicy::class); + $this->network_policy = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateCloudRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateCloudRequest.php new file mode 100644 index 00000000000..16c19f6e141 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateCloudRequest.php @@ -0,0 +1,195 @@ +google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest + */ +class UpdatePrivateCloudRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Private cloud description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_cloud = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud $privateCloud Required. Private cloud description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdatePrivateCloudRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\PrivateCloud $privateCloud, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setPrivateCloud($privateCloud) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\PrivateCloud $private_cloud + * Required. Private cloud description. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @type string $request_id + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Private cloud description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\PrivateCloud|null + */ + public function getPrivateCloud() + { + return $this->private_cloud; + } + + public function hasPrivateCloud() + { + return isset($this->private_cloud); + } + + public function clearPrivateCloud() + { + unset($this->private_cloud); + } + + /** + * Required. Private cloud description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateCloud private_cloud = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\PrivateCloud $var + * @return $this + */ + public function setPrivateCloud($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\PrivateCloud::class); + $this->private_cloud = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateConnectionRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateConnectionRequest.php new file mode 100644 index 00000000000..24fa1e9a5ae --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdatePrivateConnectionRequest.php @@ -0,0 +1,235 @@ +google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest + */ +class UpdatePrivateConnectionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Private connection description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $private_connection = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\PrivateConnection $privateConnection Required. Private connection description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdatePrivateConnectionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\PrivateConnection $privateConnection, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setPrivateConnection($privateConnection) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\PrivateConnection $private_connection + * Required. Private connection description. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Private connection description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\PrivateConnection|null + */ + public function getPrivateConnection() + { + return $this->private_connection; + } + + public function hasPrivateConnection() + { + return isset($this->private_connection); + } + + public function clearPrivateConnection() + { + unset($this->private_connection); + } + + /** + * Required. Private connection description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.PrivateConnection private_connection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\PrivateConnection $var + * @return $this + */ + public function setPrivateConnection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\PrivateConnection::class); + $this->private_connection = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateSubnetRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateSubnetRequest.php new file mode 100644 index 00000000000..b4877c06c75 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateSubnetRequest.php @@ -0,0 +1,157 @@ +google.cloud.vmwareengine.v1.UpdateSubnetRequest + */ +class UpdateSubnetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Required. Subnet description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet subnet = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $subnet = null; + + /** + * @param \Google\Cloud\VmwareEngine\V1\Subnet $subnet Required. Subnet description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateSubnetRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\Subnet $subnet, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSubnet($subnet) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\VmwareEngine\V1\Subnet $subnet + * Required. Subnet description. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. Subnet description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet subnet = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\Subnet|null + */ + public function getSubnet() + { + return $this->subnet; + } + + public function hasSubnet() + { + return isset($this->subnet); + } + + public function clearSubnet() + { + unset($this->subnet); + } + + /** + * Required. Subnet description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Subnet subnet = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\Subnet $var + * @return $this + */ + public function setSubnet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\Subnet::class); + $this->subnet = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateVmwareEngineNetworkRequest.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateVmwareEngineNetworkRequest.php new file mode 100644 index 00000000000..38f1091baa2 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/UpdateVmwareEngineNetworkRequest.php @@ -0,0 +1,240 @@ +google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest + */ +class UpdateVmwareEngineNetworkRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. VMware Engine network description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $vmware_engine_network = null; + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * @param \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmwareEngineNetwork Required. VMware Engine network description. + * @param \Google\Protobuf\FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * + * @return \Google\Cloud\VmwareEngine\V1\UpdateVmwareEngineNetworkRequest + * + * @experimental + */ + public static function build(\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmwareEngineNetwork, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setVmwareEngineNetwork($vmwareEngineNetwork) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $vmware_engine_network + * Required. VMware Engine network description. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * @type string $request_id + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\Vmwareengine::initOnce(); + parent::__construct($data); + } + + /** + * Required. VMware Engine network description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork|null + */ + public function getVmwareEngineNetwork() + { + return $this->vmware_engine_network; + } + + public function hasVmwareEngineNetwork() + { + return isset($this->vmware_engine_network); + } + + public function clearVmwareEngineNetwork() + { + unset($this->vmware_engine_network); + } + + /** + * Required. VMware Engine network description. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork vmware_engine_network = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork $var + * @return $this + */ + public function setVmwareEngineNetwork($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork::class); + $this->vmware_engine_network = $var; + + return $this; + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter.php new file mode 100644 index 00000000000..1d7fb8297ae --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter.php @@ -0,0 +1,169 @@ +google.cloud.vmwareengine.v1.Vcenter + */ +class Vcenter extends \Google\Protobuf\Internal\Message +{ + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + */ + protected $internal_ip = ''; + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + */ + protected $version = ''; + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + */ + protected $fqdn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $internal_ip + * Internal IP address of the appliance. + * @type string $version + * Version of the appliance. + * @type int $state + * Output only. The state of the appliance. + * @type string $fqdn + * Fully qualified domain name of the appliance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @return string + */ + public function getInternalIp() + { + return $this->internal_ip; + } + + /** + * Internal IP address of the appliance. + * + * Generated from protobuf field string internal_ip = 2; + * @param string $var + * @return $this + */ + public function setInternalIp($var) + { + GPBUtil::checkString($var, True); + $this->internal_ip = $var; + + return $this; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Version of the appliance. + * + * Generated from protobuf field string version = 4; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the appliance. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.Vcenter.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\Vcenter\State::class); + $this->state = $var; + + return $this; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @return string + */ + public function getFqdn() + { + return $this->fqdn; + } + + /** + * Fully qualified domain name of the appliance. + * + * Generated from protobuf field string fqdn = 6; + * @param string $var + * @return $this + */ + public function setFqdn($var) + { + GPBUtil::checkString($var, True); + $this->fqdn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter/State.php new file mode 100644 index 00000000000..37b87d5973f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/Vcenter/State.php @@ -0,0 +1,64 @@ +google.cloud.vmwareengine.v1.Vcenter.State + */ +class State +{ + /** + * Unspecified appliance state. This is the default value. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The appliance is operational and can be used. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The appliance is being deployed. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::CREATING => 'CREATING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\Vcenter_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork.php new file mode 100644 index 00000000000..11b48b25b57 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork.php @@ -0,0 +1,396 @@ +google.cloud.vmwareengine.v1.VmwareEngineNetwork + */ +class VmwareEngineNetwork extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the VMware Engine network. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * User-provided description for this VMware Engine network. + * + * Generated from protobuf field string description = 5; + */ + protected $description = ''; + /** + * Output only. VMware Engine service VPC networks that provide connectivity + * from a private cloud to customer projects, the internet, and other Google + * Cloud services. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork vpc_networks = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $vpc_networks; + /** + * Output only. State of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. VMware Engine network type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.Type type = 8 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Checksum that may be sent on update and delete requests to ensure that the + * user-provided value is up to date before the server processes a request. + * The server computes checksums based on the value of other fields in the + * request. + * + * Generated from protobuf field string etag = 10; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the VMware Engine network. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Creation time of this resource. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last update time of this resource. + * @type string $description + * User-provided description for this VMware Engine network. + * @type array<\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\VpcNetwork>|\Google\Protobuf\Internal\RepeatedField $vpc_networks + * Output only. VMware Engine service VPC networks that provide connectivity + * from a private cloud to customer projects, the internet, and other Google + * Cloud services. + * @type int $state + * Output only. State of the VMware Engine network. + * @type int $type + * Required. VMware Engine network type. + * @type string $uid + * Output only. System-generated unique identifier for the resource. + * @type string $etag + * Checksum that may be sent on update and delete requests to ensure that the + * user-provided value is up to date before the server processes a request. + * The server computes checksums based on the value of other fields in the + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the VMware Engine network. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the VMware Engine network. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Creation time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last update time of this resource. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * User-provided description for this VMware Engine network. + * + * Generated from protobuf field string description = 5; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description for this VMware Engine network. + * + * Generated from protobuf field string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. VMware Engine service VPC networks that provide connectivity + * from a private cloud to customer projects, the internet, and other Google + * Cloud services. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork vpc_networks = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVpcNetworks() + { + return $this->vpc_networks; + } + + /** + * Output only. VMware Engine service VPC networks that provide connectivity + * from a private cloud to customer projects, the internet, and other Google + * Cloud services. + * + * Generated from protobuf field repeated .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork vpc_networks = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\VpcNetwork>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVpcNetworks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\VpcNetwork::class); + $this->vpc_networks = $arr; + + return $this; + } + + /** + * Output only. State of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the VMware Engine network. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. VMware Engine network type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.Type type = 8 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. VMware Engine network type. + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.Type type = 8 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. System-generated unique identifier for the resource. + * + * Generated from protobuf field string uid = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Checksum that may be sent on update and delete requests to ensure that the + * user-provided value is up to date before the server processes a request. + * The server computes checksums based on the value of other fields in the + * request. + * + * Generated from protobuf field string etag = 10; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Checksum that may be sent on update and delete requests to ensure that the + * user-provided value is up to date before the server processes a request. + * The server computes checksums based on the value of other fields in the + * request. + * + * Generated from protobuf field string etag = 10; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/State.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/State.php new file mode 100644 index 00000000000..3f8a6067ccd --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/State.php @@ -0,0 +1,78 @@ +google.cloud.vmwareengine.v1.VmwareEngineNetwork.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The VMware Engine network is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The VMware Engine network is ready. + * + * Generated from protobuf enum ACTIVE = 2; + */ + const ACTIVE = 2; + /** + * The VMware Engine network is being updated. + * + * Generated from protobuf enum UPDATING = 3; + */ + const UPDATING = 3; + /** + * The VMware Engine network is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::ACTIVE => 'ACTIVE', + self::UPDATING => 'UPDATING', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork_State::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/Type.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/Type.php new file mode 100644 index 00000000000..28f91974aaa --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/Type.php @@ -0,0 +1,66 @@ +google.cloud.vmwareengine.v1.VmwareEngineNetwork.Type + */ +class Type +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Network type used by private clouds created in projects without a network + * of type `STANDARD`. This network type is no longer used for new VMware + * Engine private cloud deployments. + * + * Generated from protobuf enum LEGACY = 1; + */ + const LEGACY = 1; + /** + * Standard network type used for private cloud connectivity. + * + * Generated from protobuf enum STANDARD = 2; + */ + const STANDARD = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::LEGACY => 'LEGACY', + self::STANDARD => 'STANDARD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork_Type::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork.php new file mode 100644 index 00000000000..9ef0665f0e7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork.php @@ -0,0 +1,117 @@ +google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork + */ +class VpcNetwork extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Type of VPC network (INTRANET, INTERNET, or + * GOOGLE_CLOUD) + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork.Type type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $type = 0; + /** + * Output only. The relative resource name of the service VPC network this + * VMware Engine network is attached to. For example: + * `projects/123123/global/networks/my-network` + * + * Generated from protobuf field string network = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $network = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Output only. Type of VPC network (INTRANET, INTERNET, or + * GOOGLE_CLOUD) + * @type string $network + * Output only. The relative resource name of the service VPC network this + * VMware Engine network is attached to. For example: + * `projects/123123/global/networks/my-network` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vmwareengine\V1\VmwareengineResources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Type of VPC network (INTRANET, INTERNET, or + * GOOGLE_CLOUD) + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork.Type type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Output only. Type of VPC network (INTRANET, INTERNET, or + * GOOGLE_CLOUD) + * + * Generated from protobuf field .google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork.Type type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\VpcNetwork\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Output only. The relative resource name of the service VPC network this + * VMware Engine network is attached to. For example: + * `projects/123123/global/networks/my-network` + * + * Generated from protobuf field string network = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Output only. The relative resource name of the service VPC network this + * VMware Engine network is attached to. For example: + * `projects/123123/global/networks/my-network` + * + * Generated from protobuf field string network = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VpcNetwork::class, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork_VpcNetwork::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork/Type.php b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork/Type.php new file mode 100644 index 00000000000..194c6e10931 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/proto/src/Google/Cloud/VmwareEngine/V1/VmwareEngineNetwork/VpcNetwork/Type.php @@ -0,0 +1,76 @@ +google.cloud.vmwareengine.v1.VmwareEngineNetwork.VpcNetwork.Type + */ +class Type +{ + /** + * The default value. This value should never be used. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * VPC network that will be peered with a consumer VPC network or the + * intranet VPC of another VMware Engine network. Access a private cloud + * through Compute Engine VMs on a peered VPC network or an on-premises + * resource connected to a peered consumer VPC network. + * + * Generated from protobuf enum INTRANET = 1; + */ + const INTRANET = 1; + /** + * VPC network used for internet access to and from a private cloud. + * + * Generated from protobuf enum INTERNET = 2; + */ + const INTERNET = 2; + /** + * VPC network used for access to Google Cloud services like + * Cloud Storage. + * + * Generated from protobuf enum GOOGLE_CLOUD = 3; + */ + const GOOGLE_CLOUD = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::INTRANET => 'INTRANET', + self::INTERNET => 'INTERNET', + self::GOOGLE_CLOUD => 'GOOGLE_CLOUD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork_VpcNetwork_Type::class); + diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_cluster.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_cluster.php new file mode 100644 index 00000000000..d8d26b139c8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_cluster.php @@ -0,0 +1,111 @@ +setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new CreateClusterRequest()) + ->setParent($formattedParent) + ->setClusterId($clusterId) + ->setCluster($cluster); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + $clusterId = '[CLUSTER_ID]'; + + create_cluster_sample($formattedParent, $clusterId); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateCluster_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_access_rule.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_access_rule.php new file mode 100644 index 00000000000..5d130ca4ca6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_access_rule.php @@ -0,0 +1,109 @@ +setParent($formattedParent) + ->setExternalAccessRule($externalAccessRule) + ->setExternalAccessRuleId($externalAccessRuleId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createExternalAccessRule($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExternalAccessRule $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::networkPolicyName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]' + ); + $externalAccessRuleId = '[EXTERNAL_ACCESS_RULE_ID]'; + + create_external_access_rule_sample($formattedParent, $externalAccessRuleId); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateExternalAccessRule_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_address.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_address.php new file mode 100644 index 00000000000..7e0fb92de48 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_external_address.php @@ -0,0 +1,109 @@ +setParent($formattedParent) + ->setExternalAddress($externalAddress) + ->setExternalAddressId($externalAddressId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createExternalAddress($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExternalAddress $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + $externalAddressId = '[EXTERNAL_ADDRESS_ID]'; + + create_external_address_sample($formattedParent, $externalAddressId); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateExternalAddress_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_hcx_activation_key.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_hcx_activation_key.php new file mode 100644 index 00000000000..adc1f452785 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_hcx_activation_key.php @@ -0,0 +1,108 @@ +setParent($formattedParent) + ->setHcxActivationKey($hcxActivationKey) + ->setHcxActivationKeyId($hcxActivationKeyId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createHcxActivationKey($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var HcxActivationKey $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + $hcxActivationKeyId = '[HCX_ACTIVATION_KEY_ID]'; + + create_hcx_activation_key_sample($formattedParent, $hcxActivationKeyId); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_logging_server.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_logging_server.php new file mode 100644 index 00000000000..8371739f6ba --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_logging_server.php @@ -0,0 +1,136 @@ +setHostname($loggingServerHostname) + ->setPort($loggingServerPort) + ->setProtocol($loggingServerProtocol) + ->setSourceType($loggingServerSourceType); + $request = (new CreateLoggingServerRequest()) + ->setParent($formattedParent) + ->setLoggingServer($loggingServer) + ->setLoggingServerId($loggingServerId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createLoggingServer($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LoggingServer $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + $loggingServerHostname = '[HOSTNAME]'; + $loggingServerPort = 0; + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServerId = '[LOGGING_SERVER_ID]'; + + create_logging_server_sample( + $formattedParent, + $loggingServerHostname, + $loggingServerPort, + $loggingServerProtocol, + $loggingServerSourceType, + $loggingServerId + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateLoggingServer_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_management_dns_zone_binding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_management_dns_zone_binding.php new file mode 100644 index 00000000000..a6ecfb793e8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_management_dns_zone_binding.php @@ -0,0 +1,116 @@ +setParent($formattedParent) + ->setManagementDnsZoneBinding($managementDnsZoneBinding) + ->setManagementDnsZoneBindingId($managementDnsZoneBindingId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createManagementDnsZoneBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ManagementDnsZoneBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + $managementDnsZoneBindingId = '[MANAGEMENT_DNS_ZONE_BINDING_ID]'; + + create_management_dns_zone_binding_sample($formattedParent, $managementDnsZoneBindingId); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateManagementDnsZoneBinding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_peering.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_peering.php new file mode 100644 index 00000000000..d882fe57501 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_peering.php @@ -0,0 +1,140 @@ +setPeerNetwork($networkPeeringPeerNetwork) + ->setPeerNetworkType($networkPeeringPeerNetworkType) + ->setVmwareEngineNetwork($formattedNetworkPeeringVmwareEngineNetwork); + $request = (new CreateNetworkPeeringRequest()) + ->setParent($formattedParent) + ->setNetworkPeeringId($networkPeeringId) + ->setNetworkPeering($networkPeering); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createNetworkPeering($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NetworkPeering $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + $networkPeeringId = '[NETWORK_PEERING_ID]'; + $networkPeeringPeerNetwork = '[PEER_NETWORK]'; + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $formattedNetworkPeeringVmwareEngineNetwork = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + + create_network_peering_sample( + $formattedParent, + $networkPeeringId, + $networkPeeringPeerNetwork, + $networkPeeringPeerNetworkType, + $formattedNetworkPeeringVmwareEngineNetwork + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateNetworkPeering_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_policy.php new file mode 100644 index 00000000000..bac7d58c4a6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_network_policy.php @@ -0,0 +1,115 @@ +setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $request = (new CreateNetworkPolicyRequest()) + ->setParent($formattedParent) + ->setNetworkPolicyId($networkPolicyId) + ->setNetworkPolicy($networkPolicy); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createNetworkPolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NetworkPolicy $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + $networkPolicyId = '[NETWORK_POLICY_ID]'; + $networkPolicyEdgeServicesCidr = '[EDGE_SERVICES_CIDR]'; + + create_network_policy_sample($formattedParent, $networkPolicyId, $networkPolicyEdgeServicesCidr); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_cloud.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_cloud.php new file mode 100644 index 00000000000..11b2960c57e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_cloud.php @@ -0,0 +1,139 @@ +setManagementCidr($privateCloudNetworkConfigManagementCidr); + $privateCloudManagementClusterNodeTypeConfigs = []; + $privateCloudManagementCluster = (new ManagementCluster()) + ->setClusterId($privateCloudManagementClusterClusterId) + ->setNodeTypeConfigs($privateCloudManagementClusterNodeTypeConfigs); + $privateCloud = (new PrivateCloud()) + ->setNetworkConfig($privateCloudNetworkConfig) + ->setManagementCluster($privateCloudManagementCluster); + $request = (new CreatePrivateCloudRequest()) + ->setParent($formattedParent) + ->setPrivateCloudId($privateCloudId) + ->setPrivateCloud($privateCloud); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createPrivateCloud($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + $privateCloudId = '[PRIVATE_CLOUD_ID]'; + $privateCloudNetworkConfigManagementCidr = '[MANAGEMENT_CIDR]'; + $privateCloudManagementClusterClusterId = '[CLUSTER_ID]'; + + create_private_cloud_sample( + $formattedParent, + $privateCloudId, + $privateCloudNetworkConfigManagementCidr, + $privateCloudManagementClusterClusterId + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_connection.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_connection.php new file mode 100644 index 00000000000..a5080cc3743 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_private_connection.php @@ -0,0 +1,150 @@ +setVmwareEngineNetwork($formattedPrivateConnectionVmwareEngineNetwork) + ->setType($privateConnectionType) + ->setServiceNetwork($formattedPrivateConnectionServiceNetwork); + $request = (new CreatePrivateConnectionRequest()) + ->setParent($formattedParent) + ->setPrivateConnectionId($privateConnectionId) + ->setPrivateConnection($privateConnection); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createPrivateConnection($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateConnection $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + $privateConnectionId = '[PRIVATE_CONNECTION_ID]'; + $formattedPrivateConnectionVmwareEngineNetwork = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $formattedPrivateConnectionServiceNetwork = VmwareEngineClient::networkName( + '[PROJECT]', + '[NETWORK]' + ); + + create_private_connection_sample( + $formattedParent, + $privateConnectionId, + $formattedPrivateConnectionVmwareEngineNetwork, + $privateConnectionType, + $formattedPrivateConnectionServiceNetwork + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_vmware_engine_network.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_vmware_engine_network.php new file mode 100644 index 00000000000..cd0d6b6a571 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/create_vmware_engine_network.php @@ -0,0 +1,118 @@ +setType($vmwareEngineNetworkType); + $request = (new CreateVmwareEngineNetworkRequest()) + ->setParent($formattedParent) + ->setVmwareEngineNetworkId($vmwareEngineNetworkId) + ->setVmwareEngineNetwork($vmwareEngineNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->createVmwareEngineNetwork($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var VmwareEngineNetwork $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + $vmwareEngineNetworkId = '[VMWARE_ENGINE_NETWORK_ID]'; + $vmwareEngineNetworkType = Type::TYPE_UNSPECIFIED; + + create_vmware_engine_network_sample( + $formattedParent, + $vmwareEngineNetworkId, + $vmwareEngineNetworkType + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_cluster.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_cluster.php new file mode 100644 index 00000000000..d48815d0176 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_cluster.php @@ -0,0 +1,92 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[CLUSTER]' + ); + + delete_cluster_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteCluster_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_access_rule.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_access_rule.php new file mode 100644 index 00000000000..c81941f37b1 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_access_rule.php @@ -0,0 +1,89 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteExternalAccessRule($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + + delete_external_access_rule_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteExternalAccessRule_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_address.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_address.php new file mode 100644 index 00000000000..2ecb2b32a34 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_external_address.php @@ -0,0 +1,91 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteExternalAddress($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + + delete_external_address_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteExternalAddress_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_logging_server.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_logging_server.php new file mode 100644 index 00000000000..8cb9dd78549 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_logging_server.php @@ -0,0 +1,89 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteLoggingServer($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + + delete_logging_server_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteLoggingServer_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_management_dns_zone_binding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_management_dns_zone_binding.php new file mode 100644 index 00000000000..8aa149bc606 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_management_dns_zone_binding.php @@ -0,0 +1,91 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteManagementDnsZoneBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + + delete_management_dns_zone_binding_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteManagementDnsZoneBinding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_peering.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_peering.php new file mode 100644 index 00000000000..19df1760d0f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_peering.php @@ -0,0 +1,91 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteNetworkPeering($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::networkPeeringName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_PEERING]' + ); + + delete_network_peering_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPeering_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_policy.php new file mode 100644 index 00000000000..c12774954e0 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_network_policy.php @@ -0,0 +1,90 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteNetworkPolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::networkPolicyName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]' + ); + + delete_network_policy_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_cloud.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_cloud.php new file mode 100644 index 00000000000..7baeefdc16b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_cloud.php @@ -0,0 +1,101 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deletePrivateCloud($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + + delete_private_cloud_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_connection.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_connection.php new file mode 100644 index 00000000000..07ef7d7e37c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_private_connection.php @@ -0,0 +1,90 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deletePrivateConnection($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::privateConnectionName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CONNECTION]' + ); + + delete_private_connection_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_vmware_engine_network.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_vmware_engine_network.php new file mode 100644 index 00000000000..5f01b8e9704 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/delete_vmware_engine_network.php @@ -0,0 +1,91 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->deleteVmwareEngineNetwork($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + + delete_vmware_engine_network_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/fetch_network_policy_external_addresses.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/fetch_network_policy_external_addresses.php new file mode 100644 index 00000000000..58c66844539 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/fetch_network_policy_external_addresses.php @@ -0,0 +1,85 @@ +setNetworkPolicy($formattedNetworkPolicy); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->fetchNetworkPolicyExternalAddresses($request); + + /** @var ExternalAddress $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedNetworkPolicy = VmwareEngineClient::networkPolicyName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]' + ); + + fetch_network_policy_external_addresses_sample($formattedNetworkPolicy); +} +// [END vmwareengine_v1_generated_VmwareEngine_FetchNetworkPolicyExternalAddresses_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_cluster.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_cluster.php new file mode 100644 index 00000000000..54f59c6f885 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_cluster.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Cluster $response */ + $response = $vmwareEngineClient->getCluster($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[CLUSTER]' + ); + + get_cluster_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetCluster_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_bind_permission.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_bind_permission.php new file mode 100644 index 00000000000..5f8bc63d611 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_bind_permission.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DnsBindPermission $response */ + $response = $vmwareEngineClient->getDnsBindPermission($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + + get_dns_bind_permission_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetDnsBindPermission_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_forwarding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_forwarding.php new file mode 100644 index 00000000000..7a39a3c0e4f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_dns_forwarding.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DnsForwarding $response */ + $response = $vmwareEngineClient->getDnsForwarding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::dnsForwardingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + get_dns_forwarding_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetDnsForwarding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_access_rule.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_access_rule.php new file mode 100644 index 00000000000..577cdebb07a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_access_rule.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ExternalAccessRule $response */ + $response = $vmwareEngineClient->getExternalAccessRule($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::externalAccessRuleName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]', + '[EXTERNAL_ACCESS_RULE]' + ); + + get_external_access_rule_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetExternalAccessRule_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_address.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_address.php new file mode 100644 index 00000000000..4782af24b34 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_external_address.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ExternalAddress $response */ + $response = $vmwareEngineClient->getExternalAddress($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::externalAddressName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[EXTERNAL_ADDRESS]' + ); + + get_external_address_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetExternalAddress_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_hcx_activation_key.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_hcx_activation_key.php new file mode 100644 index 00000000000..fb4fd8d6d32 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_hcx_activation_key.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var HcxActivationKey $response */ + $response = $vmwareEngineClient->getHcxActivationKey($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::hcxActivationKeyName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[HCX_ACTIVATION_KEY]' + ); + + get_hcx_activation_key_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_iam_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_iam_policy.php new file mode 100644 index 00000000000..d1722d12c99 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_iam_policy.php @@ -0,0 +1,72 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $vmwareEngineClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetIamPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_location.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_location.php new file mode 100644 index 00000000000..41220af357b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_GetLocation_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_logging_server.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_logging_server.php new file mode 100644 index 00000000000..04ecb1b4894 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_logging_server.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var LoggingServer $response */ + $response = $vmwareEngineClient->getLoggingServer($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::loggingServerName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[LOGGING_SERVER]' + ); + + get_logging_server_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetLoggingServer_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_management_dns_zone_binding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_management_dns_zone_binding.php new file mode 100644 index 00000000000..0089c322742 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_management_dns_zone_binding.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ManagementDnsZoneBinding $response */ + $response = $vmwareEngineClient->getManagementDnsZoneBinding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + + get_management_dns_zone_binding_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetManagementDnsZoneBinding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_peering.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_peering.php new file mode 100644 index 00000000000..e3656f15f39 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_peering.php @@ -0,0 +1,82 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var NetworkPeering $response */ + $response = $vmwareEngineClient->getNetworkPeering($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::networkPeeringName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_PEERING]' + ); + + get_network_peering_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetNetworkPeering_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_policy.php new file mode 100644 index 00000000000..912ec9ffda8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_network_policy.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var NetworkPolicy $response */ + $response = $vmwareEngineClient->getNetworkPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::networkPolicyName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]' + ); + + get_network_policy_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node.php new file mode 100644 index 00000000000..0c5c8a4b018 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Node $response */ + $response = $vmwareEngineClient->getNode($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::nodeName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[CLUSTER]', + '[NODE]' + ); + + get_node_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetNode_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node_type.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node_type.php new file mode 100644 index 00000000000..de4dc4ff50c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_node_type.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var NodeType $response */ + $response = $vmwareEngineClient->getNodeType($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + + get_node_type_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetNodeType_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_cloud.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_cloud.php new file mode 100644 index 00000000000..c761e8b394b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_cloud.php @@ -0,0 +1,75 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PrivateCloud $response */ + $response = $vmwareEngineClient->getPrivateCloud($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + + get_private_cloud_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_connection.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_connection.php new file mode 100644 index 00000000000..cbc02a8049d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_private_connection.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PrivateConnection $response */ + $response = $vmwareEngineClient->getPrivateConnection($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::privateConnectionName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CONNECTION]' + ); + + get_private_connection_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_subnet.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_subnet.php new file mode 100644 index 00000000000..33192d6af4e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_subnet.php @@ -0,0 +1,80 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Subnet $response */ + $response = $vmwareEngineClient->getSubnet($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::subnetName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[SUBNET]' + ); + + get_subnet_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetSubnet_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_vmware_engine_network.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_vmware_engine_network.php new file mode 100644 index 00000000000..7bf3a52d343 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/get_vmware_engine_network.php @@ -0,0 +1,82 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var VmwareEngineNetwork $response */ + $response = $vmwareEngineClient->getVmwareEngineNetwork($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + + get_vmware_engine_network_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/grant_dns_bind_permission.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/grant_dns_bind_permission.php new file mode 100644 index 00000000000..443f135066a --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/grant_dns_bind_permission.php @@ -0,0 +1,94 @@ +setName($formattedName) + ->setPrincipal($principal); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->grantDnsBindPermission($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DnsBindPermission $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + + grant_dns_bind_permission_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_GrantDnsBindPermission_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_clusters.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_clusters.php new file mode 100644 index 00000000000..2fca45306a3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_clusters.php @@ -0,0 +1,84 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listClusters($request); + + /** @var Cluster $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_clusters_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListClusters_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_access_rules.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_access_rules.php new file mode 100644 index 00000000000..1e741c96dc7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_access_rules.php @@ -0,0 +1,84 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listExternalAccessRules($request); + + /** @var ExternalAccessRule $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::networkPolicyName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_POLICY]' + ); + + list_external_access_rules_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListExternalAccessRules_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_addresses.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_addresses.php new file mode 100644 index 00000000000..52e7182ab19 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_external_addresses.php @@ -0,0 +1,86 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listExternalAddresses($request); + + /** @var ExternalAddress $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_external_addresses_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListExternalAddresses_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_hcx_activation_keys.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_hcx_activation_keys.php new file mode 100644 index 00000000000..55ab565dfec --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_hcx_activation_keys.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listHcxActivationKeys($request); + + /** @var HcxActivationKey $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_hcx_activation_keys_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_locations.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_locations.php new file mode 100644 index 00000000000..398c1b6ab57 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_ListLocations_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_logging_servers.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_logging_servers.php new file mode 100644 index 00000000000..6b6ca9087f0 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_logging_servers.php @@ -0,0 +1,86 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listLoggingServers($request); + + /** @var LoggingServer $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_logging_servers_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListLoggingServers_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_management_dns_zone_bindings.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_management_dns_zone_bindings.php new file mode 100644 index 00000000000..8b6f01e7ba6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_management_dns_zone_bindings.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listManagementDnsZoneBindings($request); + + /** @var ManagementDnsZoneBinding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_management_dns_zone_bindings_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListManagementDnsZoneBindings_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_peerings.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_peerings.php new file mode 100644 index 00000000000..73cfede6fd7 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_peerings.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listNetworkPeerings($request); + + /** @var NetworkPeering $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_network_peerings_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListNetworkPeerings_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_policies.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_policies.php new file mode 100644 index 00000000000..8bc964a90b4 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_network_policies.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listNetworkPolicies($request); + + /** @var NetworkPolicy $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_network_policies_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_node_types.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_node_types.php new file mode 100644 index 00000000000..da8b2b05725 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_node_types.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listNodeTypes($request); + + /** @var NodeType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_node_types_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_nodes.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_nodes.php new file mode 100644 index 00000000000..f3ef227fa55 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_nodes.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listNodes($request); + + /** @var Node $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[CLUSTER]' + ); + + list_nodes_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListNodes_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_peering_routes.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_peering_routes.php new file mode 100644 index 00000000000..47d45c8dfd9 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_peering_routes.php @@ -0,0 +1,84 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listPeeringRoutes($request); + + /** @var PeeringRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::networkPeeringName( + '[PROJECT]', + '[LOCATION]', + '[NETWORK_PEERING]' + ); + + list_peering_routes_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListPeeringRoutes_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_clouds.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_clouds.php new file mode 100644 index 00000000000..f6206e04255 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_clouds.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listPrivateClouds($request); + + /** @var PrivateCloud $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_private_clouds_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connection_peering_routes.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connection_peering_routes.php new file mode 100644 index 00000000000..c2ac1446fe4 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connection_peering_routes.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listPrivateConnectionPeeringRoutes($request); + + /** @var PeeringRoute $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateConnectionName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CONNECTION]' + ); + + list_private_connection_peering_routes_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connections.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connections.php new file mode 100644 index 00000000000..4cf70301043 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_private_connections.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listPrivateConnections($request); + + /** @var PrivateConnection $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_private_connections_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_subnets.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_subnets.php new file mode 100644 index 00000000000..b1ae86c73d6 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_subnets.php @@ -0,0 +1,85 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listSubnets($request); + + /** @var Subnet $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + list_subnets_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListSubnets_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_vmware_engine_networks.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_vmware_engine_networks.php new file mode 100644 index 00000000000..f891ebfb56c --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/list_vmware_engine_networks.php @@ -0,0 +1,79 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vmwareEngineClient->listVmwareEngineNetworks($request); + + /** @var VmwareEngineNetwork $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VmwareEngineClient::locationName('[PROJECT]', '[LOCATION]'); + + list_vmware_engine_networks_sample($formattedParent); +} +// [END vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/repair_management_dns_zone_binding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/repair_management_dns_zone_binding.php new file mode 100644 index 00000000000..4f16b745033 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/repair_management_dns_zone_binding.php @@ -0,0 +1,93 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->repairManagementDnsZoneBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ManagementDnsZoneBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::managementDnsZoneBindingName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]', + '[MANAGEMENT_DNS_ZONE_BINDING]' + ); + + repair_management_dns_zone_binding_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_RepairManagementDnsZoneBinding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_nsx_credentials.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_nsx_credentials.php new file mode 100644 index 00000000000..315f8986698 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_nsx_credentials.php @@ -0,0 +1,92 @@ +setPrivateCloud($formattedPrivateCloud); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->resetNsxCredentials($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedPrivateCloud = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + reset_nsx_credentials_sample($formattedPrivateCloud); +} +// [END vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_vcenter_credentials.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_vcenter_credentials.php new file mode 100644 index 00000000000..059245dc6f8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/reset_vcenter_credentials.php @@ -0,0 +1,92 @@ +setPrivateCloud($formattedPrivateCloud); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->resetVcenterCredentials($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedPrivateCloud = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + reset_vcenter_credentials_sample($formattedPrivateCloud); +} +// [END vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/revoke_dns_bind_permission.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/revoke_dns_bind_permission.php new file mode 100644 index 00000000000..28fc6301798 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/revoke_dns_bind_permission.php @@ -0,0 +1,93 @@ +setName($formattedName) + ->setPrincipal($principal); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->revokeDnsBindPermission($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DnsBindPermission $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + + revoke_dns_bind_permission_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_RevokeDnsBindPermission_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/set_iam_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/set_iam_policy.php new file mode 100644 index 00000000000..ef6c2393e57 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $vmwareEngineClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END vmwareengine_v1_generated_VmwareEngine_SetIamPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_nsx_credentials.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_nsx_credentials.php new file mode 100644 index 00000000000..9048adc5e1b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_nsx_credentials.php @@ -0,0 +1,80 @@ +setPrivateCloud($formattedPrivateCloud); + + // Call the API and handle any network failures. + try { + /** @var Credentials $response */ + $response = $vmwareEngineClient->showNsxCredentials($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedPrivateCloud = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + show_nsx_credentials_sample($formattedPrivateCloud); +} +// [END vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_vcenter_credentials.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_vcenter_credentials.php new file mode 100644 index 00000000000..2fbf754bbdd --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/show_vcenter_credentials.php @@ -0,0 +1,80 @@ +setPrivateCloud($formattedPrivateCloud); + + // Call the API and handle any network failures. + try { + /** @var Credentials $response */ + $response = $vmwareEngineClient->showVcenterCredentials($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedPrivateCloud = VmwareEngineClient::privateCloudName( + '[PROJECT]', + '[LOCATION]', + '[PRIVATE_CLOUD]' + ); + + show_vcenter_credentials_sample($formattedPrivateCloud); +} +// [END vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/test_iam_permissions.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/test_iam_permissions.php new file mode 100644 index 00000000000..0b557b34222 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/test_iam_permissions.php @@ -0,0 +1,84 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $vmwareEngineClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END vmwareengine_v1_generated_VmwareEngine_TestIamPermissions_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/undelete_private_cloud.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/undelete_private_cloud.php new file mode 100644 index 00000000000..fd623b85b98 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/undelete_private_cloud.php @@ -0,0 +1,90 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->undeletePrivateCloud($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VmwareEngineClient::privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + + undelete_private_cloud_sample($formattedName); +} +// [END vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_cluster.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_cluster.php new file mode 100644 index 00000000000..3c8da159c64 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_cluster.php @@ -0,0 +1,82 @@ +setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new UpdateClusterRequest()) + ->setUpdateMask($updateMask) + ->setCluster($cluster); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateCluster($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateCluster_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_dns_forwarding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_dns_forwarding.php new file mode 100644 index 00000000000..9af11986b17 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_dns_forwarding.php @@ -0,0 +1,101 @@ +setDomain($dnsForwardingForwardingRulesDomain) + ->setNameServers($dnsForwardingForwardingRulesNameServers); + $dnsForwardingForwardingRules = [$forwardingRule,]; + $dnsForwarding = (new DnsForwarding()) + ->setForwardingRules($dnsForwardingForwardingRules); + $updateMask = new FieldMask(); + $request = (new UpdateDnsForwardingRequest()) + ->setDnsForwarding($dnsForwarding) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateDnsForwarding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DnsForwarding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $dnsForwardingForwardingRulesDomain = '[DOMAIN]'; + $dnsForwardingForwardingRulesNameServersElement = '[NAME_SERVERS]'; + + update_dns_forwarding_sample( + $dnsForwardingForwardingRulesDomain, + $dnsForwardingForwardingRulesNameServersElement + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateDnsForwarding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_access_rule.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_access_rule.php new file mode 100644 index 00000000000..cd18fc1938d --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_access_rule.php @@ -0,0 +1,75 @@ +setUpdateMask($updateMask) + ->setExternalAccessRule($externalAccessRule); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateExternalAccessRule($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExternalAccessRule $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateExternalAccessRule_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_address.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_address.php new file mode 100644 index 00000000000..3a6279b1b0b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_external_address.php @@ -0,0 +1,80 @@ +setUpdateMask($updateMask) + ->setExternalAddress($externalAddress); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateExternalAddress($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExternalAddress $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateExternalAddress_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_logging_server.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_logging_server.php new file mode 100644 index 00000000000..efa7dd5f3b3 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_logging_server.php @@ -0,0 +1,110 @@ +setHostname($loggingServerHostname) + ->setPort($loggingServerPort) + ->setProtocol($loggingServerProtocol) + ->setSourceType($loggingServerSourceType); + $request = (new UpdateLoggingServerRequest()) + ->setUpdateMask($updateMask) + ->setLoggingServer($loggingServer); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateLoggingServer($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LoggingServer $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $loggingServerHostname = '[HOSTNAME]'; + $loggingServerPort = 0; + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + + update_logging_server_sample( + $loggingServerHostname, + $loggingServerPort, + $loggingServerProtocol, + $loggingServerSourceType + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateLoggingServer_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_management_dns_zone_binding.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_management_dns_zone_binding.php new file mode 100644 index 00000000000..d4afd6a8736 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_management_dns_zone_binding.php @@ -0,0 +1,75 @@ +setUpdateMask($updateMask) + ->setManagementDnsZoneBinding($managementDnsZoneBinding); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateManagementDnsZoneBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ManagementDnsZoneBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateManagementDnsZoneBinding_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_peering.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_peering.php new file mode 100644 index 00000000000..614a70d2f41 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_peering.php @@ -0,0 +1,118 @@ +setPeerNetwork($networkPeeringPeerNetwork) + ->setPeerNetworkType($networkPeeringPeerNetworkType) + ->setVmwareEngineNetwork($formattedNetworkPeeringVmwareEngineNetwork); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPeeringRequest()) + ->setNetworkPeering($networkPeering) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateNetworkPeering($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NetworkPeering $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $networkPeeringPeerNetwork = '[PEER_NETWORK]'; + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $formattedNetworkPeeringVmwareEngineNetwork = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + + update_network_peering_sample( + $networkPeeringPeerNetwork, + $networkPeeringPeerNetworkType, + $formattedNetworkPeeringVmwareEngineNetwork + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPeering_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_policy.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_policy.php new file mode 100644 index 00000000000..90eccdfd74e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_network_policy.php @@ -0,0 +1,101 @@ +setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPolicyRequest()) + ->setNetworkPolicy($networkPolicy) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateNetworkPolicy($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var NetworkPolicy $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $networkPolicyEdgeServicesCidr = '[EDGE_SERVICES_CIDR]'; + + update_network_policy_sample($networkPolicyEdgeServicesCidr); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_cloud.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_cloud.php new file mode 100644 index 00000000000..d498da0b1e0 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_cloud.php @@ -0,0 +1,118 @@ +setManagementCidr($privateCloudNetworkConfigManagementCidr); + $privateCloudManagementClusterNodeTypeConfigs = []; + $privateCloudManagementCluster = (new ManagementCluster()) + ->setClusterId($privateCloudManagementClusterClusterId) + ->setNodeTypeConfigs($privateCloudManagementClusterNodeTypeConfigs); + $privateCloud = (new PrivateCloud()) + ->setNetworkConfig($privateCloudNetworkConfig) + ->setManagementCluster($privateCloudManagementCluster); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateCloudRequest()) + ->setPrivateCloud($privateCloud) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updatePrivateCloud($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateCloud $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $privateCloudNetworkConfigManagementCidr = '[MANAGEMENT_CIDR]'; + $privateCloudManagementClusterClusterId = '[CLUSTER_ID]'; + + update_private_cloud_sample( + $privateCloudNetworkConfigManagementCidr, + $privateCloudManagementClusterClusterId + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_connection.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_connection.php new file mode 100644 index 00000000000..61c377ec295 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_private_connection.php @@ -0,0 +1,129 @@ +setVmwareEngineNetwork($formattedPrivateConnectionVmwareEngineNetwork) + ->setType($privateConnectionType) + ->setServiceNetwork($formattedPrivateConnectionServiceNetwork); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateConnectionRequest()) + ->setPrivateConnection($privateConnection) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updatePrivateConnection($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PrivateConnection $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedPrivateConnectionVmwareEngineNetwork = VmwareEngineClient::vmwareEngineNetworkName( + '[PROJECT]', + '[LOCATION]', + '[VMWARE_ENGINE_NETWORK]' + ); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $formattedPrivateConnectionServiceNetwork = VmwareEngineClient::networkName( + '[PROJECT]', + '[NETWORK]' + ); + + update_private_connection_sample( + $formattedPrivateConnectionVmwareEngineNetwork, + $privateConnectionType, + $formattedPrivateConnectionServiceNetwork + ); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_subnet.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_subnet.php new file mode 100644 index 00000000000..648055bfa7f --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_subnet.php @@ -0,0 +1,79 @@ +setUpdateMask($updateMask) + ->setSubnet($subnet); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateSubnet($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Subnet $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_vmware_engine_network.php b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_vmware_engine_network.php new file mode 100644 index 00000000000..56bcc1eb2e8 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/samples/V1/VmwareEngineClient/update_vmware_engine_network.php @@ -0,0 +1,90 @@ +setType($vmwareEngineNetworkType); + $updateMask = new FieldMask(); + $request = (new UpdateVmwareEngineNetworkRequest()) + ->setVmwareEngineNetwork($vmwareEngineNetwork) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vmwareEngineClient->updateVmwareEngineNetwork($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var VmwareEngineNetwork $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $vmwareEngineNetworkType = Type::TYPE_UNSPECIFIED; + + update_vmware_engine_network_sample($vmwareEngineNetworkType); +} +// [END vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_sync] diff --git a/owl-bot-staging/VmwareEngine/v1/src/V1/Client/VmwareEngineClient.php b/owl-bot-staging/VmwareEngine/v1/src/V1/Client/VmwareEngineClient.php new file mode 100644 index 00000000000..6ab12b02e56 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/src/V1/Client/VmwareEngineClient.php @@ -0,0 +1,2978 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vmware_engine_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vmware_engine_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vmware_engine_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vmware_engine_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName(string $project, string $location, string $privateCloud, string $cluster): string + { + return self::getPathTemplate('cluster')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * dns_bind_permission resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted dns_bind_permission resource. + */ + public static function dnsBindPermissionName(string $project, string $location): string + { + return self::getPathTemplate('dnsBindPermission')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * dns_forwarding resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * + * @return string The formatted dns_forwarding resource. + */ + public static function dnsForwardingName(string $project, string $location, string $privateCloud): string + { + return self::getPathTemplate('dnsForwarding')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * external_access_rule resource. + * + * @param string $project + * @param string $location + * @param string $networkPolicy + * @param string $externalAccessRule + * + * @return string The formatted external_access_rule resource. + */ + public static function externalAccessRuleName(string $project, string $location, string $networkPolicy, string $externalAccessRule): string + { + return self::getPathTemplate('externalAccessRule')->render([ + 'project' => $project, + 'location' => $location, + 'network_policy' => $networkPolicy, + 'external_access_rule' => $externalAccessRule, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * external_address resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $externalAddress + * + * @return string The formatted external_address resource. + */ + public static function externalAddressName(string $project, string $location, string $privateCloud, string $externalAddress): string + { + return self::getPathTemplate('externalAddress')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'external_address' => $externalAddress, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * hcx_activation_key resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $hcxActivationKey + * + * @return string The formatted hcx_activation_key resource. + */ + public static function hcxActivationKeyName(string $project, string $location, string $privateCloud, string $hcxActivationKey): string + { + return self::getPathTemplate('hcxActivationKey')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'hcx_activation_key' => $hcxActivationKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * logging_server resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $loggingServer + * + * @return string The formatted logging_server resource. + */ + public static function loggingServerName(string $project, string $location, string $privateCloud, string $loggingServer): string + { + return self::getPathTemplate('loggingServer')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'logging_server' => $loggingServer, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * management_dns_zone_binding resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $managementDnsZoneBinding + * + * @return string The formatted management_dns_zone_binding resource. + */ + public static function managementDnsZoneBindingName(string $project, string $location, string $privateCloud, string $managementDnsZoneBinding): string + { + return self::getPathTemplate('managementDnsZoneBinding')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'management_dns_zone_binding' => $managementDnsZoneBinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName(string $project, string $network): string + { + return self::getPathTemplate('network')->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * network_peering resource. + * + * @param string $project + * @param string $location + * @param string $networkPeering + * + * @return string The formatted network_peering resource. + */ + public static function networkPeeringName(string $project, string $location, string $networkPeering): string + { + return self::getPathTemplate('networkPeering')->render([ + 'project' => $project, + 'location' => $location, + 'network_peering' => $networkPeering, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * network_policy resource. + * + * @param string $project + * @param string $location + * @param string $networkPolicy + * + * @return string The formatted network_policy resource. + */ + public static function networkPolicyName(string $project, string $location, string $networkPolicy): string + { + return self::getPathTemplate('networkPolicy')->render([ + 'project' => $project, + 'location' => $location, + 'network_policy' => $networkPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $cluster + * @param string $node + * + * @return string The formatted node resource. + */ + public static function nodeName(string $project, string $location, string $privateCloud, string $cluster, string $node): string + { + return self::getPathTemplate('node')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'cluster' => $cluster, + 'node' => $node, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node_type + * resource. + * + * @param string $project + * @param string $location + * @param string $nodeType + * + * @return string The formatted node_type resource. + */ + public static function nodeTypeName(string $project, string $location, string $nodeType): string + { + return self::getPathTemplate('nodeType')->render([ + 'project' => $project, + 'location' => $location, + 'node_type' => $nodeType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * private_cloud resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * + * @return string The formatted private_cloud resource. + */ + public static function privateCloudName(string $project, string $location, string $privateCloud): string + { + return self::getPathTemplate('privateCloud')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * private_connection resource. + * + * @param string $project + * @param string $location + * @param string $privateConnection + * + * @return string The formatted private_connection resource. + */ + public static function privateConnectionName(string $project, string $location, string $privateConnection): string + { + return self::getPathTemplate('privateConnection')->render([ + 'project' => $project, + 'location' => $location, + 'private_connection' => $privateConnection, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnet + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $subnet + * + * @return string The formatted subnet resource. + */ + public static function subnetName(string $project, string $location, string $privateCloud, string $subnet): string + { + return self::getPathTemplate('subnet')->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'subnet' => $subnet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vmware_engine_network resource. + * + * @param string $project + * @param string $location + * @param string $vmwareEngineNetwork + * + * @return string The formatted vmware_engine_network resource. + */ + public static function vmwareEngineNetworkName(string $project, string $location, string $vmwareEngineNetwork): string + { + return self::getPathTemplate('vmwareEngineNetwork')->render([ + 'project' => $project, + 'location' => $location, + 'vmware_engine_network' => $vmwareEngineNetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cluster: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster} + * - dnsBindPermission: projects/{project}/locations/{location}/dnsBindPermission + * - dnsForwarding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding + * - externalAccessRule: projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule} + * - externalAddress: projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address} + * - hcxActivationKey: projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key} + * - location: projects/{project}/locations/{location} + * - loggingServer: projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server} + * - managementDnsZoneBinding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding} + * - network: projects/{project}/global/networks/{network} + * - networkPeering: projects/{project}/locations/{location}/networkPeerings/{network_peering} + * - networkPolicy: projects/{project}/locations/{location}/networkPolicies/{network_policy} + * - node: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node} + * - nodeType: projects/{project}/locations/{location}/nodeTypes/{node_type} + * - privateCloud: projects/{project}/locations/{location}/privateClouds/{private_cloud} + * - privateConnection: projects/{project}/locations/{location}/privateConnections/{private_connection} + * - subnet: projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet} + * - vmwareEngineNetwork: projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'vmwareengine.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new cluster in a given private cloud. + * Creating a new cluster provides additional nodes for + * use in the parent private cloud and requires sufficient [node + * quota](https://cloud.google.com/vmware-engine/quotas). + * + * The async variant is {@see VmwareEngineClient::createClusterAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_cluster.php + * + * @param CreateClusterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createCluster(CreateClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateCluster', $request, $callOptions)->wait(); + } + + /** + * Creates a new external access rule in a given network policy. + * + * The async variant is {@see VmwareEngineClient::createExternalAccessRuleAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/create_external_access_rule.php + * + * @param CreateExternalAccessRuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createExternalAccessRule(CreateExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateExternalAccessRule', $request, $callOptions)->wait(); + } + + /** + * Creates a new `ExternalAddress` resource in a given private cloud. The + * network policy that corresponds to the private cloud must have the external + * IP address network service enabled (`NetworkPolicy.external_ip`). + * + * The async variant is {@see VmwareEngineClient::createExternalAddressAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_external_address.php + * + * @param CreateExternalAddressRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createExternalAddress(CreateExternalAddressRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateExternalAddress', $request, $callOptions)->wait(); + } + + /** + * Creates a new HCX activation key in a given private cloud. + * + * The async variant is {@see VmwareEngineClient::createHcxActivationKeyAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_hcx_activation_key.php + * + * @param CreateHcxActivationKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createHcxActivationKey(CreateHcxActivationKeyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateHcxActivationKey', $request, $callOptions)->wait(); + } + + /** + * Create a new logging server for a given private cloud. + * + * The async variant is {@see VmwareEngineClient::createLoggingServerAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_logging_server.php + * + * @param CreateLoggingServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createLoggingServer(CreateLoggingServerRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateLoggingServer', $request, $callOptions)->wait(); + } + + /** + * Creates a new `ManagementDnsZoneBinding` resource in a private cloud. + * This RPC creates the DNS binding and the resource that represents the + * DNS binding of the consumer VPC network to the management DNS zone. A + * management DNS zone is the Cloud DNS cross-project binding zone that + * VMware Engine creates for each private cloud. It contains FQDNs and + * corresponding IP addresses for the private cloud's ESXi hosts and + * management VM appliances like vCenter and NSX Manager. + * + * The async variant is + * {@see VmwareEngineClient::createManagementDnsZoneBindingAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_management_dns_zone_binding.php + * + * @param CreateManagementDnsZoneBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createManagementDnsZoneBinding(CreateManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateManagementDnsZoneBinding', $request, $callOptions)->wait(); + } + + /** + * Creates a new network peering between the peer network and VMware Engine + * network provided in a `NetworkPeering` resource. NetworkPeering is a + * global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::createNetworkPeeringAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_network_peering.php + * + * @param CreateNetworkPeeringRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNetworkPeering(CreateNetworkPeeringRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateNetworkPeering', $request, $callOptions)->wait(); + } + + /** + * Creates a new network policy in a given VMware Engine network of a + * project and location (region). A new network policy cannot be created if + * another network policy already exists in the same scope. + * + * The async variant is {@see VmwareEngineClient::createNetworkPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_network_policy.php + * + * @param CreateNetworkPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createNetworkPolicy(CreateNetworkPolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateNetworkPolicy', $request, $callOptions)->wait(); + } + + /** + * Creates a new `PrivateCloud` resource in a given project and location. + * Private clouds of type `STANDARD` and + * `TIME_LIMITED` are zonal resources, `STRETCHED` private clouds are + * regional. + * Creating a private cloud also creates a [management + * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) + * for that private cloud. + * + * The async variant is {@see VmwareEngineClient::createPrivateCloudAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_private_cloud.php + * + * @param CreatePrivateCloudRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPrivateCloud(CreatePrivateCloudRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreatePrivateCloud', $request, $callOptions)->wait(); + } + + /** + * Creates a new private connection that can be used for accessing private + * Clouds. + * + * The async variant is {@see VmwareEngineClient::createPrivateConnectionAsync()} . + * + * @example samples/V1/VmwareEngineClient/create_private_connection.php + * + * @param CreatePrivateConnectionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPrivateConnection(CreatePrivateConnectionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreatePrivateConnection', $request, $callOptions)->wait(); + } + + /** + * Creates a new VMware Engine network that can be used by a private cloud. + * + * The async variant is {@see VmwareEngineClient::createVmwareEngineNetworkAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/create_vmware_engine_network.php + * + * @param CreateVmwareEngineNetworkRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createVmwareEngineNetwork(CreateVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateVmwareEngineNetwork', $request, $callOptions)->wait(); + } + + /** + * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or + * gracefully shut down any workloads running on the cluster before deletion. + * You cannot delete the management cluster of a private cloud using this + * method. + * + * The async variant is {@see VmwareEngineClient::deleteClusterAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_cluster.php + * + * @param DeleteClusterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteCluster(DeleteClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteCluster', $request, $callOptions)->wait(); + } + + /** + * Deletes a single external access rule. + * + * The async variant is {@see VmwareEngineClient::deleteExternalAccessRuleAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/delete_external_access_rule.php + * + * @param DeleteExternalAccessRuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteExternalAccessRule(DeleteExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteExternalAccessRule', $request, $callOptions)->wait(); + } + + /** + * Deletes a single external IP address. When you delete an external IP + * address, connectivity between the external IP address and the corresponding + * internal IP address is lost. + * + * The async variant is {@see VmwareEngineClient::deleteExternalAddressAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_external_address.php + * + * @param DeleteExternalAddressRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteExternalAddress(DeleteExternalAddressRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteExternalAddress', $request, $callOptions)->wait(); + } + + /** + * Deletes a single logging server. + * + * The async variant is {@see VmwareEngineClient::deleteLoggingServerAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_logging_server.php + * + * @param DeleteLoggingServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteLoggingServer(DeleteLoggingServerRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteLoggingServer', $request, $callOptions)->wait(); + } + + /** + * Deletes a `ManagementDnsZoneBinding` resource. When a management DNS zone + * binding is deleted, the corresponding consumer VPC network is no longer + * bound to the management DNS zone. + * + * The async variant is + * {@see VmwareEngineClient::deleteManagementDnsZoneBindingAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_management_dns_zone_binding.php + * + * @param DeleteManagementDnsZoneBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteManagementDnsZoneBinding(DeleteManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteManagementDnsZoneBinding', $request, $callOptions)->wait(); + } + + /** + * Deletes a `NetworkPeering` resource. When a network peering is deleted for + * a VMware Engine network, the peer network becomes inaccessible to that + * VMware Engine network. NetworkPeering is a global resource and location can + * only be global. + * + * The async variant is {@see VmwareEngineClient::deleteNetworkPeeringAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_network_peering.php + * + * @param DeleteNetworkPeeringRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteNetworkPeering(DeleteNetworkPeeringRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteNetworkPeering', $request, $callOptions)->wait(); + } + + /** + * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted + * when `NetworkService.state` is set to `RECONCILING` for either its external + * IP or internet access service. + * + * The async variant is {@see VmwareEngineClient::deleteNetworkPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_network_policy.php + * + * @param DeleteNetworkPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteNetworkPolicy(DeleteNetworkPolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteNetworkPolicy', $request, $callOptions)->wait(); + } + + /** + * Schedules a `PrivateCloud` resource for deletion. + * + * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` + * set to `DELETED` and `expireTime` set to the time when deletion is final + * and can no longer be reversed. The delete operation is marked as done + * as soon as the `PrivateCloud` is successfully scheduled for deletion + * (this also applies when `delayHours` is set to zero), and the operation is + * not kept in pending state until `PrivateCloud` is purged. + * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before + * the `expireTime` elapses. When `expireTime` is reached, deletion is final + * and all private cloud resources are irreversibly removed and billing stops. + * During the final removal process, `PrivateCloud.state` is set to `PURGING`. + * `PrivateCloud` can be polled using standard `GET` method for the whole + * period of deletion and purging. It will not be returned only + * when it is completely purged. + * + * The async variant is {@see VmwareEngineClient::deletePrivateCloudAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_private_cloud.php + * + * @param DeletePrivateCloudRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deletePrivateCloud(DeletePrivateCloudRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeletePrivateCloud', $request, $callOptions)->wait(); + } + + /** + * Deletes a `PrivateConnection` resource. When a private connection is + * deleted for a VMware Engine network, the connected network becomes + * inaccessible to that VMware Engine network. + * + * The async variant is {@see VmwareEngineClient::deletePrivateConnectionAsync()} . + * + * @example samples/V1/VmwareEngineClient/delete_private_connection.php + * + * @param DeletePrivateConnectionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deletePrivateConnection(DeletePrivateConnectionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeletePrivateConnection', $request, $callOptions)->wait(); + } + + /** + * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware + * Engine network after all resources that refer to it are deleted. For + * example, a private cloud, a network peering, and a network policy can all + * refer to the same VMware Engine network. + * + * The async variant is {@see VmwareEngineClient::deleteVmwareEngineNetworkAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/delete_vmware_engine_network.php + * + * @param DeleteVmwareEngineNetworkRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteVmwareEngineNetwork(DeleteVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteVmwareEngineNetwork', $request, $callOptions)->wait(); + } + + /** + * Lists external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * The async variant is + * {@see VmwareEngineClient::fetchNetworkPolicyExternalAddressesAsync()} . + * + * @example samples/V1/VmwareEngineClient/fetch_network_policy_external_addresses.php + * + * @param FetchNetworkPolicyExternalAddressesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchNetworkPolicyExternalAddresses(FetchNetworkPolicyExternalAddressesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('FetchNetworkPolicyExternalAddresses', $request, $callOptions); + } + + /** + * Retrieves a `Cluster` resource by its resource name. + * + * The async variant is {@see VmwareEngineClient::getClusterAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_cluster.php + * + * @param GetClusterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Cluster + * + * @throws ApiException Thrown if the API call fails. + */ + public function getCluster(GetClusterRequest $request, array $callOptions = []): Cluster + { + return $this->startApiCall('GetCluster', $request, $callOptions)->wait(); + } + + /** + * Gets all the principals having bind permission on the intranet VPC + * associated with the consumer project granted by the Grant API. + * DnsBindPermission is a global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::getDnsBindPermissionAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_dns_bind_permission.php + * + * @param GetDnsBindPermissionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 DnsBindPermission + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDnsBindPermission(GetDnsBindPermissionRequest $request, array $callOptions = []): DnsBindPermission + { + return $this->startApiCall('GetDnsBindPermission', $request, $callOptions)->wait(); + } + + /** + * Gets details of the `DnsForwarding` config. + * + * The async variant is {@see VmwareEngineClient::getDnsForwardingAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_dns_forwarding.php + * + * @param GetDnsForwardingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 DnsForwarding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDnsForwarding(GetDnsForwardingRequest $request, array $callOptions = []): DnsForwarding + { + return $this->startApiCall('GetDnsForwarding', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single external access rule. + * + * The async variant is {@see VmwareEngineClient::getExternalAccessRuleAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_external_access_rule.php + * + * @param GetExternalAccessRuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ExternalAccessRule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getExternalAccessRule(GetExternalAccessRuleRequest $request, array $callOptions = []): ExternalAccessRule + { + return $this->startApiCall('GetExternalAccessRule', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single external IP address. + * + * The async variant is {@see VmwareEngineClient::getExternalAddressAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_external_address.php + * + * @param GetExternalAddressRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ExternalAddress + * + * @throws ApiException Thrown if the API call fails. + */ + public function getExternalAddress(GetExternalAddressRequest $request, array $callOptions = []): ExternalAddress + { + return $this->startApiCall('GetExternalAddress', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `HcxActivationKey` resource by its resource name. + * + * The async variant is {@see VmwareEngineClient::getHcxActivationKeyAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_hcx_activation_key.php + * + * @param GetHcxActivationKeyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 HcxActivationKey + * + * @throws ApiException Thrown if the API call fails. + */ + public function getHcxActivationKey(GetHcxActivationKeyRequest $request, array $callOptions = []): HcxActivationKey + { + return $this->startApiCall('GetHcxActivationKey', $request, $callOptions)->wait(); + } + + /** + * Gets details of a logging server. + * + * The async variant is {@see VmwareEngineClient::getLoggingServerAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_logging_server.php + * + * @param GetLoggingServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 LoggingServer + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLoggingServer(GetLoggingServerRequest $request, array $callOptions = []): LoggingServer + { + return $this->startApiCall('GetLoggingServer', $request, $callOptions)->wait(); + } + + /** + * Retrieves a 'ManagementDnsZoneBinding' resource by its resource name. + * + * The async variant is + * {@see VmwareEngineClient::getManagementDnsZoneBindingAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_management_dns_zone_binding.php + * + * @param GetManagementDnsZoneBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ManagementDnsZoneBinding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getManagementDnsZoneBinding(GetManagementDnsZoneBindingRequest $request, array $callOptions = []): ManagementDnsZoneBinding + { + return $this->startApiCall('GetManagementDnsZoneBinding', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `NetworkPeering` resource by its resource name. The resource + * contains details of the network peering, such as peered + * networks, import and export custom route configurations, and peering state. + * NetworkPeering is a global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::getNetworkPeeringAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_network_peering.php + * + * @param GetNetworkPeeringRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 NetworkPeering + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNetworkPeering(GetNetworkPeeringRequest $request, array $callOptions = []): NetworkPeering + { + return $this->startApiCall('GetNetworkPeering', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `NetworkPolicy` resource by its resource name. + * + * The async variant is {@see VmwareEngineClient::getNetworkPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_network_policy.php + * + * @param GetNetworkPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 NetworkPolicy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNetworkPolicy(GetNetworkPolicyRequest $request, array $callOptions = []): NetworkPolicy + { + return $this->startApiCall('GetNetworkPolicy', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single node. + * + * The async variant is {@see VmwareEngineClient::getNodeAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_node.php + * + * @param GetNodeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Node + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNode(GetNodeRequest $request, array $callOptions = []): Node + { + return $this->startApiCall('GetNode', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single `NodeType`. + * + * The async variant is {@see VmwareEngineClient::getNodeTypeAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_node_type.php + * + * @param GetNodeTypeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 NodeType + * + * @throws ApiException Thrown if the API call fails. + */ + public function getNodeType(GetNodeTypeRequest $request, array $callOptions = []): NodeType + { + return $this->startApiCall('GetNodeType', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `PrivateCloud` resource by its resource name. + * + * The async variant is {@see VmwareEngineClient::getPrivateCloudAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_private_cloud.php + * + * @param GetPrivateCloudRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PrivateCloud + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPrivateCloud(GetPrivateCloudRequest $request, array $callOptions = []): PrivateCloud + { + return $this->startApiCall('GetPrivateCloud', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `PrivateConnection` resource by its resource name. The resource + * contains details of the private connection, such as connected + * network, routing mode and state. + * + * The async variant is {@see VmwareEngineClient::getPrivateConnectionAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_private_connection.php + * + * @param GetPrivateConnectionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PrivateConnection + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPrivateConnection(GetPrivateConnectionRequest $request, array $callOptions = []): PrivateConnection + { + return $this->startApiCall('GetPrivateConnection', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single subnet. + * + * The async variant is {@see VmwareEngineClient::getSubnetAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_subnet.php + * + * @param GetSubnetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Subnet + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSubnet(GetSubnetRequest $request, array $callOptions = []): Subnet + { + return $this->startApiCall('GetSubnet', $request, $callOptions)->wait(); + } + + /** + * Retrieves a `VmwareEngineNetwork` resource by its resource name. The + * resource contains details of the VMware Engine network, such as its VMware + * Engine network type, peered networks in a service project, and state + * (for example, `CREATING`, `ACTIVE`, `DELETING`). + * + * The async variant is {@see VmwareEngineClient::getVmwareEngineNetworkAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_vmware_engine_network.php + * + * @param GetVmwareEngineNetworkRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 VmwareEngineNetwork + * + * @throws ApiException Thrown if the API call fails. + */ + public function getVmwareEngineNetwork(GetVmwareEngineNetworkRequest $request, array $callOptions = []): VmwareEngineNetwork + { + return $this->startApiCall('GetVmwareEngineNetwork', $request, $callOptions)->wait(); + } + + /** + * Grants the bind permission to the customer provided principal(user / + * service account) to bind their DNS zone with the intranet VPC associated + * with the project. DnsBindPermission is a global resource and location can + * only be global. + * + * The async variant is {@see VmwareEngineClient::grantDnsBindPermissionAsync()} . + * + * @example samples/V1/VmwareEngineClient/grant_dns_bind_permission.php + * + * @param GrantDnsBindPermissionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function grantDnsBindPermission(GrantDnsBindPermissionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('GrantDnsBindPermission', $request, $callOptions)->wait(); + } + + /** + * Lists `Cluster` resources in a given private cloud. + * + * The async variant is {@see VmwareEngineClient::listClustersAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_clusters.php + * + * @param ListClustersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listClusters(ListClustersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListClusters', $request, $callOptions); + } + + /** + * Lists `ExternalAccessRule` resources in the specified network policy. + * + * The async variant is {@see VmwareEngineClient::listExternalAccessRulesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_external_access_rules.php + * + * @param ListExternalAccessRulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listExternalAccessRules(ListExternalAccessRulesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListExternalAccessRules', $request, $callOptions); + } + + /** + * Lists external IP addresses assigned to VMware workload VMs in a given + * private cloud. + * + * The async variant is {@see VmwareEngineClient::listExternalAddressesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_external_addresses.php + * + * @param ListExternalAddressesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listExternalAddresses(ListExternalAddressesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListExternalAddresses', $request, $callOptions); + } + + /** + * Lists `HcxActivationKey` resources in a given private cloud. + * + * The async variant is {@see VmwareEngineClient::listHcxActivationKeysAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_hcx_activation_keys.php + * + * @param ListHcxActivationKeysRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listHcxActivationKeys(ListHcxActivationKeysRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListHcxActivationKeys', $request, $callOptions); + } + + /** + * Lists logging servers configured for a given private + * cloud. + * + * The async variant is {@see VmwareEngineClient::listLoggingServersAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_logging_servers.php + * + * @param ListLoggingServersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLoggingServers(ListLoggingServersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLoggingServers', $request, $callOptions); + } + + /** + * Lists Consumer VPCs bound to Management DNS Zone of a given private cloud. + * + * The async variant is + * {@see VmwareEngineClient::listManagementDnsZoneBindingsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_management_dns_zone_bindings.php + * + * @param ListManagementDnsZoneBindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listManagementDnsZoneBindings(ListManagementDnsZoneBindingsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListManagementDnsZoneBindings', $request, $callOptions); + } + + /** + * Lists `NetworkPeering` resources in a given project. NetworkPeering is a + * global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::listNetworkPeeringsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_network_peerings.php + * + * @param ListNetworkPeeringsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNetworkPeerings(ListNetworkPeeringsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNetworkPeerings', $request, $callOptions); + } + + /** + * Lists `NetworkPolicy` resources in a specified project and location. + * + * The async variant is {@see VmwareEngineClient::listNetworkPoliciesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_network_policies.php + * + * @param ListNetworkPoliciesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNetworkPolicies(ListNetworkPoliciesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNetworkPolicies', $request, $callOptions); + } + + /** + * Lists node types + * + * The async variant is {@see VmwareEngineClient::listNodeTypesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_node_types.php + * + * @param ListNodeTypesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNodeTypes(ListNodeTypesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNodeTypes', $request, $callOptions); + } + + /** + * Lists nodes in a given cluster. + * + * The async variant is {@see VmwareEngineClient::listNodesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_nodes.php + * + * @param ListNodesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listNodes(ListNodesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListNodes', $request, $callOptions); + } + + /** + * Lists the network peering routes exchanged over a peering connection. + * NetworkPeering is a global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::listPeeringRoutesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_peering_routes.php + * + * @param ListPeeringRoutesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPeeringRoutes(ListPeeringRoutesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPeeringRoutes', $request, $callOptions); + } + + /** + * Lists `PrivateCloud` resources in a given project and location. + * + * The async variant is {@see VmwareEngineClient::listPrivateCloudsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_private_clouds.php + * + * @param ListPrivateCloudsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPrivateClouds(ListPrivateCloudsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPrivateClouds', $request, $callOptions); + } + + /** + * Lists the private connection routes exchanged over a peering connection. + * + * The async variant is + * {@see VmwareEngineClient::listPrivateConnectionPeeringRoutesAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_private_connection_peering_routes.php + * + * @param ListPrivateConnectionPeeringRoutesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPrivateConnectionPeeringRoutes(ListPrivateConnectionPeeringRoutesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPrivateConnectionPeeringRoutes', $request, $callOptions); + } + + /** + * Lists `PrivateConnection` resources in a given project and location. + * + * The async variant is {@see VmwareEngineClient::listPrivateConnectionsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_private_connections.php + * + * @param ListPrivateConnectionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPrivateConnections(ListPrivateConnectionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPrivateConnections', $request, $callOptions); + } + + /** + * Lists subnets in a given private cloud. + * + * The async variant is {@see VmwareEngineClient::listSubnetsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_subnets.php + * + * @param ListSubnetsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSubnets(ListSubnetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSubnets', $request, $callOptions); + } + + /** + * Lists `VmwareEngineNetwork` resources in a given project and location. + * + * The async variant is {@see VmwareEngineClient::listVmwareEngineNetworksAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/list_vmware_engine_networks.php + * + * @param ListVmwareEngineNetworksRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listVmwareEngineNetworks(ListVmwareEngineNetworksRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListVmwareEngineNetworks', $request, $callOptions); + } + + /** + * Retries to create a `ManagementDnsZoneBinding` resource that is + * in failed state. + * + * The async variant is + * {@see VmwareEngineClient::repairManagementDnsZoneBindingAsync()} . + * + * @example samples/V1/VmwareEngineClient/repair_management_dns_zone_binding.php + * + * @param RepairManagementDnsZoneBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function repairManagementDnsZoneBinding(RepairManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RepairManagementDnsZoneBinding', $request, $callOptions)->wait(); + } + + /** + * Resets credentials of the NSX appliance. + * + * The async variant is {@see VmwareEngineClient::resetNsxCredentialsAsync()} . + * + * @example samples/V1/VmwareEngineClient/reset_nsx_credentials.php + * + * @param ResetNsxCredentialsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function resetNsxCredentials(ResetNsxCredentialsRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ResetNsxCredentials', $request, $callOptions)->wait(); + } + + /** + * Resets credentials of the Vcenter appliance. + * + * The async variant is {@see VmwareEngineClient::resetVcenterCredentialsAsync()} . + * + * @example samples/V1/VmwareEngineClient/reset_vcenter_credentials.php + * + * @param ResetVcenterCredentialsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function resetVcenterCredentials(ResetVcenterCredentialsRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ResetVcenterCredentials', $request, $callOptions)->wait(); + } + + /** + * Revokes the bind permission from the customer provided principal(user / + * service account) on the intranet VPC associated with the consumer project. + * DnsBindPermission is a global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::revokeDnsBindPermissionAsync()} . + * + * @example samples/V1/VmwareEngineClient/revoke_dns_bind_permission.php + * + * @param RevokeDnsBindPermissionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function revokeDnsBindPermission(RevokeDnsBindPermissionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RevokeDnsBindPermission', $request, $callOptions)->wait(); + } + + /** + * Gets details of credentials for NSX appliance. + * + * The async variant is {@see VmwareEngineClient::showNsxCredentialsAsync()} . + * + * @example samples/V1/VmwareEngineClient/show_nsx_credentials.php + * + * @param ShowNsxCredentialsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Credentials + * + * @throws ApiException Thrown if the API call fails. + */ + public function showNsxCredentials(ShowNsxCredentialsRequest $request, array $callOptions = []): Credentials + { + return $this->startApiCall('ShowNsxCredentials', $request, $callOptions)->wait(); + } + + /** + * Gets details of credentials for Vcenter appliance. + * + * The async variant is {@see VmwareEngineClient::showVcenterCredentialsAsync()} . + * + * @example samples/V1/VmwareEngineClient/show_vcenter_credentials.php + * + * @param ShowVcenterCredentialsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Credentials + * + * @throws ApiException Thrown if the API call fails. + */ + public function showVcenterCredentials(ShowVcenterCredentialsRequest $request, array $callOptions = []): Credentials + { + return $this->startApiCall('ShowVcenterCredentials', $request, $callOptions)->wait(); + } + + /** + * Restores a private cloud that was previously scheduled for deletion by + * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has + * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to + * the time when deletion can no longer be reversed. + * + * The async variant is {@see VmwareEngineClient::undeletePrivateCloudAsync()} . + * + * @example samples/V1/VmwareEngineClient/undelete_private_cloud.php + * + * @param UndeletePrivateCloudRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function undeletePrivateCloud(UndeletePrivateCloudRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UndeletePrivateCloud', $request, $callOptions)->wait(); + } + + /** + * Modifies a `Cluster` resource. Only fields specified in `updateMask` are + * applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * The async variant is {@see VmwareEngineClient::updateClusterAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_cluster.php + * + * @param UpdateClusterRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateCluster(UpdateClusterRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateCluster', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of the `DnsForwarding` config, like associated + * domains. Only fields specified in `update_mask` are applied. + * + * The async variant is {@see VmwareEngineClient::updateDnsForwardingAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_dns_forwarding.php + * + * @param UpdateDnsForwardingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDnsForwarding(UpdateDnsForwardingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDnsForwarding', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single external access rule. + * Only fields specified in `update_mask` are applied. + * + * The async variant is {@see VmwareEngineClient::updateExternalAccessRuleAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/update_external_access_rule.php + * + * @param UpdateExternalAccessRuleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateExternalAccessRule(UpdateExternalAccessRuleRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateExternalAccessRule', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single external IP address. + * Only fields specified in `update_mask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * The async variant is {@see VmwareEngineClient::updateExternalAddressAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_external_address.php + * + * @param UpdateExternalAddressRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateExternalAddress(UpdateExternalAddressRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateExternalAddress', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single logging server. + * Only fields specified in `update_mask` are applied. + * + * The async variant is {@see VmwareEngineClient::updateLoggingServerAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_logging_server.php + * + * @param UpdateLoggingServerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateLoggingServer(UpdateLoggingServerRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateLoggingServer', $request, $callOptions)->wait(); + } + + /** + * Updates a `ManagementDnsZoneBinding` resource. + * Only fields specified in `update_mask` are applied. + * + * The async variant is + * {@see VmwareEngineClient::updateManagementDnsZoneBindingAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_management_dns_zone_binding.php + * + * @param UpdateManagementDnsZoneBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateManagementDnsZoneBinding(UpdateManagementDnsZoneBindingRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateManagementDnsZoneBinding', $request, $callOptions)->wait(); + } + + /** + * Modifies a `NetworkPeering` resource. Only the `description` field can be + * updated. Only fields specified in `updateMask` are applied. NetworkPeering + * is a global resource and location can only be global. + * + * The async variant is {@see VmwareEngineClient::updateNetworkPeeringAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_network_peering.php + * + * @param UpdateNetworkPeeringRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNetworkPeering(UpdateNetworkPeeringRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateNetworkPeering', $request, $callOptions)->wait(); + } + + /** + * Modifies a `NetworkPolicy` resource. Only the following fields can be + * updated: `internet_access`, `external_ip`, `edge_services_cidr`. + * Only fields specified in `updateMask` are applied. When updating a network + * policy, the external IP network service can only be disabled if there are + * no external IP addresses present in the scope of the policy. Also, a + * `NetworkService` cannot be updated when `NetworkService.state` is set + * to `RECONCILING`. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * The async variant is {@see VmwareEngineClient::updateNetworkPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_network_policy.php + * + * @param UpdateNetworkPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateNetworkPolicy(UpdateNetworkPolicyRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateNetworkPolicy', $request, $callOptions)->wait(); + } + + /** + * Modifies a `PrivateCloud` resource. Only the following fields can be + * updated: `description`. + * Only fields specified in `updateMask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * The async variant is {@see VmwareEngineClient::updatePrivateCloudAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_private_cloud.php + * + * @param UpdatePrivateCloudRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updatePrivateCloud(UpdatePrivateCloudRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdatePrivateCloud', $request, $callOptions)->wait(); + } + + /** + * Modifies a `PrivateConnection` resource. Only `description` and + * `routing_mode` fields can be updated. Only fields specified in `updateMask` + * are applied. + * + * The async variant is {@see VmwareEngineClient::updatePrivateConnectionAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_private_connection.php + * + * @param UpdatePrivateConnectionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updatePrivateConnection(UpdatePrivateConnectionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdatePrivateConnection', $request, $callOptions)->wait(); + } + + /** + * Updates the parameters of a single subnet. Only fields specified in + * `update_mask` are applied. + * + * *Note*: This API is synchronous and always returns a successful + * `google.longrunning.Operation` (LRO). The returned LRO will only have + * `done` and `response` fields. + * + * The async variant is {@see VmwareEngineClient::updateSubnetAsync()} . + * + * @example samples/V1/VmwareEngineClient/update_subnet.php + * + * @param UpdateSubnetRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSubnet(UpdateSubnetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateSubnet', $request, $callOptions)->wait(); + } + + /** + * Modifies a VMware Engine network resource. Only the following fields can be + * updated: `description`. Only fields specified in `updateMask` are + * applied. + * + * The async variant is {@see VmwareEngineClient::updateVmwareEngineNetworkAsync()} + * . + * + * @example samples/V1/VmwareEngineClient/update_vmware_engine_network.php + * + * @param UpdateVmwareEngineNetworkRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateVmwareEngineNetwork(UpdateVmwareEngineNetworkRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateVmwareEngineNetwork', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see VmwareEngineClient::getLocationAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see VmwareEngineClient::listLocationsAsync()} . + * + * @example samples/V1/VmwareEngineClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * The async variant is {@see VmwareEngineClient::getIamPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * The async variant is {@see VmwareEngineClient::setIamPolicyAsync()} . + * + * @example samples/V1/VmwareEngineClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * The async variant is {@see VmwareEngineClient::testIamPermissionsAsync()} . + * + * @example samples/V1/VmwareEngineClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/VmwareEngine/v1/src/V1/Gapic/VmwareEngineGapicClient.php b/owl-bot-staging/VmwareEngine/v1/src/V1/Gapic/VmwareEngineGapicClient.php new file mode 100644 index 00000000000..d1ab4e75a89 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/src/V1/Gapic/VmwareEngineGapicClient.php @@ -0,0 +1,7412 @@ +privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); + * $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 = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\VmwareEngine\V1\Client\VmwareEngineClient}. + */ +class VmwareEngineGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.vmwareengine.v1.VmwareEngine'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'vmwareengine.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'vmwareengine.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 static $clusterNameTemplate; + + private static $dnsBindPermissionNameTemplate; + + private static $dnsForwardingNameTemplate; + + private static $externalAccessRuleNameTemplate; + + private static $externalAddressNameTemplate; + + private static $hcxActivationKeyNameTemplate; + + private static $locationNameTemplate; + + private static $loggingServerNameTemplate; + + private static $managementDnsZoneBindingNameTemplate; + + private static $networkNameTemplate; + + private static $networkPeeringNameTemplate; + + private static $networkPolicyNameTemplate; + + private static $nodeNameTemplate; + + private static $nodeTypeNameTemplate; + + private static $privateCloudNameTemplate; + + private static $privateConnectionNameTemplate; + + private static $subnetNameTemplate; + + private static $vmwareEngineNetworkNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vmware_engine_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vmware_engine_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vmware_engine_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vmware_engine_rest_client_config.php', + ], + ], + ]; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}'); + } + + return self::$clusterNameTemplate; + } + + private static function getDnsBindPermissionNameTemplate() + { + if (self::$dnsBindPermissionNameTemplate == null) { + self::$dnsBindPermissionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/dnsBindPermission'); + } + + return self::$dnsBindPermissionNameTemplate; + } + + private static function getDnsForwardingNameTemplate() + { + if (self::$dnsForwardingNameTemplate == null) { + self::$dnsForwardingNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding'); + } + + return self::$dnsForwardingNameTemplate; + } + + private static function getExternalAccessRuleNameTemplate() + { + if (self::$externalAccessRuleNameTemplate == null) { + self::$externalAccessRuleNameTemplate = new PathTemplate('projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule}'); + } + + return self::$externalAccessRuleNameTemplate; + } + + private static function getExternalAddressNameTemplate() + { + if (self::$externalAddressNameTemplate == null) { + self::$externalAddressNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}'); + } + + return self::$externalAddressNameTemplate; + } + + private static function getHcxActivationKeyNameTemplate() + { + if (self::$hcxActivationKeyNameTemplate == null) { + self::$hcxActivationKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}'); + } + + return self::$hcxActivationKeyNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getLoggingServerNameTemplate() + { + if (self::$loggingServerNameTemplate == null) { + self::$loggingServerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server}'); + } + + return self::$loggingServerNameTemplate; + } + + private static function getManagementDnsZoneBindingNameTemplate() + { + if (self::$managementDnsZoneBindingNameTemplate == null) { + self::$managementDnsZoneBindingNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding}'); + } + + return self::$managementDnsZoneBindingNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate('projects/{project}/global/networks/{network}'); + } + + return self::$networkNameTemplate; + } + + private static function getNetworkPeeringNameTemplate() + { + if (self::$networkPeeringNameTemplate == null) { + self::$networkPeeringNameTemplate = new PathTemplate('projects/{project}/locations/{location}/networkPeerings/{network_peering}'); + } + + return self::$networkPeeringNameTemplate; + } + + private static function getNetworkPolicyNameTemplate() + { + if (self::$networkPolicyNameTemplate == null) { + self::$networkPolicyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/networkPolicies/{network_policy}'); + } + + return self::$networkPolicyNameTemplate; + } + + private static function getNodeNameTemplate() + { + if (self::$nodeNameTemplate == null) { + self::$nodeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}'); + } + + return self::$nodeNameTemplate; + } + + private static function getNodeTypeNameTemplate() + { + if (self::$nodeTypeNameTemplate == null) { + self::$nodeTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/nodeTypes/{node_type}'); + } + + return self::$nodeTypeNameTemplate; + } + + private static function getPrivateCloudNameTemplate() + { + if (self::$privateCloudNameTemplate == null) { + self::$privateCloudNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}'); + } + + return self::$privateCloudNameTemplate; + } + + private static function getPrivateConnectionNameTemplate() + { + if (self::$privateConnectionNameTemplate == null) { + self::$privateConnectionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateConnections/{private_connection}'); + } + + return self::$privateConnectionNameTemplate; + } + + private static function getSubnetNameTemplate() + { + if (self::$subnetNameTemplate == null) { + self::$subnetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}'); + } + + return self::$subnetNameTemplate; + } + + private static function getVmwareEngineNetworkNameTemplate() + { + if (self::$vmwareEngineNetworkNameTemplate == null) { + self::$vmwareEngineNetworkNameTemplate = new PathTemplate('projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}'); + } + + return self::$vmwareEngineNetworkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'cluster' => self::getClusterNameTemplate(), + 'dnsBindPermission' => self::getDnsBindPermissionNameTemplate(), + 'dnsForwarding' => self::getDnsForwardingNameTemplate(), + 'externalAccessRule' => self::getExternalAccessRuleNameTemplate(), + 'externalAddress' => self::getExternalAddressNameTemplate(), + 'hcxActivationKey' => self::getHcxActivationKeyNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'loggingServer' => self::getLoggingServerNameTemplate(), + 'managementDnsZoneBinding' => self::getManagementDnsZoneBindingNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + 'networkPeering' => self::getNetworkPeeringNameTemplate(), + 'networkPolicy' => self::getNetworkPolicyNameTemplate(), + 'node' => self::getNodeNameTemplate(), + 'nodeType' => self::getNodeTypeNameTemplate(), + 'privateCloud' => self::getPrivateCloudNameTemplate(), + 'privateConnection' => self::getPrivateConnectionNameTemplate(), + 'subnet' => self::getSubnetNameTemplate(), + 'vmwareEngineNetwork' => self::getVmwareEngineNetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName($project, $location, $privateCloud, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * dns_bind_permission resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted dns_bind_permission resource. + */ + public static function dnsBindPermissionName($project, $location) + { + return self::getDnsBindPermissionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * dns_forwarding resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * + * @return string The formatted dns_forwarding resource. + */ + public static function dnsForwardingName($project, $location, $privateCloud) + { + return self::getDnsForwardingNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * external_access_rule resource. + * + * @param string $project + * @param string $location + * @param string $networkPolicy + * @param string $externalAccessRule + * + * @return string The formatted external_access_rule resource. + */ + public static function externalAccessRuleName($project, $location, $networkPolicy, $externalAccessRule) + { + return self::getExternalAccessRuleNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'network_policy' => $networkPolicy, + 'external_access_rule' => $externalAccessRule, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * external_address resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $externalAddress + * + * @return string The formatted external_address resource. + */ + public static function externalAddressName($project, $location, $privateCloud, $externalAddress) + { + return self::getExternalAddressNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'external_address' => $externalAddress, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * hcx_activation_key resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $hcxActivationKey + * + * @return string The formatted hcx_activation_key resource. + */ + public static function hcxActivationKeyName($project, $location, $privateCloud, $hcxActivationKey) + { + return self::getHcxActivationKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'hcx_activation_key' => $hcxActivationKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * logging_server resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $loggingServer + * + * @return string The formatted logging_server resource. + */ + public static function loggingServerName($project, $location, $privateCloud, $loggingServer) + { + return self::getLoggingServerNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'logging_server' => $loggingServer, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * management_dns_zone_binding resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $managementDnsZoneBinding + * + * @return string The formatted management_dns_zone_binding resource. + */ + public static function managementDnsZoneBindingName($project, $location, $privateCloud, $managementDnsZoneBinding) + { + return self::getManagementDnsZoneBindingNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'management_dns_zone_binding' => $managementDnsZoneBinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * network_peering resource. + * + * @param string $project + * @param string $location + * @param string $networkPeering + * + * @return string The formatted network_peering resource. + */ + public static function networkPeeringName($project, $location, $networkPeering) + { + return self::getNetworkPeeringNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'network_peering' => $networkPeering, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * network_policy resource. + * + * @param string $project + * @param string $location + * @param string $networkPolicy + * + * @return string The formatted network_policy resource. + */ + public static function networkPolicyName($project, $location, $networkPolicy) + { + return self::getNetworkPolicyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'network_policy' => $networkPolicy, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $cluster + * @param string $node + * + * @return string The formatted node resource. + */ + public static function nodeName($project, $location, $privateCloud, $cluster, $node) + { + return self::getNodeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'cluster' => $cluster, + 'node' => $node, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a node_type + * resource. + * + * @param string $project + * @param string $location + * @param string $nodeType + * + * @return string The formatted node_type resource. + */ + public static function nodeTypeName($project, $location, $nodeType) + { + return self::getNodeTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'node_type' => $nodeType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * private_cloud resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * + * @return string The formatted private_cloud resource. + */ + public static function privateCloudName($project, $location, $privateCloud) + { + return self::getPrivateCloudNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * private_connection resource. + * + * @param string $project + * @param string $location + * @param string $privateConnection + * + * @return string The formatted private_connection resource. + */ + public static function privateConnectionName($project, $location, $privateConnection) + { + return self::getPrivateConnectionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_connection' => $privateConnection, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a subnet + * resource. + * + * @param string $project + * @param string $location + * @param string $privateCloud + * @param string $subnet + * + * @return string The formatted subnet resource. + */ + public static function subnetName($project, $location, $privateCloud, $subnet) + { + return self::getSubnetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'private_cloud' => $privateCloud, + 'subnet' => $subnet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * vmware_engine_network resource. + * + * @param string $project + * @param string $location + * @param string $vmwareEngineNetwork + * + * @return string The formatted vmware_engine_network resource. + */ + public static function vmwareEngineNetworkName($project, $location, $vmwareEngineNetwork) + { + return self::getVmwareEngineNetworkNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'vmware_engine_network' => $vmwareEngineNetwork, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cluster: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster} + * - dnsBindPermission: projects/{project}/locations/{location}/dnsBindPermission + * - dnsForwarding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding + * - externalAccessRule: projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule} + * - externalAddress: projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address} + * - hcxActivationKey: projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key} + * - location: projects/{project}/locations/{location} + * - loggingServer: projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server} + * - managementDnsZoneBinding: projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding} + * - network: projects/{project}/global/networks/{network} + * - networkPeering: projects/{project}/locations/{location}/networkPeerings/{network_peering} + * - networkPolicy: projects/{project}/locations/{location}/networkPolicies/{network_policy} + * - node: projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node} + * - nodeType: projects/{project}/locations/{location}/nodeTypes/{node_type} + * - privateCloud: projects/{project}/locations/{location}/privateClouds/{private_cloud} + * - privateConnection: projects/{project}/locations/{location}/privateConnections/{private_connection} + * - subnet: projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet} + * - vmwareEngineNetwork: projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'vmwareengine.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); + } + + /** + * Creates a new cluster in a given private cloud. + * Creating a new cluster provides additional nodes for + * use in the parent private cloud and requires sufficient [node + * quota](https://cloud.google.com/vmware-engine/quotas). + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); + * $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 = $vmwareEngineClient->createCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param string $clusterId Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param Cluster $cluster Required. The initial description of the new cluster. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 createCluster($parent, $clusterId, $cluster, array $optionalArgs = []) + { + $request = new CreateClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new external access rule in a given network policy. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + * $externalAccessRule = new ExternalAccessRule(); + * $externalAccessRuleId = 'external_access_rule_id'; + * $operationResponse = $vmwareEngineClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); + * $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 = $vmwareEngineClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createExternalAccessRule'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param ExternalAccessRule $externalAccessRule Required. The initial description of a new external access rule. + * @param string $externalAccessRuleId Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createExternalAccessRule($parent, $externalAccessRule, $externalAccessRuleId, array $optionalArgs = []) + { + $request = new CreateExternalAccessRuleRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setExternalAccessRule($externalAccessRule); + $request->setExternalAccessRuleId($externalAccessRuleId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateExternalAccessRule', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new `ExternalAddress` resource in a given private cloud. The + * network policy that corresponds to the private cloud must have the external + * IP address network service enabled (`NetworkPolicy.external_ip`). + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $externalAddress = new ExternalAddress(); + * $externalAddressId = 'external_address_id'; + * $operationResponse = $vmwareEngineClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); + * $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 = $vmwareEngineClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createExternalAddress'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param ExternalAddress $externalAddress Required. The initial description of a new external IP address. + * @param string $externalAddressId Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createExternalAddress($parent, $externalAddress, $externalAddressId, array $optionalArgs = []) + { + $request = new CreateExternalAddressRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setExternalAddress($externalAddress); + $request->setExternalAddressId($externalAddressId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateExternalAddress', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new HCX activation key in a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $hcxActivationKey = new HcxActivationKey(); + * $hcxActivationKeyId = 'hcx_activation_key_id'; + * $operationResponse = $vmwareEngineClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); + * $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 = $vmwareEngineClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createHcxActivationKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param HcxActivationKey $hcxActivationKey Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * @param string $hcxActivationKeyId Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createHcxActivationKey($parent, $hcxActivationKey, $hcxActivationKeyId, array $optionalArgs = []) + { + $request = new CreateHcxActivationKeyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setHcxActivationKey($hcxActivationKey); + $request->setHcxActivationKeyId($hcxActivationKeyId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateHcxActivationKey', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Create a new logging server for a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $loggingServer = new LoggingServer(); + * $loggingServerId = 'logging_server_id'; + * $operationResponse = $vmwareEngineClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); + * $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 = $vmwareEngineClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createLoggingServer'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param LoggingServer $loggingServer Required. The initial description of a new logging server. + * @param string $loggingServerId Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createLoggingServer($parent, $loggingServer, $loggingServerId, array $optionalArgs = []) + { + $request = new CreateLoggingServerRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLoggingServer($loggingServer); + $request->setLoggingServerId($loggingServerId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateLoggingServer', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new `ManagementDnsZoneBinding` resource in a private cloud. + * This RPC creates the DNS binding and the resource that represents the + * DNS binding of the consumer VPC network to the management DNS zone. A + * management DNS zone is the Cloud DNS cross-project binding zone that + * VMware Engine creates for each private cloud. It contains FQDNs and + * corresponding IP addresses for the private cloud's ESXi hosts and + * management VM appliances like vCenter and NSX Manager. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + * $managementDnsZoneBindingId = 'management_dns_zone_binding_id'; + * $operationResponse = $vmwareEngineClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); + * $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 = $vmwareEngineClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createManagementDnsZoneBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param ManagementDnsZoneBinding $managementDnsZoneBinding Required. The initial values for a new management DNS zone binding. + * @param string $managementDnsZoneBindingId Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createManagementDnsZoneBinding($parent, $managementDnsZoneBinding, $managementDnsZoneBindingId, array $optionalArgs = []) + { + $request = new CreateManagementDnsZoneBindingRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setManagementDnsZoneBinding($managementDnsZoneBinding); + $request->setManagementDnsZoneBindingId($managementDnsZoneBindingId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateManagementDnsZoneBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new network peering between the peer network and VMware Engine + * network provided in a `NetworkPeering` resource. NetworkPeering is a + * global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * $networkPeeringId = 'network_peering_id'; + * $networkPeering = new NetworkPeering(); + * $operationResponse = $vmwareEngineClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); + * $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 = $vmwareEngineClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createNetworkPeering'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param string $networkPeeringId Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param NetworkPeering $networkPeering Required. The initial description of the new network peering. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createNetworkPeering($parent, $networkPeeringId, $networkPeering, array $optionalArgs = []) + { + $request = new CreateNetworkPeeringRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNetworkPeeringId($networkPeeringId); + $request->setNetworkPeering($networkPeering); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateNetworkPeering', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new network policy in a given VMware Engine network of a + * project and location (region). A new network policy cannot be created if + * another network policy already exists in the same scope. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * $networkPolicyId = 'network_policy_id'; + * $networkPolicy = new NetworkPolicy(); + * $operationResponse = $vmwareEngineClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); + * $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 = $vmwareEngineClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createNetworkPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * @param string $networkPolicyId Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param NetworkPolicy $networkPolicy Required. The network policy configuration to use in the request. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createNetworkPolicy($parent, $networkPolicyId, $networkPolicy, array $optionalArgs = []) + { + $request = new CreateNetworkPolicyRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNetworkPolicyId($networkPolicyId); + $request->setNetworkPolicy($networkPolicy); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateNetworkPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new `PrivateCloud` resource in a given project and location. + * Private clouds of type `STANDARD` and + * `TIME_LIMITED` are zonal resources, `STRETCHED` private clouds are + * regional. + * Creating a private cloud also creates a [management + * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) + * for that private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * $privateCloudId = 'private_cloud_id'; + * $privateCloud = new PrivateCloud(); + * $operationResponse = $vmwareEngineClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); + * $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 = $vmwareEngineClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createPrivateCloud'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param string $privateCloudId Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param PrivateCloud $privateCloud Required. The initial description of the new private cloud. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 createPrivateCloud($parent, $privateCloudId, $privateCloud, array $optionalArgs = []) + { + $request = new CreatePrivateCloudRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPrivateCloudId($privateCloudId); + $request->setPrivateCloud($privateCloud); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreatePrivateCloud', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new private connection that can be used for accessing private + * Clouds. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * $privateConnectionId = 'private_connection_id'; + * $privateConnection = new PrivateConnection(); + * $operationResponse = $vmwareEngineClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); + * $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 = $vmwareEngineClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createPrivateConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * @param string $privateConnectionId Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param PrivateConnection $privateConnection Required. The initial description of the new private connection. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createPrivateConnection($parent, $privateConnectionId, $privateConnection, array $optionalArgs = []) + { + $request = new CreatePrivateConnectionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPrivateConnectionId($privateConnectionId); + $request->setPrivateConnection($privateConnection); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreatePrivateConnection', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new VMware Engine network that can be used by a private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * $vmwareEngineNetworkId = 'vmware_engine_network_id'; + * $vmwareEngineNetwork = new VmwareEngineNetwork(); + * $operationResponse = $vmwareEngineClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); + * $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 = $vmwareEngineClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'createVmwareEngineNetwork'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * @param string $vmwareEngineNetworkId Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param VmwareEngineNetwork $vmwareEngineNetwork Required. The initial description of the new VMware Engine network. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 createVmwareEngineNetwork($parent, $vmwareEngineNetworkId, $vmwareEngineNetwork, array $optionalArgs = []) + { + $request = new CreateVmwareEngineNetworkRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setVmwareEngineNetworkId($vmwareEngineNetworkId); + $request->setVmwareEngineNetwork($vmwareEngineNetwork); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateVmwareEngineNetwork', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or + * gracefully shut down any workloads running on the cluster before deletion. + * You cannot delete the management cluster of a private cloud using this + * method. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + * $operationResponse = $vmwareEngineClient->deleteCluster($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteCluster($name, array $optionalArgs = []) + { + $request = new DeleteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single external access rule. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + * $operationResponse = $vmwareEngineClient->deleteExternalAccessRule($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteExternalAccessRule($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteExternalAccessRule'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteExternalAccessRule($name, array $optionalArgs = []) + { + $request = new DeleteExternalAccessRuleRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteExternalAccessRule', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single external IP address. When you delete an external IP + * address, connectivity between the external IP address and the corresponding + * internal IP address is lost. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + * $operationResponse = $vmwareEngineClient->deleteExternalAddress($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteExternalAddress($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteExternalAddress'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteExternalAddress($name, array $optionalArgs = []) + { + $request = new DeleteExternalAddressRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteExternalAddress', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a single logging server. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + * $operationResponse = $vmwareEngineClient->deleteLoggingServer($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteLoggingServer($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteLoggingServer'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteLoggingServer($name, array $optionalArgs = []) + { + $request = new DeleteLoggingServerRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteLoggingServer', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `ManagementDnsZoneBinding` resource. When a management DNS zone + * binding is deleted, the corresponding consumer VPC network is no longer + * bound to the management DNS zone. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + * $operationResponse = $vmwareEngineClient->deleteManagementDnsZoneBinding($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteManagementDnsZoneBinding($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteManagementDnsZoneBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteManagementDnsZoneBinding($name, array $optionalArgs = []) + { + $request = new DeleteManagementDnsZoneBindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteManagementDnsZoneBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `NetworkPeering` resource. When a network peering is deleted for + * a VMware Engine network, the peer network becomes inaccessible to that + * VMware Engine network. NetworkPeering is a global resource and location can + * only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + * $operationResponse = $vmwareEngineClient->deleteNetworkPeering($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteNetworkPeering($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteNetworkPeering'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteNetworkPeering($name, array $optionalArgs = []) + { + $request = new DeleteNetworkPeeringRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteNetworkPeering', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted + * when `NetworkService.state` is set to `RECONCILING` for either its external + * IP or internet access service. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + * $operationResponse = $vmwareEngineClient->deleteNetworkPolicy($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteNetworkPolicy($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteNetworkPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deleteNetworkPolicy($name, array $optionalArgs = []) + { + $request = new DeleteNetworkPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteNetworkPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Schedules a `PrivateCloud` resource for deletion. + * + * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` + * set to `DELETED` and `expireTime` set to the time when deletion is final + * and can no longer be reversed. The delete operation is marked as done + * as soon as the `PrivateCloud` is successfully scheduled for deletion + * (this also applies when `delayHours` is set to zero), and the operation is + * not kept in pending state until `PrivateCloud` is purged. + * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before + * the `expireTime` elapses. When `expireTime` is reached, deletion is final + * and all private cloud resources are irreversibly removed and billing stops. + * During the final removal process, `PrivateCloud.state` is set to `PURGING`. + * `PrivateCloud` can be polled using standard `GET` method for the whole + * period of deletion and purging. It will not be returned only + * when it is completely purged. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $operationResponse = $vmwareEngineClient->deletePrivateCloud($formattedName); + * $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 = $vmwareEngineClient->deletePrivateCloud($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deletePrivateCloud'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $force + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * @type int $delayHours + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * [VmwareEngine.UndeletePrivateCloud][google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud]. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * @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 deletePrivateCloud($name, array $optionalArgs = []) + { + $request = new DeletePrivateCloudRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + if (isset($optionalArgs['delayHours'])) { + $request->setDelayHours($optionalArgs['delayHours']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeletePrivateCloud', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `PrivateConnection` resource. When a private connection is + * deleted for a VMware Engine network, the connected network becomes + * inaccessible to that VMware Engine network. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + * $operationResponse = $vmwareEngineClient->deletePrivateConnection($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deletePrivateConnection($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deletePrivateConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 deletePrivateConnection($name, array $optionalArgs = []) + { + $request = new DeletePrivateConnectionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeletePrivateConnection', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware + * Engine network after all resources that refer to it are deleted. For + * example, a private cloud, a network peering, and a network policy can all + * refer to the same VMware Engine network. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + * $operationResponse = $vmwareEngineClient->deleteVmwareEngineNetwork($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vmwareEngineClient->deleteVmwareEngineNetwork($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'deleteVmwareEngineNetwork'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * @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 deleteVmwareEngineNetwork($name, array $optionalArgs = []) + { + $request = new DeleteVmwareEngineNetworkRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteVmwareEngineNetwork', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedNetworkPolicy = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $networkPolicy Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function fetchNetworkPolicyExternalAddresses($networkPolicy, array $optionalArgs = []) + { + $request = new FetchNetworkPolicyExternalAddressesRequest(); + $requestParamHeaders = []; + $request->setNetworkPolicy($networkPolicy); + $requestParamHeaders['network_policy'] = $networkPolicy; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('FetchNetworkPolicyExternalAddresses', $optionalArgs, FetchNetworkPolicyExternalAddressesResponse::class, $request); + } + + /** + * Retrieves a `Cluster` resource by its resource name. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + * $response = $vmwareEngineClient->getCluster($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @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\Cloud\VmwareEngine\V1\Cluster + * + * @throws ApiException if the remote call fails + */ + public function getCluster($name, array $optionalArgs = []) + { + $request = new GetClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetCluster', Cluster::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets all the principals having bind permission on the intranet VPC + * associated with the consumer project granted by the Grant API. + * DnsBindPermission is a global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + * $response = $vmwareEngineClient->getDnsBindPermission($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @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\Cloud\VmwareEngine\V1\DnsBindPermission + * + * @throws ApiException if the remote call fails + */ + public function getDnsBindPermission($name, array $optionalArgs = []) + { + $request = new GetDnsBindPermissionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDnsBindPermission', DnsBindPermission::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of the `DnsForwarding` config. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $response = $vmwareEngineClient->getDnsForwarding($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * @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\Cloud\VmwareEngine\V1\DnsForwarding + * + * @throws ApiException if the remote call fails + */ + public function getDnsForwarding($name, array $optionalArgs = []) + { + $request = new GetDnsForwardingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDnsForwarding', DnsForwarding::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single external access rule. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + * $response = $vmwareEngineClient->getExternalAccessRule($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @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\Cloud\VmwareEngine\V1\ExternalAccessRule + * + * @throws ApiException if the remote call fails + */ + public function getExternalAccessRule($name, array $optionalArgs = []) + { + $request = new GetExternalAccessRuleRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetExternalAccessRule', ExternalAccessRule::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single external IP address. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + * $response = $vmwareEngineClient->getExternalAddress($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * @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\Cloud\VmwareEngine\V1\ExternalAddress + * + * @throws ApiException if the remote call fails + */ + public function getExternalAddress($name, array $optionalArgs = []) + { + $request = new GetExternalAddressRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetExternalAddress', ExternalAddress::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `HcxActivationKey` resource by its resource name. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); + * $response = $vmwareEngineClient->getHcxActivationKey($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * @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\Cloud\VmwareEngine\V1\HcxActivationKey + * + * @throws ApiException if the remote call fails + */ + public function getHcxActivationKey($name, array $optionalArgs = []) + { + $request = new GetHcxActivationKeyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetHcxActivationKey', HcxActivationKey::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a logging server. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + * $response = $vmwareEngineClient->getLoggingServer($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @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\Cloud\VmwareEngine\V1\LoggingServer + * + * @throws ApiException if the remote call fails + */ + public function getLoggingServer($name, array $optionalArgs = []) + { + $request = new GetLoggingServerRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLoggingServer', LoggingServer::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a 'ManagementDnsZoneBinding' resource by its resource name. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + * $response = $vmwareEngineClient->getManagementDnsZoneBinding($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @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\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding + * + * @throws ApiException if the remote call fails + */ + public function getManagementDnsZoneBinding($name, array $optionalArgs = []) + { + $request = new GetManagementDnsZoneBindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetManagementDnsZoneBinding', ManagementDnsZoneBinding::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `NetworkPeering` resource by its resource name. The resource + * contains details of the network peering, such as peered + * networks, import and export custom route configurations, and peering state. + * NetworkPeering is a global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + * $response = $vmwareEngineClient->getNetworkPeering($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @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\Cloud\VmwareEngine\V1\NetworkPeering + * + * @throws ApiException if the remote call fails + */ + public function getNetworkPeering($name, array $optionalArgs = []) + { + $request = new GetNetworkPeeringRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNetworkPeering', NetworkPeering::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `NetworkPolicy` resource by its resource name. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + * $response = $vmwareEngineClient->getNetworkPolicy($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @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\Cloud\VmwareEngine\V1\NetworkPolicy + * + * @throws ApiException if the remote call fails + */ + public function getNetworkPolicy($name, array $optionalArgs = []) + { + $request = new GetNetworkPolicyRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNetworkPolicy', NetworkPolicy::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single node. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); + * $response = $vmwareEngineClient->getNode($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * @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\Cloud\VmwareEngine\V1\Node + * + * @throws ApiException if the remote call fails + */ + public function getNode($name, array $optionalArgs = []) + { + $request = new GetNodeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNode', Node::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single `NodeType`. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + * $response = $vmwareEngineClient->getNodeType($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * @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\Cloud\VmwareEngine\V1\NodeType + * + * @throws ApiException if the remote call fails + */ + public function getNodeType($name, array $optionalArgs = []) + { + $request = new GetNodeTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetNodeType', NodeType::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `PrivateCloud` resource by its resource name. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $response = $vmwareEngineClient->getPrivateCloud($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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\Cloud\VmwareEngine\V1\PrivateCloud + * + * @throws ApiException if the remote call fails + */ + public function getPrivateCloud($name, array $optionalArgs = []) + { + $request = new GetPrivateCloudRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPrivateCloud', PrivateCloud::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `PrivateConnection` resource by its resource name. The resource + * contains details of the private connection, such as connected + * network, routing mode and state. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + * $response = $vmwareEngineClient->getPrivateConnection($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @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\Cloud\VmwareEngine\V1\PrivateConnection + * + * @throws ApiException if the remote call fails + */ + public function getPrivateConnection($name, array $optionalArgs = []) + { + $request = new GetPrivateConnectionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPrivateConnection', PrivateConnection::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of a single subnet. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); + * $response = $vmwareEngineClient->getSubnet($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * @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\Cloud\VmwareEngine\V1\Subnet + * + * @throws ApiException if the remote call fails + */ + public function getSubnet($name, array $optionalArgs = []) + { + $request = new GetSubnetRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSubnet', Subnet::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a `VmwareEngineNetwork` resource by its resource name. The + * resource contains details of the VMware Engine network, such as its VMware + * Engine network type, peered networks in a service project, and state + * (for example, `CREATING`, `ACTIVE`, `DELETING`). + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + * $response = $vmwareEngineClient->getVmwareEngineNetwork($formattedName); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @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\Cloud\VmwareEngine\V1\VmwareEngineNetwork + * + * @throws ApiException if the remote call fails + */ + public function getVmwareEngineNetwork($name, array $optionalArgs = []) + { + $request = new GetVmwareEngineNetworkRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVmwareEngineNetwork', VmwareEngineNetwork::class, $optionalArgs, $request)->wait(); + } + + /** + * Grants the bind permission to the customer provided principal(user / + * service account) to bind their DNS zone with the intranet VPC associated + * with the project. DnsBindPermission is a global resource and location can + * only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + * $principal = new Principal(); + * $operationResponse = $vmwareEngineClient->grantDnsBindPermission($formattedName, $principal); + * $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 = $vmwareEngineClient->grantDnsBindPermission($formattedName, $principal); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'grantDnsBindPermission'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @param Principal $principal Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 grantDnsBindPermission($name, $principal, array $optionalArgs = []) + { + $request = new GrantDnsBindPermissionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setPrincipal($principal); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('GrantDnsBindPermission', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Lists `Cluster` resources in a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listClusters($parent, array $optionalArgs = []) + { + $request = new ListClustersRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListClusters', $optionalArgs, ListClustersResponse::class, $request); + } + + /** + * Lists `ExternalAccessRule` resources in the specified network policy. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listExternalAccessRules($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listExternalAccessRules($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listExternalAccessRules($parent, array $optionalArgs = []) + { + $request = new ListExternalAccessRulesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListExternalAccessRules', $optionalArgs, ListExternalAccessRulesResponse::class, $request); + } + + /** + * Lists external IP addresses assigned to VMware workload VMs in a given + * private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listExternalAddresses($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listExternalAddresses($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listExternalAddresses($parent, array $optionalArgs = []) + { + $request = new ListExternalAddressesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListExternalAddresses', $optionalArgs, ListExternalAddressesResponse::class, $request); + } + + /** + * Lists `HcxActivationKey` resources in a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listHcxActivationKeys($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listHcxActivationKeys($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listHcxActivationKeys($parent, array $optionalArgs = []) + { + $request = new ListHcxActivationKeysRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListHcxActivationKeys', $optionalArgs, ListHcxActivationKeysResponse::class, $request); + } + + /** + * Lists logging servers configured for a given private + * cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listLoggingServers($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listLoggingServers($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLoggingServers($parent, array $optionalArgs = []) + { + $request = new ListLoggingServersRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLoggingServers', $optionalArgs, ListLoggingServersResponse::class, $request); + } + + /** + * Lists Consumer VPCs bound to Management DNS Zone of a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listManagementDnsZoneBindings($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listManagementDnsZoneBindings($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listManagementDnsZoneBindings($parent, array $optionalArgs = []) + { + $request = new ListManagementDnsZoneBindingsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListManagementDnsZoneBindings', $optionalArgs, ListManagementDnsZoneBindingsResponse::class, $request); + } + + /** + * Lists `NetworkPeering` resources in a given project. NetworkPeering is a + * global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listNetworkPeerings($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listNetworkPeerings($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNetworkPeerings($parent, array $optionalArgs = []) + { + $request = new ListNetworkPeeringsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNetworkPeerings', $optionalArgs, ListNetworkPeeringsResponse::class, $request); + } + + /** + * Lists `NetworkPolicy` resources in a specified project and location. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listNetworkPolicies($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listNetworkPolicies($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNetworkPolicies($parent, array $optionalArgs = []) + { + $request = new ListNetworkPoliciesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNetworkPolicies', $optionalArgs, ListNetworkPoliciesResponse::class, $request); + } + + /** + * Lists node types + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listNodeTypes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listNodeTypes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNodeTypes($parent, array $optionalArgs = []) + { + $request = new ListNodeTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNodeTypes', $optionalArgs, ListNodeTypesResponse::class, $request); + } + + /** + * Lists nodes in a given cluster. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listNodes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listNodes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listNodes($parent, array $optionalArgs = []) + { + $request = new ListNodesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListNodes', $optionalArgs, ListNodesResponse::class, $request); + } + + /** + * Lists the network peering routes exchanged over a peering connection. + * NetworkPeering is a global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listPeeringRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listPeeringRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPeeringRoutes($parent, array $optionalArgs = []) + { + $request = new ListPeeringRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPeeringRoutes', $optionalArgs, ListPeeringRoutesResponse::class, $request); + } + + /** + * Lists `PrivateCloud` resources in a given project and location. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listPrivateClouds($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listPrivateClouds($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPrivateClouds($parent, array $optionalArgs = []) + { + $request = new ListPrivateCloudsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPrivateClouds', $optionalArgs, ListPrivateCloudsResponse::class, $request); + } + + /** + * Lists the private connection routes exchanged over a peering connection. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listPrivateConnectionPeeringRoutes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listPrivateConnectionPeeringRoutes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPrivateConnectionPeeringRoutes($parent, array $optionalArgs = []) + { + $request = new ListPrivateConnectionPeeringRoutesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPrivateConnectionPeeringRoutes', $optionalArgs, ListPrivateConnectionPeeringRoutesResponse::class, $request); + } + + /** + * Lists `PrivateConnection` resources in a given project and location. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listPrivateConnections($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listPrivateConnections($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPrivateConnections($parent, array $optionalArgs = []) + { + $request = new ListPrivateConnectionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPrivateConnections', $optionalArgs, ListPrivateConnectionsResponse::class, $request); + } + + /** + * Lists subnets in a given private cloud. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listSubnets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listSubnets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSubnets($parent, array $optionalArgs = []) + { + $request = new ListSubnetsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSubnets', $optionalArgs, ListSubnetsResponse::class, $request); + } + + /** + * Lists `VmwareEngineNetwork` resources in a given project and location. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedParent = $vmwareEngineClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listVmwareEngineNetworks($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listVmwareEngineNetworks($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @type string $orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVmwareEngineNetworks($parent, array $optionalArgs = []) + { + $request = new ListVmwareEngineNetworksRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVmwareEngineNetworks', $optionalArgs, ListVmwareEngineNetworksResponse::class, $request); + } + + /** + * Retries to create a `ManagementDnsZoneBinding` resource that is + * in failed state. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + * $operationResponse = $vmwareEngineClient->repairManagementDnsZoneBinding($formattedName); + * $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 = $vmwareEngineClient->repairManagementDnsZoneBinding($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'repairManagementDnsZoneBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 repairManagementDnsZoneBinding($name, array $optionalArgs = []) + { + $request = new RepairManagementDnsZoneBindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RepairManagementDnsZoneBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Resets credentials of the NSX appliance. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $operationResponse = $vmwareEngineClient->resetNsxCredentials($formattedPrivateCloud); + * $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 = $vmwareEngineClient->resetNsxCredentials($formattedPrivateCloud); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'resetNsxCredentials'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $privateCloud Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 resetNsxCredentials($privateCloud, array $optionalArgs = []) + { + $request = new ResetNsxCredentialsRequest(); + $requestParamHeaders = []; + $request->setPrivateCloud($privateCloud); + $requestParamHeaders['private_cloud'] = $privateCloud; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ResetNsxCredentials', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Resets credentials of the Vcenter appliance. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $operationResponse = $vmwareEngineClient->resetVcenterCredentials($formattedPrivateCloud); + * $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 = $vmwareEngineClient->resetVcenterCredentials($formattedPrivateCloud); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'resetVcenterCredentials'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $privateCloud Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $username + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * @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 resetVcenterCredentials($privateCloud, array $optionalArgs = []) + { + $request = new ResetVcenterCredentialsRequest(); + $requestParamHeaders = []; + $request->setPrivateCloud($privateCloud); + $requestParamHeaders['private_cloud'] = $privateCloud; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['username'])) { + $request->setUsername($optionalArgs['username']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ResetVcenterCredentials', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Revokes the bind permission from the customer provided principal(user / + * service account) on the intranet VPC associated with the consumer project. + * DnsBindPermission is a global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + * $principal = new Principal(); + * $operationResponse = $vmwareEngineClient->revokeDnsBindPermission($formattedName, $principal); + * $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 = $vmwareEngineClient->revokeDnsBindPermission($formattedName, $principal); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'revokeDnsBindPermission'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @param Principal $principal Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 revokeDnsBindPermission($name, $principal, array $optionalArgs = []) + { + $request = new RevokeDnsBindPermissionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setPrincipal($principal); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RevokeDnsBindPermission', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of credentials for NSX appliance. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $response = $vmwareEngineClient->showNsxCredentials($formattedPrivateCloud); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $privateCloud Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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\Cloud\VmwareEngine\V1\Credentials + * + * @throws ApiException if the remote call fails + */ + public function showNsxCredentials($privateCloud, array $optionalArgs = []) + { + $request = new ShowNsxCredentialsRequest(); + $requestParamHeaders = []; + $request->setPrivateCloud($privateCloud); + $requestParamHeaders['private_cloud'] = $privateCloud; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ShowNsxCredentials', Credentials::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets details of credentials for Vcenter appliance. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedPrivateCloud = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $response = $vmwareEngineClient->showVcenterCredentials($formattedPrivateCloud); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $privateCloud Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type string $username + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * @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\VmwareEngine\V1\Credentials + * + * @throws ApiException if the remote call fails + */ + public function showVcenterCredentials($privateCloud, array $optionalArgs = []) + { + $request = new ShowVcenterCredentialsRequest(); + $requestParamHeaders = []; + $request->setPrivateCloud($privateCloud); + $requestParamHeaders['private_cloud'] = $privateCloud; + if (isset($optionalArgs['username'])) { + $request->setUsername($optionalArgs['username']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ShowVcenterCredentials', Credentials::class, $optionalArgs, $request)->wait(); + } + + /** + * Restores a private cloud that was previously scheduled for deletion by + * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has + * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to + * the time when deletion can no longer be reversed. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $formattedName = $vmwareEngineClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + * $operationResponse = $vmwareEngineClient->undeletePrivateCloud($formattedName); + * $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 = $vmwareEngineClient->undeletePrivateCloud($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'undeletePrivateCloud'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 undeletePrivateCloud($name, array $optionalArgs = []) + { + $request = new UndeletePrivateCloudRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UndeletePrivateCloud', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a `Cluster` resource. Only fields specified in `updateMask` are + * applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $cluster = new Cluster(); + * $operationResponse = $vmwareEngineClient->updateCluster($updateMask, $cluster); + * $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 = $vmwareEngineClient->updateCluster($updateMask, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @param Cluster $cluster Required. The description of the cluster. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 updateCluster($updateMask, $cluster, array $optionalArgs = []) + { + $request = new UpdateClusterRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setCluster($cluster); + $requestParamHeaders['cluster.name'] = $cluster->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateCluster', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of the `DnsForwarding` config, like associated + * domains. Only fields specified in `update_mask` are applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $dnsForwarding = new DnsForwarding(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updateDnsForwarding($dnsForwarding, $updateMask); + * $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 = $vmwareEngineClient->updateDnsForwarding($dnsForwarding, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateDnsForwarding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param DnsForwarding $dnsForwarding Required. DnsForwarding config details. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateDnsForwarding($dnsForwarding, $updateMask, array $optionalArgs = []) + { + $request = new UpdateDnsForwardingRequest(); + $requestParamHeaders = []; + $request->setDnsForwarding($dnsForwarding); + $request->setUpdateMask($updateMask); + $requestParamHeaders['dns_forwarding.name'] = $dnsForwarding->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateDnsForwarding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single external access rule. + * Only fields specified in `update_mask` are applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $externalAccessRule = new ExternalAccessRule(); + * $operationResponse = $vmwareEngineClient->updateExternalAccessRule($updateMask, $externalAccessRule); + * $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 = $vmwareEngineClient->updateExternalAccessRule($updateMask, $externalAccessRule); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateExternalAccessRule'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param ExternalAccessRule $externalAccessRule Required. Description of the external access rule. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateExternalAccessRule($updateMask, $externalAccessRule, array $optionalArgs = []) + { + $request = new UpdateExternalAccessRuleRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setExternalAccessRule($externalAccessRule); + $requestParamHeaders['external_access_rule.name'] = $externalAccessRule->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateExternalAccessRule', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single external IP address. + * Only fields specified in `update_mask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $externalAddress = new ExternalAddress(); + * $operationResponse = $vmwareEngineClient->updateExternalAddress($updateMask, $externalAddress); + * $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 = $vmwareEngineClient->updateExternalAddress($updateMask, $externalAddress); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateExternalAddress'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param ExternalAddress $externalAddress Required. External IP address description. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateExternalAddress($updateMask, $externalAddress, array $optionalArgs = []) + { + $request = new UpdateExternalAddressRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setExternalAddress($externalAddress); + $requestParamHeaders['external_address.name'] = $externalAddress->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateExternalAddress', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single logging server. + * Only fields specified in `update_mask` are applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $loggingServer = new LoggingServer(); + * $operationResponse = $vmwareEngineClient->updateLoggingServer($updateMask, $loggingServer); + * $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 = $vmwareEngineClient->updateLoggingServer($updateMask, $loggingServer); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateLoggingServer'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param LoggingServer $loggingServer Required. Logging server description. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateLoggingServer($updateMask, $loggingServer, array $optionalArgs = []) + { + $request = new UpdateLoggingServerRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setLoggingServer($loggingServer); + $requestParamHeaders['logging_server.name'] = $loggingServer->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateLoggingServer', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates a `ManagementDnsZoneBinding` resource. + * Only fields specified in `update_mask` are applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + * $operationResponse = $vmwareEngineClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); + * $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 = $vmwareEngineClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateManagementDnsZoneBinding'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param ManagementDnsZoneBinding $managementDnsZoneBinding Required. New values to update the management DNS zone binding with. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding, array $optionalArgs = []) + { + $request = new UpdateManagementDnsZoneBindingRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setManagementDnsZoneBinding($managementDnsZoneBinding); + $requestParamHeaders['management_dns_zone_binding.name'] = $managementDnsZoneBinding->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateManagementDnsZoneBinding', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a `NetworkPeering` resource. Only the `description` field can be + * updated. Only fields specified in `updateMask` are applied. NetworkPeering + * is a global resource and location can only be global. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $networkPeering = new NetworkPeering(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updateNetworkPeering($networkPeering, $updateMask); + * $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 = $vmwareEngineClient->updateNetworkPeering($networkPeering, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateNetworkPeering'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param NetworkPeering $networkPeering Required. Network peering description. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateNetworkPeering($networkPeering, $updateMask, array $optionalArgs = []) + { + $request = new UpdateNetworkPeeringRequest(); + $requestParamHeaders = []; + $request->setNetworkPeering($networkPeering); + $request->setUpdateMask($updateMask); + $requestParamHeaders['network_peering.name'] = $networkPeering->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateNetworkPeering', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a `NetworkPolicy` resource. Only the following fields can be + * updated: `internet_access`, `external_ip`, `edge_services_cidr`. + * Only fields specified in `updateMask` are applied. When updating a network + * policy, the external IP network service can only be disabled if there are + * no external IP addresses present in the scope of the policy. Also, a + * `NetworkService` cannot be updated when `NetworkService.state` is set + * to `RECONCILING`. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $networkPolicy = new NetworkPolicy(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updateNetworkPolicy($networkPolicy, $updateMask); + * $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 = $vmwareEngineClient->updateNetworkPolicy($networkPolicy, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateNetworkPolicy'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param NetworkPolicy $networkPolicy Required. Network policy description. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateNetworkPolicy($networkPolicy, $updateMask, array $optionalArgs = []) + { + $request = new UpdateNetworkPolicyRequest(); + $requestParamHeaders = []; + $request->setNetworkPolicy($networkPolicy); + $request->setUpdateMask($updateMask); + $requestParamHeaders['network_policy.name'] = $networkPolicy->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateNetworkPolicy', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a `PrivateCloud` resource. Only the following fields can be + * updated: `description`. + * Only fields specified in `updateMask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $privateCloud = new PrivateCloud(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updatePrivateCloud($privateCloud, $updateMask); + * $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 = $vmwareEngineClient->updatePrivateCloud($privateCloud, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updatePrivateCloud'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param PrivateCloud $privateCloud Required. Private cloud description. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 updatePrivateCloud($privateCloud, $updateMask, array $optionalArgs = []) + { + $request = new UpdatePrivateCloudRequest(); + $requestParamHeaders = []; + $request->setPrivateCloud($privateCloud); + $request->setUpdateMask($updateMask); + $requestParamHeaders['private_cloud.name'] = $privateCloud->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdatePrivateCloud', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a `PrivateConnection` resource. Only `description` and + * `routing_mode` fields can be updated. Only fields specified in `updateMask` + * are applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $privateConnection = new PrivateConnection(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updatePrivateConnection($privateConnection, $updateMask); + * $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 = $vmwareEngineClient->updatePrivateConnection($privateConnection, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updatePrivateConnection'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param PrivateConnection $privateConnection Required. Private connection description. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updatePrivateConnection($privateConnection, $updateMask, array $optionalArgs = []) + { + $request = new UpdatePrivateConnectionRequest(); + $requestParamHeaders = []; + $request->setPrivateConnection($privateConnection); + $request->setUpdateMask($updateMask); + $requestParamHeaders['private_connection.name'] = $privateConnection->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdatePrivateConnection', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the parameters of a single subnet. Only fields specified in + * `update_mask` are applied. + * + * *Note*: This API is synchronous and always returns a successful + * `google.longrunning.Operation` (LRO). The returned LRO will only have + * `done` and `response` fields. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $updateMask = new FieldMask(); + * $subnet = new Subnet(); + * $operationResponse = $vmwareEngineClient->updateSubnet($updateMask, $subnet); + * $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 = $vmwareEngineClient->updateSubnet($updateMask, $subnet); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateSubnet'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param Subnet $subnet Required. Subnet description. + * @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 updateSubnet($updateMask, $subnet, array $optionalArgs = []) + { + $request = new UpdateSubnetRequest(); + $requestParamHeaders = []; + $request->setUpdateMask($updateMask); + $request->setSubnet($subnet); + $requestParamHeaders['subnet.name'] = $subnet->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateSubnet', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Modifies a VMware Engine network resource. Only the following fields can be + * updated: `description`. Only fields specified in `updateMask` are + * applied. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $vmwareEngineNetwork = new VmwareEngineNetwork(); + * $updateMask = new FieldMask(); + * $operationResponse = $vmwareEngineClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); + * $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 = $vmwareEngineClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vmwareEngineClient->resumeOperation($operationName, 'updateVmwareEngineNetwork'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param VmwareEngineNetwork $vmwareEngineNetwork Required. VMware Engine network description. + * @param FieldMask $updateMask Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask, array $optionalArgs = []) + { + $request = new UpdateVmwareEngineNetworkRequest(); + $requestParamHeaders = []; + $request->setVmwareEngineNetwork($vmwareEngineNetwork); + $request->setUpdateMask($updateMask); + $requestParamHeaders['vmware_engine_network.name'] = $vmwareEngineNetwork->getName(); + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateVmwareEngineNetwork', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $response = $vmwareEngineClient->getLocation(); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @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\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $vmwareEngineClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vmwareEngineClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } + + /** + * Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $resource = 'resource'; + * $response = $vmwareEngineClient->getIamPolicy($resource); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @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\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Sets the access control policy on the specified resource. Replaces + any existing policy. + + Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` + errors. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $vmwareEngineClient->setIamPolicy($resource, $policy); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @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\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a `NOT_FOUND` error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + * + * Sample code: + * ``` + * $vmwareEngineClient = new VmwareEngineClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $vmwareEngineClient->testIamPermissions($resource, $permissions); + * } finally { + * $vmwareEngineClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @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\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.iam.v1.IAMPolicy')->wait(); + } +} diff --git a/owl-bot-staging/VmwareEngine/v1/src/V1/VmwareEngineClient.php b/owl-bot-staging/VmwareEngine/v1/src/V1/VmwareEngineClient.php new file mode 100644 index 00000000000..37ebc11c596 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/src/V1/VmwareEngineClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.vmwareengine.v1.VmwareEngine' => [ + 'CreateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\Cluster', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateExternalAccessRule' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ExternalAccessRule', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateExternalAddress' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ExternalAddress', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateHcxActivationKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\HcxActivationKey', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateLoggingServer' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\LoggingServer', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateManagementDnsZoneBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateNetworkPeering' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\NetworkPeering', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateNetworkPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\NetworkPolicy', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreatePrivateCloud' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreatePrivateConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateConnection', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateVmwareEngineNetwork' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteExternalAccessRule' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteExternalAddress' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteLoggingServer' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteManagementDnsZoneBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNetworkPeering' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNetworkPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeletePrivateCloud' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeletePrivateConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteVmwareEngineNetwork' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GrantDnsBindPermission' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\DnsBindPermission', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'RepairManagementDnsZoneBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ResetNsxCredentials' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'private_cloud', + 'fieldAccessors' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'ResetVcenterCredentials' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'private_cloud', + 'fieldAccessors' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'RevokeDnsBindPermission' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\DnsBindPermission', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UndeletePrivateCloud' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\Cluster', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'cluster.name', + 'fieldAccessors' => [ + 'getCluster', + 'getName', + ], + ], + ], + ], + 'UpdateDnsForwarding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\DnsForwarding', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'dns_forwarding.name', + 'fieldAccessors' => [ + 'getDnsForwarding', + 'getName', + ], + ], + ], + ], + 'UpdateExternalAccessRule' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ExternalAccessRule', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'external_access_rule.name', + 'fieldAccessors' => [ + 'getExternalAccessRule', + 'getName', + ], + ], + ], + ], + 'UpdateExternalAddress' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ExternalAddress', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'external_address.name', + 'fieldAccessors' => [ + 'getExternalAddress', + 'getName', + ], + ], + ], + ], + 'UpdateLoggingServer' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\LoggingServer', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'logging_server.name', + 'fieldAccessors' => [ + 'getLoggingServer', + 'getName', + ], + ], + ], + ], + 'UpdateManagementDnsZoneBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'management_dns_zone_binding.name', + 'fieldAccessors' => [ + 'getManagementDnsZoneBinding', + 'getName', + ], + ], + ], + ], + 'UpdateNetworkPeering' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\NetworkPeering', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'network_peering.name', + 'fieldAccessors' => [ + 'getNetworkPeering', + 'getName', + ], + ], + ], + ], + 'UpdateNetworkPolicy' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\NetworkPolicy', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'network_policy.name', + 'fieldAccessors' => [ + 'getNetworkPolicy', + 'getName', + ], + ], + ], + ], + 'UpdatePrivateCloud' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'private_cloud.name', + 'fieldAccessors' => [ + 'getPrivateCloud', + 'getName', + ], + ], + ], + ], + 'UpdatePrivateConnection' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\PrivateConnection', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'private_connection.name', + 'fieldAccessors' => [ + 'getPrivateConnection', + 'getName', + ], + ], + ], + ], + 'UpdateSubnet' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\Subnet', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'subnet.name', + 'fieldAccessors' => [ + 'getSubnet', + 'getName', + ], + ], + ], + ], + 'UpdateVmwareEngineNetwork' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork', + 'metadataReturnType' => '\Google\Cloud\VmwareEngine\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'vmware_engine_network.name', + 'fieldAccessors' => [ + 'getVmwareEngineNetwork', + 'getName', + ], + ], + ], + ], + 'FetchNetworkPolicyExternalAddresses' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExternalAddresses', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\FetchNetworkPolicyExternalAddressesResponse', + 'headerParams' => [ + [ + 'keyName' => 'network_policy', + 'fieldAccessors' => [ + 'getNetworkPolicy', + ], + ], + ], + ], + 'GetCluster' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\Cluster', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDnsBindPermission' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\DnsBindPermission', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDnsForwarding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\DnsForwarding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetExternalAccessRule' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ExternalAccessRule', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetExternalAddress' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ExternalAddress', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetHcxActivationKey' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\HcxActivationKey', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLoggingServer' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\LoggingServer', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetManagementDnsZoneBinding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ManagementDnsZoneBinding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNetworkPeering' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\NetworkPeering', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNetworkPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\NetworkPolicy', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNode' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\Node', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetNodeType' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\NodeType', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPrivateCloud' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\PrivateCloud', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPrivateConnection' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\PrivateConnection', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetSubnet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\Subnet', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetVmwareEngineNetwork' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getClusters', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListClustersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListExternalAccessRules' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExternalAccessRules', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListExternalAccessRulesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListExternalAddresses' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExternalAddresses', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListExternalAddressesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListHcxActivationKeys' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getHcxActivationKeys', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListHcxActivationKeysResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLoggingServers' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLoggingServers', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListLoggingServersResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListManagementDnsZoneBindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getManagementDnsZoneBindings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListManagementDnsZoneBindingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListNetworkPeerings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNetworkPeerings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListNetworkPeeringsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListNetworkPolicies' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNetworkPolicies', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListNetworkPoliciesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodeTypes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNodeTypes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListNodeTypesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getNodes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListNodesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPeeringRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPeeringRoutes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListPeeringRoutesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateClouds' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPrivateClouds', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListPrivateCloudsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateConnectionPeeringRoutes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPeeringRoutes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListPrivateConnectionPeeringRoutesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateConnections' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPrivateConnections', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListPrivateConnectionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListSubnets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSubnets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListSubnetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListVmwareEngineNetworks' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getVmwareEngineNetworks', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\ListVmwareEngineNetworksResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ShowNsxCredentials' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\Credentials', + 'headerParams' => [ + [ + 'keyName' => 'private_cloud', + 'fieldAccessors' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'ShowVcenterCredentials' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VmwareEngine\V1\Credentials', + 'headerParams' => [ + [ + 'keyName' => 'private_cloud', + 'fieldAccessors' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + 'interfaceOverride' => 'google.iam.v1.IAMPolicy', + ], + 'templateMap' => [ + 'cluster' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}', + 'dnsBindPermission' => 'projects/{project}/locations/{location}/dnsBindPermission', + 'dnsForwarding' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding', + 'externalAccessRule' => 'projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule}', + 'externalAddress' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}', + 'hcxActivationKey' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}', + 'location' => 'projects/{project}/locations/{location}', + 'loggingServer' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server}', + 'managementDnsZoneBinding' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding}', + 'network' => 'projects/{project}/global/networks/{network}', + 'networkPeering' => 'projects/{project}/locations/{location}/networkPeerings/{network_peering}', + 'networkPolicy' => 'projects/{project}/locations/{location}/networkPolicies/{network_policy}', + 'node' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}', + 'nodeType' => 'projects/{project}/locations/{location}/nodeTypes/{node_type}', + 'privateCloud' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}', + 'privateConnection' => 'projects/{project}/locations/{location}/privateConnections/{private_connection}', + 'subnet' => 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}', + 'vmwareEngineNetwork' => 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VmwareEngine/v1/src/V1/resources/vmware_engine_rest_client_config.php b/owl-bot-staging/VmwareEngine/v1/src/V1/resources/vmware_engine_rest_client_config.php new file mode 100644 index 00000000000..109ba4a005e --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/src/V1/resources/vmware_engine_rest_client_config.php @@ -0,0 +1,1063 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.vmwareengine.v1.VmwareEngine' => [ + 'CreateCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cluster_id', + ], + ], + 'CreateExternalAccessRule' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/networkPolicies/*}/externalAccessRules', + 'body' => 'external_access_rule', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'external_access_rule_id', + ], + ], + 'CreateExternalAddress' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/externalAddresses', + 'body' => 'external_address', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'external_address_id', + ], + ], + 'CreateHcxActivationKey' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys', + 'body' => 'hcx_activation_key', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'hcx_activation_key_id', + ], + ], + 'CreateLoggingServer' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/loggingServers', + 'body' => 'logging_server', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'logging_server_id', + ], + ], + 'CreateManagementDnsZoneBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/managementDnsZoneBindings', + 'body' => 'management_dns_zone_binding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'management_dns_zone_binding_id', + ], + ], + 'CreateNetworkPeering' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/networkPeerings', + 'body' => 'network_peering', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'network_peering_id', + ], + ], + 'CreateNetworkPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/networkPolicies', + 'body' => 'network_policy', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'network_policy_id', + ], + ], + 'CreatePrivateCloud' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/privateClouds', + 'body' => 'private_cloud', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'private_cloud_id', + ], + ], + 'CreatePrivateConnection' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/privateConnections', + 'body' => 'private_connection', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'private_connection_id', + ], + ], + 'CreateVmwareEngineNetwork' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks', + 'body' => 'vmware_engine_network', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'vmware_engine_network_id', + ], + ], + 'DeleteCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteExternalAccessRule' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPolicies/*/externalAccessRules/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteExternalAddress' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/externalAddresses/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteLoggingServer' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/loggingServers/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteManagementDnsZoneBinding' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/managementDnsZoneBindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNetworkPeering' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPeerings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteNetworkPolicy' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeletePrivateCloud' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeletePrivateConnection' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateConnections/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteVmwareEngineNetwork' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FetchNetworkPolicyExternalAddresses' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{network_policy=projects/*/locations/*/networkPolicies/*}:fetchExternalAddresses', + 'placeholders' => [ + 'network_policy' => [ + 'getters' => [ + 'getNetworkPolicy', + ], + ], + ], + ], + 'GetCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDnsBindPermission' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dnsBindPermission}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDnsForwarding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/dnsForwarding}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetExternalAccessRule' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPolicies/*/externalAccessRules/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetExternalAddress' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/externalAddresses/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetHcxActivationKey' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetLoggingServer' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/loggingServers/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetManagementDnsZoneBinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/managementDnsZoneBindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNetworkPeering' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPeerings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNetworkPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/networkPolicies/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNode' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/clusters/*/nodes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetNodeType' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/nodeTypes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPrivateCloud' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPrivateConnection' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateConnections/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetSubnet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/subnets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetVmwareEngineNetwork' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/vmwareEngineNetworks/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GrantDnsBindPermission' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dnsBindPermission}:grant', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/clusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListExternalAccessRules' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/networkPolicies/*}/externalAccessRules', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListExternalAddresses' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/externalAddresses', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListHcxActivationKeys' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/hcxActivationKeys', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListLoggingServers' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/loggingServers', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListManagementDnsZoneBindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/managementDnsZoneBindings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNetworkPeerings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/networkPeerings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNetworkPolicies' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/networkPolicies', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodeTypes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/nodeTypes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListNodes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*/clusters/*}/nodes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPeeringRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/networkPeerings/*}/peeringRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateClouds' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/privateClouds', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateConnectionPeeringRoutes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateConnections/*}/peeringRoutes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPrivateConnections' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/privateConnections', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSubnets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/privateClouds/*}/subnets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListVmwareEngineNetworks' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/vmwareEngineNetworks', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RepairManagementDnsZoneBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*/managementDnsZoneBindings/*}:repair', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ResetNsxCredentials' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetNsxCredentials', + 'body' => '*', + 'placeholders' => [ + 'private_cloud' => [ + 'getters' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'ResetVcenterCredentials' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:resetVcenterCredentials', + 'body' => '*', + 'placeholders' => [ + 'private_cloud' => [ + 'getters' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'RevokeDnsBindPermission' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dnsBindPermission}:revoke', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ShowNsxCredentials' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showNsxCredentials', + 'placeholders' => [ + 'private_cloud' => [ + 'getters' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'ShowVcenterCredentials' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{private_cloud=projects/*/locations/*/privateClouds/*}:showVcenterCredentials', + 'placeholders' => [ + 'private_cloud' => [ + 'getters' => [ + 'getPrivateCloud', + ], + ], + ], + ], + 'UndeletePrivateCloud' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/privateClouds/*}:undelete', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{cluster.name=projects/*/locations/*/privateClouds/*/clusters/*}', + 'body' => 'cluster', + 'placeholders' => [ + 'cluster.name' => [ + 'getters' => [ + 'getCluster', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateDnsForwarding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{dns_forwarding.name=projects/*/locations/*/privateClouds/*/dnsForwarding}', + 'body' => 'dns_forwarding', + 'placeholders' => [ + 'dns_forwarding.name' => [ + 'getters' => [ + 'getDnsForwarding', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateExternalAccessRule' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{external_access_rule.name=projects/*/locations/*/networkPolicies/*/externalAccessRules/*}', + 'body' => 'external_access_rule', + 'placeholders' => [ + 'external_access_rule.name' => [ + 'getters' => [ + 'getExternalAccessRule', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateExternalAddress' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{external_address.name=projects/*/locations/*/privateClouds/*/externalAddresses/*}', + 'body' => 'external_address', + 'placeholders' => [ + 'external_address.name' => [ + 'getters' => [ + 'getExternalAddress', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateLoggingServer' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{logging_server.name=projects/*/locations/*/privateClouds/*/loggingServers/*}', + 'body' => 'logging_server', + 'placeholders' => [ + 'logging_server.name' => [ + 'getters' => [ + 'getLoggingServer', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateManagementDnsZoneBinding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{management_dns_zone_binding.name=projects/*/locations/*/privateClouds/*/managementDnsZoneBindings/*}', + 'body' => 'management_dns_zone_binding', + 'placeholders' => [ + 'management_dns_zone_binding.name' => [ + 'getters' => [ + 'getManagementDnsZoneBinding', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateNetworkPeering' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{network_peering.name=projects/*/locations/*/networkPeerings/*}', + 'body' => 'network_peering', + 'placeholders' => [ + 'network_peering.name' => [ + 'getters' => [ + 'getNetworkPeering', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateNetworkPolicy' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{network_policy.name=projects/*/locations/*/networkPolicies/*}', + 'body' => 'network_policy', + 'placeholders' => [ + 'network_policy.name' => [ + 'getters' => [ + 'getNetworkPolicy', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdatePrivateCloud' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{private_cloud.name=projects/*/locations/*/privateClouds/*}', + 'body' => 'private_cloud', + 'placeholders' => [ + 'private_cloud.name' => [ + 'getters' => [ + 'getPrivateCloud', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdatePrivateConnection' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{private_connection.name=projects/*/locations/*/privateConnections/*}', + 'body' => 'private_connection', + 'placeholders' => [ + 'private_connection.name' => [ + 'getters' => [ + 'getPrivateConnection', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateSubnet' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{subnet.name=projects/*/locations/*/privateClouds/*/subnets/*}', + 'body' => 'subnet', + 'placeholders' => [ + 'subnet.name' => [ + 'getters' => [ + 'getSubnet', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateVmwareEngineNetwork' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{vmware_engine_network.name=projects/*/locations/*/vmwareEngineNetworks/*}', + 'body' => 'vmware_engine_network', + 'placeholders' => [ + 'vmware_engine_network.name' => [ + 'getters' => [ + 'getVmwareEngineNetwork', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + 'google.iam.v1.IAMPolicy' => [ + 'GetIamPolicy' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*}:getIamPolicy', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:getIamPolicy', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:getIamPolicy', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/Client/VmwareEngineClientTest.php b/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/Client/VmwareEngineClientTest.php new file mode 100644 index 00000000000..9493414f444 --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/Client/VmwareEngineClientTest.php @@ -0,0 +1,8496 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VmwareEngineClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VmwareEngineClient($options); + } + + /** @test */ + public function createClusterTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new CreateClusterRequest()) + ->setParent($formattedParent) + ->setClusterId($clusterId) + ->setCluster($cluster); + $response = $gapicClient->createCluster($request); + $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.vmwareengine.v1.VmwareEngine/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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 createClusterExceptionTest() + { + $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/createClusterTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new CreateClusterRequest()) + ->setParent($formattedParent) + ->setClusterId($clusterId) + ->setCluster($cluster); + $response = $gapicClient->createCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + 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 createExternalAccessRuleTest() + { + $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/createExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $externalAccessRule = new ExternalAccessRule(); + $externalAccessRuleId = 'externalAccessRuleId1434975319'; + $request = (new CreateExternalAccessRuleRequest()) + ->setParent($formattedParent) + ->setExternalAccessRule($externalAccessRule) + ->setExternalAccessRuleId($externalAccessRuleId); + $response = $gapicClient->createExternalAccessRule($request); + $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.vmwareengine.v1.VmwareEngine/CreateExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRule(); + $this->assertProtobufEquals($externalAccessRule, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRuleId(); + $this->assertProtobufEquals($externalAccessRuleId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); + $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 createExternalAccessRuleExceptionTest() + { + $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/createExternalAccessRuleTest'); + $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 + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $externalAccessRule = new ExternalAccessRule(); + $externalAccessRuleId = 'externalAccessRuleId1434975319'; + $request = (new CreateExternalAccessRuleRequest()) + ->setParent($formattedParent) + ->setExternalAccessRule($externalAccessRule) + ->setExternalAccessRuleId($externalAccessRuleId); + $response = $gapicClient->createExternalAccessRule($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); + 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 createExternalAddressTest() + { + $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/createExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $externalAddress = new ExternalAddress(); + $externalAddressId = 'externalAddressId344331834'; + $request = (new CreateExternalAddressRequest()) + ->setParent($formattedParent) + ->setExternalAddress($externalAddress) + ->setExternalAddressId($externalAddressId); + $response = $gapicClient->createExternalAddress($request); + $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.vmwareengine.v1.VmwareEngine/CreateExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddress(); + $this->assertProtobufEquals($externalAddress, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddressId(); + $this->assertProtobufEquals($externalAddressId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); + $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 createExternalAddressExceptionTest() + { + $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/createExternalAddressTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $externalAddress = new ExternalAddress(); + $externalAddressId = 'externalAddressId344331834'; + $request = (new CreateExternalAddressRequest()) + ->setParent($formattedParent) + ->setExternalAddress($externalAddress) + ->setExternalAddressId($externalAddressId); + $response = $gapicClient->createExternalAddress($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); + 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 createHcxActivationKeyTest() + { + $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/createHcxActivationKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activationKey = 'activationKey-1343958090'; + $uid = 'uid115792'; + $expectedResponse = new HcxActivationKey(); + $expectedResponse->setName($name); + $expectedResponse->setActivationKey($activationKey); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createHcxActivationKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $hcxActivationKey = new HcxActivationKey(); + $hcxActivationKeyId = 'hcxActivationKeyId26532194'; + $request = (new CreateHcxActivationKeyRequest()) + ->setParent($formattedParent) + ->setHcxActivationKey($hcxActivationKey) + ->setHcxActivationKeyId($hcxActivationKeyId); + $response = $gapicClient->createHcxActivationKey($request); + $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.vmwareengine.v1.VmwareEngine/CreateHcxActivationKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getHcxActivationKey(); + $this->assertProtobufEquals($hcxActivationKey, $actualValue); + $actualValue = $actualApiRequestObject->getHcxActivationKeyId(); + $this->assertProtobufEquals($hcxActivationKeyId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); + $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 createHcxActivationKeyExceptionTest() + { + $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/createHcxActivationKeyTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $hcxActivationKey = new HcxActivationKey(); + $hcxActivationKeyId = 'hcxActivationKeyId26532194'; + $request = (new CreateHcxActivationKeyRequest()) + ->setParent($formattedParent) + ->setHcxActivationKey($hcxActivationKey) + ->setHcxActivationKeyId($hcxActivationKeyId); + $response = $gapicClient->createHcxActivationKey($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); + 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 createLoggingServerTest() + { + $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/createLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $loggingServerId = 'loggingServerId-2097171785'; + $request = (new CreateLoggingServerRequest()) + ->setParent($formattedParent) + ->setLoggingServer($loggingServer) + ->setLoggingServerId($loggingServerId); + $response = $gapicClient->createLoggingServer($request); + $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.vmwareengine.v1.VmwareEngine/CreateLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServer(); + $this->assertProtobufEquals($loggingServer, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServerId(); + $this->assertProtobufEquals($loggingServerId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); + $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 createLoggingServerExceptionTest() + { + $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/createLoggingServerTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $loggingServerId = 'loggingServerId-2097171785'; + $request = (new CreateLoggingServerRequest()) + ->setParent($formattedParent) + ->setLoggingServer($loggingServer) + ->setLoggingServerId($loggingServerId); + $response = $gapicClient->createLoggingServer($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); + 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 createManagementDnsZoneBindingTest() + { + $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/createManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; + $request = (new CreateManagementDnsZoneBindingRequest()) + ->setParent($formattedParent) + ->setManagementDnsZoneBinding($managementDnsZoneBinding) + ->setManagementDnsZoneBindingId($managementDnsZoneBindingId); + $response = $gapicClient->createManagementDnsZoneBinding($request); + $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.vmwareengine.v1.VmwareEngine/CreateManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); + $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBindingId(); + $this->assertProtobufEquals($managementDnsZoneBindingId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); + $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 createManagementDnsZoneBindingExceptionTest() + { + $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/createManagementDnsZoneBindingTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; + $request = (new CreateManagementDnsZoneBindingRequest()) + ->setParent($formattedParent) + ->setManagementDnsZoneBinding($managementDnsZoneBinding) + ->setManagementDnsZoneBindingId($managementDnsZoneBindingId); + $response = $gapicClient->createManagementDnsZoneBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); + 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 createNetworkPeeringTest() + { + $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/createNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPeeringId = 'networkPeeringId-2057959125'; + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $request = (new CreateNetworkPeeringRequest()) + ->setParent($formattedParent) + ->setNetworkPeeringId($networkPeeringId) + ->setNetworkPeering($networkPeering); + $response = $gapicClient->createNetworkPeering($request); + $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.vmwareengine.v1.VmwareEngine/CreateNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPeeringId(); + $this->assertProtobufEquals($networkPeeringId, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPeering(); + $this->assertProtobufEquals($networkPeering, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); + $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 createNetworkPeeringExceptionTest() + { + $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/createNetworkPeeringTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPeeringId = 'networkPeeringId-2057959125'; + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $request = (new CreateNetworkPeeringRequest()) + ->setParent($formattedParent) + ->setNetworkPeeringId($networkPeeringId) + ->setNetworkPeering($networkPeering); + $response = $gapicClient->createNetworkPeering($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); + 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 createNetworkPolicyTest() + { + $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/createNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPolicyId = 'networkPolicyId173955703'; + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $request = (new CreateNetworkPolicyRequest()) + ->setParent($formattedParent) + ->setNetworkPolicyId($networkPolicyId) + ->setNetworkPolicy($networkPolicy); + $response = $gapicClient->createNetworkPolicy($request); + $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.vmwareengine.v1.VmwareEngine/CreateNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPolicyId(); + $this->assertProtobufEquals($networkPolicyId, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($networkPolicy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); + $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 createNetworkPolicyExceptionTest() + { + $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/createNetworkPolicyTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPolicyId = 'networkPolicyId173955703'; + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $request = (new CreateNetworkPolicyRequest()) + ->setParent($formattedParent) + ->setNetworkPolicyId($networkPolicyId) + ->setNetworkPolicy($networkPolicy); + $response = $gapicClient->createNetworkPolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); + 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 createPrivateCloudTest() + { + $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/createPrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateCloudId = 'privateCloudId1366391457'; + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $request = (new CreatePrivateCloudRequest()) + ->setParent($formattedParent) + ->setPrivateCloudId($privateCloudId) + ->setPrivateCloud($privateCloud); + $response = $gapicClient->createPrivateCloud($request); + $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.vmwareengine.v1.VmwareEngine/CreatePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateCloudId(); + $this->assertProtobufEquals($privateCloudId, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($privateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); + $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 createPrivateCloudExceptionTest() + { + $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/createPrivateCloudTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateCloudId = 'privateCloudId1366391457'; + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $request = (new CreatePrivateCloudRequest()) + ->setParent($formattedParent) + ->setPrivateCloudId($privateCloudId) + ->setPrivateCloud($privateCloud); + $response = $gapicClient->createPrivateCloud($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); + 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 createPrivateConnectionTest() + { + $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/createPrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateConnectionId = 'privateConnectionId-1948601248'; + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $request = (new CreatePrivateConnectionRequest()) + ->setParent($formattedParent) + ->setPrivateConnectionId($privateConnectionId) + ->setPrivateConnection($privateConnection); + $response = $gapicClient->createPrivateConnection($request); + $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.vmwareengine.v1.VmwareEngine/CreatePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateConnectionId(); + $this->assertProtobufEquals($privateConnectionId, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateConnection(); + $this->assertProtobufEquals($privateConnection, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); + $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 createPrivateConnectionExceptionTest() + { + $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/createPrivateConnectionTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateConnectionId = 'privateConnectionId-1948601248'; + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $request = (new CreatePrivateConnectionRequest()) + ->setParent($formattedParent) + ->setPrivateConnectionId($privateConnectionId) + ->setPrivateConnection($privateConnection); + $response = $gapicClient->createPrivateConnection($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); + 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 createVmwareEngineNetworkTest() + { + $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/createVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $request = (new CreateVmwareEngineNetworkRequest()) + ->setParent($formattedParent) + ->setVmwareEngineNetworkId($vmwareEngineNetworkId) + ->setVmwareEngineNetwork($vmwareEngineNetwork); + $response = $gapicClient->createVmwareEngineNetwork($request); + $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.vmwareengine.v1.VmwareEngine/CreateVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getVmwareEngineNetworkId(); + $this->assertProtobufEquals($vmwareEngineNetworkId, $actualValue); + $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); + $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); + $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 createVmwareEngineNetworkExceptionTest() + { + $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/createVmwareEngineNetworkTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $request = (new CreateVmwareEngineNetworkRequest()) + ->setParent($formattedParent) + ->setVmwareEngineNetworkId($vmwareEngineNetworkId) + ->setVmwareEngineNetwork($vmwareEngineNetwork); + $response = $gapicClient->createVmwareEngineNetwork($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); + 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 deleteClusterTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new DeleteClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteCluster($request); + $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.vmwareengine.v1.VmwareEngine/DeleteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + $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 deleteClusterExceptionTest() + { + $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/deleteClusterTest'); + $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 + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new DeleteClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + 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 deleteExternalAccessRuleTest() + { + $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/deleteExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $request = (new DeleteExternalAccessRuleRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteExternalAccessRule($request); + $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.vmwareengine.v1.VmwareEngine/DeleteExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); + $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 deleteExternalAccessRuleExceptionTest() + { + $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/deleteExternalAccessRuleTest'); + $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 + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $request = (new DeleteExternalAccessRuleRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteExternalAccessRule($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); + 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 deleteExternalAddressTest() + { + $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/deleteExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $request = (new DeleteExternalAddressRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteExternalAddress($request); + $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.vmwareengine.v1.VmwareEngine/DeleteExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); + $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 deleteExternalAddressExceptionTest() + { + $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/deleteExternalAddressTest'); + $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 + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $request = (new DeleteExternalAddressRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteExternalAddress($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); + 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 deleteLoggingServerTest() + { + $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/deleteLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $request = (new DeleteLoggingServerRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteLoggingServer($request); + $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.vmwareengine.v1.VmwareEngine/DeleteLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); + $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 deleteLoggingServerExceptionTest() + { + $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/deleteLoggingServerTest'); + $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 + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $request = (new DeleteLoggingServerRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteLoggingServer($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); + 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 deleteManagementDnsZoneBindingTest() + { + $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/deleteManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new DeleteManagementDnsZoneBindingRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteManagementDnsZoneBinding($request); + $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.vmwareengine.v1.VmwareEngine/DeleteManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); + $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 deleteManagementDnsZoneBindingExceptionTest() + { + $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/deleteManagementDnsZoneBindingTest'); + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new DeleteManagementDnsZoneBindingRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteManagementDnsZoneBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); + 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 deleteNetworkPeeringTest() + { + $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/deleteNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new DeleteNetworkPeeringRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNetworkPeering($request); + $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.vmwareengine.v1.VmwareEngine/DeleteNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); + $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 deleteNetworkPeeringExceptionTest() + { + $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/deleteNetworkPeeringTest'); + $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 + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new DeleteNetworkPeeringRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNetworkPeering($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); + 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 deleteNetworkPolicyTest() + { + $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/deleteNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new DeleteNetworkPolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNetworkPolicy($request); + $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.vmwareengine.v1.VmwareEngine/DeleteNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); + $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 deleteNetworkPolicyExceptionTest() + { + $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/deleteNetworkPolicyTest'); + $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 + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new DeleteNetworkPolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteNetworkPolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); + 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 deletePrivateCloudTest() + { + $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/deletePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new DeletePrivateCloudRequest()) + ->setName($formattedName); + $response = $gapicClient->deletePrivateCloud($request); + $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.vmwareengine.v1.VmwareEngine/DeletePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); + $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 deletePrivateCloudExceptionTest() + { + $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/deletePrivateCloudTest'); + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new DeletePrivateCloudRequest()) + ->setName($formattedName); + $response = $gapicClient->deletePrivateCloud($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); + 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 deletePrivateConnectionTest() + { + $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/deletePrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new DeletePrivateConnectionRequest()) + ->setName($formattedName); + $response = $gapicClient->deletePrivateConnection($request); + $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.vmwareengine.v1.VmwareEngine/DeletePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); + $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 deletePrivateConnectionExceptionTest() + { + $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/deletePrivateConnectionTest'); + $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 + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new DeletePrivateConnectionRequest()) + ->setName($formattedName); + $response = $gapicClient->deletePrivateConnection($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); + 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 deleteVmwareEngineNetworkTest() + { + $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/deleteVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $request = (new DeleteVmwareEngineNetworkRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteVmwareEngineNetwork($request); + $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.vmwareengine.v1.VmwareEngine/DeleteVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); + $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 deleteVmwareEngineNetworkExceptionTest() + { + $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/deleteVmwareEngineNetworkTest'); + $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 + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $request = (new DeleteVmwareEngineNetworkRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteVmwareEngineNetwork($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); + 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 fetchNetworkPolicyExternalAddressesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAddressesElement = new ExternalAddress(); + $externalAddresses = [ + $externalAddressesElement, + ]; + $expectedResponse = new FetchNetworkPolicyExternalAddressesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAddresses($externalAddresses); + $transport->addResponse($expectedResponse); + // Mock request + $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new FetchNetworkPolicyExternalAddressesRequest()) + ->setNetworkPolicy($formattedNetworkPolicy); + $response = $gapicClient->fetchNetworkPolicyExternalAddresses($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/FetchNetworkPolicyExternalAddresses', $actualFuncCall); + $actualValue = $actualRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($formattedNetworkPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchNetworkPolicyExternalAddressesExceptionTest() + { + $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 + $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new FetchNetworkPolicyExternalAddressesRequest()) + ->setNetworkPolicy($formattedNetworkPolicy); + try { + $gapicClient->fetchNetworkPolicyExternalAddresses($request); + // 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()); + } + + /** @test */ + public function getClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new GetClusterRequest()) + ->setName($formattedName); + $response = $gapicClient->getCluster($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterExceptionTest() + { + $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 + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new GetClusterRequest()) + ->setName($formattedName); + try { + $gapicClient->getCluster($request); + // 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()); + } + + /** @test */ + public function getDnsBindPermissionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $request = (new GetDnsBindPermissionRequest()) + ->setName($formattedName); + $response = $gapicClient->getDnsBindPermission($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetDnsBindPermission', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDnsBindPermissionExceptionTest() + { + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $request = (new GetDnsBindPermissionRequest()) + ->setName($formattedName); + try { + $gapicClient->getDnsBindPermission($request); + // 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()); + } + + /** @test */ + public function getDnsForwardingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsForwarding(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new GetDnsForwardingRequest()) + ->setName($formattedName); + $response = $gapicClient->getDnsForwarding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetDnsForwarding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDnsForwardingExceptionTest() + { + $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 + $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new GetDnsForwardingRequest()) + ->setName($formattedName); + try { + $gapicClient->getDnsForwarding($request); + // 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()); + } + + /** @test */ + public function getExternalAccessRuleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $request = (new GetExternalAccessRuleRequest()) + ->setName($formattedName); + $response = $gapicClient->getExternalAccessRule($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetExternalAccessRule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExternalAccessRuleExceptionTest() + { + $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 + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $request = (new GetExternalAccessRuleRequest()) + ->setName($formattedName); + try { + $gapicClient->getExternalAccessRule($request); + // 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()); + } + + /** @test */ + public function getExternalAddressTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name2); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $request = (new GetExternalAddressRequest()) + ->setName($formattedName); + $response = $gapicClient->getExternalAddress($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetExternalAddress', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExternalAddressExceptionTest() + { + $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 + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $request = (new GetExternalAddressRequest()) + ->setName($formattedName); + try { + $gapicClient->getExternalAddress($request); + // 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()); + } + + /** @test */ + public function getHcxActivationKeyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $activationKey = 'activationKey-1343958090'; + $uid = 'uid115792'; + $expectedResponse = new HcxActivationKey(); + $expectedResponse->setName($name2); + $expectedResponse->setActivationKey($activationKey); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); + $request = (new GetHcxActivationKeyRequest()) + ->setName($formattedName); + $response = $gapicClient->getHcxActivationKey($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetHcxActivationKey', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getHcxActivationKeyExceptionTest() + { + $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 + $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); + $request = (new GetHcxActivationKeyRequest()) + ->setName($formattedName); + try { + $gapicClient->getHcxActivationKey($request); + // 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()); + } + + /** @test */ + public function getLoggingServerTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name2); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $request = (new GetLoggingServerRequest()) + ->setName($formattedName); + $response = $gapicClient->getLoggingServer($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetLoggingServer', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLoggingServerExceptionTest() + { + $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 + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $request = (new GetLoggingServerRequest()) + ->setName($formattedName); + try { + $gapicClient->getLoggingServer($request); + // 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()); + } + + /** @test */ + public function getManagementDnsZoneBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new GetManagementDnsZoneBindingRequest()) + ->setName($formattedName); + $response = $gapicClient->getManagementDnsZoneBinding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetManagementDnsZoneBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagementDnsZoneBindingExceptionTest() + { + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new GetManagementDnsZoneBindingRequest()) + ->setName($formattedName); + try { + $gapicClient->getManagementDnsZoneBinding($request); + // 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()); + } + + /** @test */ + public function getNetworkPeeringTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name2); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new GetNetworkPeeringRequest()) + ->setName($formattedName); + $response = $gapicClient->getNetworkPeering($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNetworkPeering', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNetworkPeeringExceptionTest() + { + $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 + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new GetNetworkPeeringRequest()) + ->setName($formattedName); + try { + $gapicClient->getNetworkPeering($request); + // 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()); + } + + /** @test */ + public function getNetworkPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new GetNetworkPolicyRequest()) + ->setName($formattedName); + $response = $gapicClient->getNetworkPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNetworkPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNetworkPolicyExceptionTest() + { + $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 + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new GetNetworkPolicyRequest()) + ->setName($formattedName); + try { + $gapicClient->getNetworkPolicy($request); + // 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()); + } + + /** @test */ + public function getNodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $fqdn = 'fqdn3150485'; + $internalIp = 'internalIp-2080778775'; + $nodeTypeId = 'nodeTypeId585437955'; + $version = 'version351608024'; + $customCoreCount = 2091833853; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setFqdn($fqdn); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setNodeTypeId($nodeTypeId); + $expectedResponse->setVersion($version); + $expectedResponse->setCustomCoreCount($customCoreCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); + $request = (new GetNodeRequest()) + ->setName($formattedName); + $response = $gapicClient->getNode($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); + $request = (new GetNodeRequest()) + ->setName($formattedName); + try { + $gapicClient->getNode($request); + // 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()); + } + + /** @test */ + public function getNodeTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $nodeTypeId = 'nodeTypeId585437955'; + $displayName = 'displayName1615086568'; + $virtualCpuCount = 289038212; + $totalCoreCount = 282953654; + $memoryGb = 1726613721; + $diskSizeGb = 757478089; + $expectedResponse = new NodeType(); + $expectedResponse->setName($name2); + $expectedResponse->setNodeTypeId($nodeTypeId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVirtualCpuCount($virtualCpuCount); + $expectedResponse->setTotalCoreCount($totalCoreCount); + $expectedResponse->setMemoryGb($memoryGb); + $expectedResponse->setDiskSizeGb($diskSizeGb); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + $request = (new GetNodeTypeRequest()) + ->setName($formattedName); + $response = $gapicClient->getNodeType($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNodeType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeTypeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + $request = (new GetNodeTypeRequest()) + ->setName($formattedName); + try { + $gapicClient->getNodeType($request); + // 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()); + } + + /** @test */ + public function getPrivateCloudTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new GetPrivateCloudRequest()) + ->setName($formattedName); + $response = $gapicClient->getPrivateCloud($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetPrivateCloud', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPrivateCloudExceptionTest() + { + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new GetPrivateCloudRequest()) + ->setName($formattedName); + try { + $gapicClient->getPrivateCloud($request); + // 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()); + } + + /** @test */ + public function getPrivateConnectionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new GetPrivateConnectionRequest()) + ->setName($formattedName); + $response = $gapicClient->getPrivateConnection($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetPrivateConnection', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPrivateConnectionExceptionTest() + { + $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 + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new GetPrivateConnectionRequest()) + ->setName($formattedName); + try { + $gapicClient->getPrivateConnection($request); + // 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()); + } + + /** @test */ + public function getSubnetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $gatewayIp = 'gatewayIp955798786'; + $type = 'type3575610'; + $vlanId = 536153463; + $expectedResponse = new Subnet(); + $expectedResponse->setName($name2); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setGatewayIp($gatewayIp); + $expectedResponse->setType($type); + $expectedResponse->setVlanId($vlanId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); + $request = (new GetSubnetRequest()) + ->setName($formattedName); + $response = $gapicClient->getSubnet($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetSubnet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubnetExceptionTest() + { + $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 + $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); + $request = (new GetSubnetRequest()) + ->setName($formattedName); + try { + $gapicClient->getSubnet($request); + // 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()); + } + + /** @test */ + public function getVmwareEngineNetworkTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $request = (new GetVmwareEngineNetworkRequest()) + ->setName($formattedName); + $response = $gapicClient->getVmwareEngineNetwork($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetVmwareEngineNetwork', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVmwareEngineNetworkExceptionTest() + { + $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 + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $request = (new GetVmwareEngineNetworkRequest()) + ->setName($formattedName); + try { + $gapicClient->getVmwareEngineNetwork($request); + // 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()); + } + + /** @test */ + public function grantDnsBindPermissionTest() + { + $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/grantDnsBindPermissionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/grantDnsBindPermissionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $request = (new GrantDnsBindPermissionRequest()) + ->setName($formattedName) + ->setPrincipal($principal); + $response = $gapicClient->grantDnsBindPermission($request); + $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.vmwareengine.v1.VmwareEngine/GrantDnsBindPermission', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getPrincipal(); + $this->assertProtobufEquals($principal, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); + $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 grantDnsBindPermissionExceptionTest() + { + $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/grantDnsBindPermissionTest'); + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $request = (new GrantDnsBindPermissionRequest()) + ->setName($formattedName) + ->setPrincipal($principal); + $response = $gapicClient->grantDnsBindPermission($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); + 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 listClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $clustersElement = new Cluster(); + $clusters = [ + $clustersElement, + ]; + $expectedResponse = new ListClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setClusters($clusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListClustersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listClusters($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listClustersExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListClustersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listClusters($request); + // 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()); + } + + /** @test */ + public function listExternalAccessRulesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAccessRulesElement = new ExternalAccessRule(); + $externalAccessRules = [ + $externalAccessRulesElement, + ]; + $expectedResponse = new ListExternalAccessRulesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAccessRules($externalAccessRules); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new ListExternalAccessRulesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listExternalAccessRules($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAccessRules()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAccessRules', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExternalAccessRulesExceptionTest() + { + $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 + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $request = (new ListExternalAccessRulesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listExternalAccessRules($request); + // 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()); + } + + /** @test */ + public function listExternalAddressesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAddressesElement = new ExternalAddress(); + $externalAddresses = [ + $externalAddressesElement, + ]; + $expectedResponse = new ListExternalAddressesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAddresses($externalAddresses); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListExternalAddressesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listExternalAddresses($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAddresses', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExternalAddressesExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListExternalAddressesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listExternalAddresses($request); + // 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()); + } + + /** @test */ + public function listHcxActivationKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $hcxActivationKeysElement = new HcxActivationKey(); + $hcxActivationKeys = [ + $hcxActivationKeysElement, + ]; + $expectedResponse = new ListHcxActivationKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setHcxActivationKeys($hcxActivationKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListHcxActivationKeysRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listHcxActivationKeys($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getHcxActivationKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListHcxActivationKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listHcxActivationKeysExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListHcxActivationKeysRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listHcxActivationKeys($request); + // 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()); + } + + /** @test */ + public function listLoggingServersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $loggingServersElement = new LoggingServer(); + $loggingServers = [ + $loggingServersElement, + ]; + $expectedResponse = new ListLoggingServersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLoggingServers($loggingServers); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListLoggingServersRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listLoggingServers($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLoggingServers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListLoggingServers', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLoggingServersExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListLoggingServersRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listLoggingServers($request); + // 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()); + } + + /** @test */ + public function listManagementDnsZoneBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $managementDnsZoneBindingsElement = new ManagementDnsZoneBinding(); + $managementDnsZoneBindings = [ + $managementDnsZoneBindingsElement, + ]; + $expectedResponse = new ListManagementDnsZoneBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setManagementDnsZoneBindings($managementDnsZoneBindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListManagementDnsZoneBindingsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listManagementDnsZoneBindings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getManagementDnsZoneBindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListManagementDnsZoneBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagementDnsZoneBindingsExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListManagementDnsZoneBindingsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listManagementDnsZoneBindings($request); + // 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()); + } + + /** @test */ + public function listNetworkPeeringsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $networkPeeringsElement = new NetworkPeering(); + $networkPeerings = [ + $networkPeeringsElement, + ]; + $expectedResponse = new ListNetworkPeeringsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNetworkPeerings($networkPeerings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNetworkPeeringsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNetworkPeerings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNetworkPeerings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPeerings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNetworkPeeringsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNetworkPeeringsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNetworkPeerings($request); + // 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()); + } + + /** @test */ + public function listNetworkPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $networkPoliciesElement = new NetworkPolicy(); + $networkPolicies = [ + $networkPoliciesElement, + ]; + $expectedResponse = new ListNetworkPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNetworkPolicies($networkPolicies); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNetworkPoliciesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNetworkPolicies($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNetworkPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNetworkPoliciesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNetworkPoliciesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNetworkPolicies($request); + // 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()); + } + + /** @test */ + public function listNodeTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodeTypesElement = new NodeType(); + $nodeTypes = [ + $nodeTypesElement, + ]; + $expectedResponse = new ListNodeTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodeTypes($nodeTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNodeTypesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNodeTypes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodeTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodeTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodeTypesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListNodeTypesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNodeTypes($request); + // 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()); + } + + /** @test */ + public function listNodesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodesElement = new Node(); + $nodes = [ + $nodesElement, + ]; + $expectedResponse = new ListNodesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodes($nodes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new ListNodesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listNodes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodesExceptionTest() + { + $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 + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $request = (new ListNodesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listNodes($request); + // 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()); + } + + /** @test */ + public function listPeeringRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $peeringRoutesElement = new PeeringRoute(); + $peeringRoutes = [ + $peeringRoutesElement, + ]; + $expectedResponse = new ListPeeringRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPeeringRoutes($peeringRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new ListPeeringRoutesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listPeeringRoutes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPeeringRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPeeringRoutesExceptionTest() + { + $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 + $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $request = (new ListPeeringRoutesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listPeeringRoutes($request); + // 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()); + } + + /** @test */ + public function listPrivateCloudsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $privateCloudsElement = new PrivateCloud(); + $privateClouds = [ + $privateCloudsElement, + ]; + $expectedResponse = new ListPrivateCloudsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPrivateClouds($privateClouds); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPrivateCloudsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listPrivateClouds($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPrivateClouds()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateClouds', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateCloudsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPrivateCloudsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listPrivateClouds($request); + // 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()); + } + + /** @test */ + public function listPrivateConnectionPeeringRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $peeringRoutesElement = new PeeringRoute(); + $peeringRoutes = [ + $peeringRoutesElement, + ]; + $expectedResponse = new ListPrivateConnectionPeeringRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPeeringRoutes($peeringRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new ListPrivateConnectionPeeringRoutesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listPrivateConnectionPeeringRoutes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnectionPeeringRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateConnectionPeeringRoutesExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $request = (new ListPrivateConnectionPeeringRoutesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listPrivateConnectionPeeringRoutes($request); + // 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()); + } + + /** @test */ + public function listPrivateConnectionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $privateConnectionsElement = new PrivateConnection(); + $privateConnections = [ + $privateConnectionsElement, + ]; + $expectedResponse = new ListPrivateConnectionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPrivateConnections($privateConnections); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPrivateConnectionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listPrivateConnections($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPrivateConnections()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnections', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateConnectionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPrivateConnectionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listPrivateConnections($request); + // 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()); + } + + /** @test */ + public function listSubnetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subnetsElement = new Subnet(); + $subnets = [ + $subnetsElement, + ]; + $expectedResponse = new ListSubnetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubnets($subnets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListSubnetsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listSubnets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubnets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListSubnets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubnetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ListSubnetsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listSubnets($request); + // 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()); + } + + /** @test */ + public function listVmwareEngineNetworksTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vmwareEngineNetworksElement = new VmwareEngineNetwork(); + $vmwareEngineNetworks = [ + $vmwareEngineNetworksElement, + ]; + $expectedResponse = new ListVmwareEngineNetworksResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVmwareEngineNetworks($vmwareEngineNetworks); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListVmwareEngineNetworksRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listVmwareEngineNetworks($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVmwareEngineNetworks()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListVmwareEngineNetworks', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVmwareEngineNetworksExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListVmwareEngineNetworksRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listVmwareEngineNetworks($request); + // 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()); + } + + /** @test */ + public function repairManagementDnsZoneBindingTest() + { + $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/repairManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/repairManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new RepairManagementDnsZoneBindingRequest()) + ->setName($formattedName); + $response = $gapicClient->repairManagementDnsZoneBinding($request); + $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.vmwareengine.v1.VmwareEngine/RepairManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); + $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 repairManagementDnsZoneBindingExceptionTest() + { + $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/repairManagementDnsZoneBindingTest'); + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $request = (new RepairManagementDnsZoneBindingRequest()) + ->setName($formattedName); + $response = $gapicClient->repairManagementDnsZoneBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); + 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 resetNsxCredentialsTest() + { + $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/resetNsxCredentialsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resetNsxCredentialsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ResetNsxCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->resetNsxCredentials($request); + $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.vmwareengine.v1.VmwareEngine/ResetNsxCredentials', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); + $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 resetNsxCredentialsExceptionTest() + { + $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/resetNsxCredentialsTest'); + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ResetNsxCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->resetNsxCredentials($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); + 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 resetVcenterCredentialsTest() + { + $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/resetVcenterCredentialsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resetVcenterCredentialsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ResetVcenterCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->resetVcenterCredentials($request); + $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.vmwareengine.v1.VmwareEngine/ResetVcenterCredentials', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); + $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 resetVcenterCredentialsExceptionTest() + { + $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/resetVcenterCredentialsTest'); + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ResetVcenterCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->resetVcenterCredentials($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); + 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 revokeDnsBindPermissionTest() + { + $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/revokeDnsBindPermissionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/revokeDnsBindPermissionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $request = (new RevokeDnsBindPermissionRequest()) + ->setName($formattedName) + ->setPrincipal($principal); + $response = $gapicClient->revokeDnsBindPermission($request); + $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.vmwareengine.v1.VmwareEngine/RevokeDnsBindPermission', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getPrincipal(); + $this->assertProtobufEquals($principal, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); + $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 revokeDnsBindPermissionExceptionTest() + { + $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/revokeDnsBindPermissionTest'); + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $request = (new RevokeDnsBindPermissionRequest()) + ->setName($formattedName) + ->setPrincipal($principal); + $response = $gapicClient->revokeDnsBindPermission($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); + 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 showNsxCredentialsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $username = 'username-265713450'; + $password = 'password1216985755'; + $expectedResponse = new Credentials(); + $expectedResponse->setUsername($username); + $expectedResponse->setPassword($password); + $transport->addResponse($expectedResponse); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ShowNsxCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->showNsxCredentials($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowNsxCredentials', $actualFuncCall); + $actualValue = $actualRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function showNsxCredentialsExceptionTest() + { + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ShowNsxCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + try { + $gapicClient->showNsxCredentials($request); + // 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()); + } + + /** @test */ + public function showVcenterCredentialsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $username2 = 'username2-1947551991'; + $password = 'password1216985755'; + $expectedResponse = new Credentials(); + $expectedResponse->setUsername($username2); + $expectedResponse->setPassword($password); + $transport->addResponse($expectedResponse); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ShowVcenterCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + $response = $gapicClient->showVcenterCredentials($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowVcenterCredentials', $actualFuncCall); + $actualValue = $actualRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function showVcenterCredentialsExceptionTest() + { + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new ShowVcenterCredentialsRequest()) + ->setPrivateCloud($formattedPrivateCloud); + try { + $gapicClient->showVcenterCredentials($request); + // 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()); + } + + /** @test */ + public function undeletePrivateCloudTest() + { + $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/undeletePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/undeletePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new UndeletePrivateCloudRequest()) + ->setName($formattedName); + $response = $gapicClient->undeletePrivateCloud($request); + $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.vmwareengine.v1.VmwareEngine/UndeletePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); + $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 undeletePrivateCloudExceptionTest() + { + $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/undeletePrivateCloudTest'); + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $request = (new UndeletePrivateCloudRequest()) + ->setName($formattedName); + $response = $gapicClient->undeletePrivateCloud($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); + 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 updateClusterTest() + { + $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/updateClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new UpdateClusterRequest()) + ->setUpdateMask($updateMask) + ->setCluster($cluster); + $response = $gapicClient->updateCluster($request); + $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.vmwareengine.v1.VmwareEngine/UpdateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + $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 updateClusterExceptionTest() + { + $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/updateClusterTest'); + $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 + $updateMask = new FieldMask(); + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new UpdateClusterRequest()) + ->setUpdateMask($updateMask) + ->setCluster($cluster); + $response = $gapicClient->updateCluster($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + 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 updateDnsForwardingTest() + { + $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/updateDnsForwardingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new DnsForwarding(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDnsForwardingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $dnsForwarding = new DnsForwarding(); + $dnsForwardingForwardingRules = []; + $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); + $updateMask = new FieldMask(); + $request = (new UpdateDnsForwardingRequest()) + ->setDnsForwarding($dnsForwarding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateDnsForwarding($request); + $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.vmwareengine.v1.VmwareEngine/UpdateDnsForwarding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDnsForwarding(); + $this->assertProtobufEquals($dnsForwarding, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); + $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 updateDnsForwardingExceptionTest() + { + $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/updateDnsForwardingTest'); + $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 + $dnsForwarding = new DnsForwarding(); + $dnsForwardingForwardingRules = []; + $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); + $updateMask = new FieldMask(); + $request = (new UpdateDnsForwardingRequest()) + ->setDnsForwarding($dnsForwarding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateDnsForwarding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); + 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 updateExternalAccessRuleTest() + { + $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/updateExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $externalAccessRule = new ExternalAccessRule(); + $request = (new UpdateExternalAccessRuleRequest()) + ->setUpdateMask($updateMask) + ->setExternalAccessRule($externalAccessRule); + $response = $gapicClient->updateExternalAccessRule($request); + $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.vmwareengine.v1.VmwareEngine/UpdateExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRule(); + $this->assertProtobufEquals($externalAccessRule, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); + $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 updateExternalAccessRuleExceptionTest() + { + $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/updateExternalAccessRuleTest'); + $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 + $updateMask = new FieldMask(); + $externalAccessRule = new ExternalAccessRule(); + $request = (new UpdateExternalAccessRuleRequest()) + ->setUpdateMask($updateMask) + ->setExternalAccessRule($externalAccessRule); + $response = $gapicClient->updateExternalAccessRule($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); + 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 updateExternalAddressTest() + { + $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/updateExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $externalAddress = new ExternalAddress(); + $request = (new UpdateExternalAddressRequest()) + ->setUpdateMask($updateMask) + ->setExternalAddress($externalAddress); + $response = $gapicClient->updateExternalAddress($request); + $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.vmwareengine.v1.VmwareEngine/UpdateExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddress(); + $this->assertProtobufEquals($externalAddress, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); + $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 updateExternalAddressExceptionTest() + { + $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/updateExternalAddressTest'); + $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 + $updateMask = new FieldMask(); + $externalAddress = new ExternalAddress(); + $request = (new UpdateExternalAddressRequest()) + ->setUpdateMask($updateMask) + ->setExternalAddress($externalAddress); + $response = $gapicClient->updateExternalAddress($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); + 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 updateLoggingServerTest() + { + $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/updateLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $request = (new UpdateLoggingServerRequest()) + ->setUpdateMask($updateMask) + ->setLoggingServer($loggingServer); + $response = $gapicClient->updateLoggingServer($request); + $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.vmwareengine.v1.VmwareEngine/UpdateLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServer(); + $this->assertProtobufEquals($loggingServer, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); + $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 updateLoggingServerExceptionTest() + { + $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/updateLoggingServerTest'); + $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 + $updateMask = new FieldMask(); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $request = (new UpdateLoggingServerRequest()) + ->setUpdateMask($updateMask) + ->setLoggingServer($loggingServer); + $response = $gapicClient->updateLoggingServer($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); + 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 updateManagementDnsZoneBindingTest() + { + $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/updateManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $request = (new UpdateManagementDnsZoneBindingRequest()) + ->setUpdateMask($updateMask) + ->setManagementDnsZoneBinding($managementDnsZoneBinding); + $response = $gapicClient->updateManagementDnsZoneBinding($request); + $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.vmwareengine.v1.VmwareEngine/UpdateManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); + $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); + $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 updateManagementDnsZoneBindingExceptionTest() + { + $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/updateManagementDnsZoneBindingTest'); + $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 + $updateMask = new FieldMask(); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $request = (new UpdateManagementDnsZoneBindingRequest()) + ->setUpdateMask($updateMask) + ->setManagementDnsZoneBinding($managementDnsZoneBinding); + $response = $gapicClient->updateManagementDnsZoneBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); + 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 updateNetworkPeeringTest() + { + $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/updateNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPeeringRequest()) + ->setNetworkPeering($networkPeering) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateNetworkPeering($request); + $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getNetworkPeering(); + $this->assertProtobufEquals($networkPeering, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); + $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 updateNetworkPeeringExceptionTest() + { + $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/updateNetworkPeeringTest'); + $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 + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPeeringRequest()) + ->setNetworkPeering($networkPeering) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateNetworkPeering($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); + 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 updateNetworkPolicyTest() + { + $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/updateNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPolicyRequest()) + ->setNetworkPolicy($networkPolicy) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateNetworkPolicy($request); + $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($networkPolicy, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); + $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 updateNetworkPolicyExceptionTest() + { + $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/updateNetworkPolicyTest'); + $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 + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $updateMask = new FieldMask(); + $request = (new UpdateNetworkPolicyRequest()) + ->setNetworkPolicy($networkPolicy) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateNetworkPolicy($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); + 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 updatePrivateCloudTest() + { + $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/updatePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateCloudRequest()) + ->setPrivateCloud($privateCloud) + ->setUpdateMask($updateMask); + $response = $gapicClient->updatePrivateCloud($request); + $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.vmwareengine.v1.VmwareEngine/UpdatePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($privateCloud, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); + $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 updatePrivateCloudExceptionTest() + { + $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/updatePrivateCloudTest'); + $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 + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateCloudRequest()) + ->setPrivateCloud($privateCloud) + ->setUpdateMask($updateMask); + $response = $gapicClient->updatePrivateCloud($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); + 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 updatePrivateConnectionTest() + { + $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/updatePrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateConnectionRequest()) + ->setPrivateConnection($privateConnection) + ->setUpdateMask($updateMask); + $response = $gapicClient->updatePrivateConnection($request); + $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.vmwareengine.v1.VmwareEngine/UpdatePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateConnection(); + $this->assertProtobufEquals($privateConnection, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); + $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 updatePrivateConnectionExceptionTest() + { + $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/updatePrivateConnectionTest'); + $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 + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $updateMask = new FieldMask(); + $request = (new UpdatePrivateConnectionRequest()) + ->setPrivateConnection($privateConnection) + ->setUpdateMask($updateMask); + $response = $gapicClient->updatePrivateConnection($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); + 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 updateSubnetTest() + { + $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/updateSubnetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $gatewayIp = 'gatewayIp955798786'; + $type = 'type3575610'; + $vlanId = 536153463; + $expectedResponse = new Subnet(); + $expectedResponse->setName($name); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setGatewayIp($gatewayIp); + $expectedResponse->setType($type); + $expectedResponse->setVlanId($vlanId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSubnetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $subnet = new Subnet(); + $request = (new UpdateSubnetRequest()) + ->setUpdateMask($updateMask) + ->setSubnet($subnet); + $response = $gapicClient->updateSubnet($request); + $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.vmwareengine.v1.VmwareEngine/UpdateSubnet', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getSubnet(); + $this->assertProtobufEquals($subnet, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); + $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 updateSubnetExceptionTest() + { + $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/updateSubnetTest'); + $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 + $updateMask = new FieldMask(); + $subnet = new Subnet(); + $request = (new UpdateSubnetRequest()) + ->setUpdateMask($updateMask) + ->setSubnet($subnet); + $response = $gapicClient->updateSubnet($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); + 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 updateVmwareEngineNetworkTest() + { + $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/updateVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $updateMask = new FieldMask(); + $request = (new UpdateVmwareEngineNetworkRequest()) + ->setVmwareEngineNetwork($vmwareEngineNetwork) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateVmwareEngineNetwork($request); + $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.vmwareengine.v1.VmwareEngine/UpdateVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); + $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); + $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 updateVmwareEngineNetworkExceptionTest() + { + $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/updateVmwareEngineNetworkTest'); + $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 + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $updateMask = new FieldMask(); + $request = (new UpdateVmwareEngineNetworkRequest()) + ->setVmwareEngineNetwork($vmwareEngineNetwork) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateVmwareEngineNetwork($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // 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()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // 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()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // 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()); + } + + /** @test */ + public function createClusterAsyncTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $request = (new CreateClusterRequest()) + ->setParent($formattedParent) + ->setClusterId($clusterId) + ->setCluster($cluster); + $response = $gapicClient->createClusterAsync($request)->wait(); + $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.vmwareengine.v1.VmwareEngine/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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()); + } +} diff --git a/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/VmwareEngineClientTest.php b/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/VmwareEngineClientTest.php new file mode 100644 index 00000000000..0e1daf6292b --- /dev/null +++ b/owl-bot-staging/VmwareEngine/v1/tests/Unit/V1/VmwareEngineClientTest.php @@ -0,0 +1,7944 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VmwareEngineClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VmwareEngineClient($options); + } + + /** @test */ + public function createClusterTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $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.vmwareengine.v1.VmwareEngine/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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 createClusterExceptionTest() + { + $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/createClusterTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + 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 createExternalAccessRuleTest() + { + $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/createExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $externalAccessRule = new ExternalAccessRule(); + $externalAccessRuleId = 'externalAccessRuleId1434975319'; + $response = $gapicClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); + $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.vmwareengine.v1.VmwareEngine/CreateExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRule(); + $this->assertProtobufEquals($externalAccessRule, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRuleId(); + $this->assertProtobufEquals($externalAccessRuleId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); + $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 createExternalAccessRuleExceptionTest() + { + $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/createExternalAccessRuleTest'); + $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 + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $externalAccessRule = new ExternalAccessRule(); + $externalAccessRuleId = 'externalAccessRuleId1434975319'; + $response = $gapicClient->createExternalAccessRule($formattedParent, $externalAccessRule, $externalAccessRuleId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAccessRuleTest'); + 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 createExternalAddressTest() + { + $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/createExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $externalAddress = new ExternalAddress(); + $externalAddressId = 'externalAddressId344331834'; + $response = $gapicClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); + $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.vmwareengine.v1.VmwareEngine/CreateExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddress(); + $this->assertProtobufEquals($externalAddress, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddressId(); + $this->assertProtobufEquals($externalAddressId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); + $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 createExternalAddressExceptionTest() + { + $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/createExternalAddressTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $externalAddress = new ExternalAddress(); + $externalAddressId = 'externalAddressId344331834'; + $response = $gapicClient->createExternalAddress($formattedParent, $externalAddress, $externalAddressId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createExternalAddressTest'); + 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 createHcxActivationKeyTest() + { + $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/createHcxActivationKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $activationKey = 'activationKey-1343958090'; + $uid = 'uid115792'; + $expectedResponse = new HcxActivationKey(); + $expectedResponse->setName($name); + $expectedResponse->setActivationKey($activationKey); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createHcxActivationKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $hcxActivationKey = new HcxActivationKey(); + $hcxActivationKeyId = 'hcxActivationKeyId26532194'; + $response = $gapicClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); + $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.vmwareengine.v1.VmwareEngine/CreateHcxActivationKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getHcxActivationKey(); + $this->assertProtobufEquals($hcxActivationKey, $actualValue); + $actualValue = $actualApiRequestObject->getHcxActivationKeyId(); + $this->assertProtobufEquals($hcxActivationKeyId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); + $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 createHcxActivationKeyExceptionTest() + { + $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/createHcxActivationKeyTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $hcxActivationKey = new HcxActivationKey(); + $hcxActivationKeyId = 'hcxActivationKeyId26532194'; + $response = $gapicClient->createHcxActivationKey($formattedParent, $hcxActivationKey, $hcxActivationKeyId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createHcxActivationKeyTest'); + 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 createLoggingServerTest() + { + $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/createLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $loggingServerId = 'loggingServerId-2097171785'; + $response = $gapicClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); + $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.vmwareengine.v1.VmwareEngine/CreateLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServer(); + $this->assertProtobufEquals($loggingServer, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServerId(); + $this->assertProtobufEquals($loggingServerId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); + $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 createLoggingServerExceptionTest() + { + $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/createLoggingServerTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $loggingServerId = 'loggingServerId-2097171785'; + $response = $gapicClient->createLoggingServer($formattedParent, $loggingServer, $loggingServerId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLoggingServerTest'); + 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 createManagementDnsZoneBindingTest() + { + $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/createManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; + $response = $gapicClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); + $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.vmwareengine.v1.VmwareEngine/CreateManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); + $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBindingId(); + $this->assertProtobufEquals($managementDnsZoneBindingId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); + $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 createManagementDnsZoneBindingExceptionTest() + { + $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/createManagementDnsZoneBindingTest'); + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $managementDnsZoneBindingId = 'managementDnsZoneBindingId-1294625162'; + $response = $gapicClient->createManagementDnsZoneBinding($formattedParent, $managementDnsZoneBinding, $managementDnsZoneBindingId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createManagementDnsZoneBindingTest'); + 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 createNetworkPeeringTest() + { + $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/createNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPeeringId = 'networkPeeringId-2057959125'; + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $response = $gapicClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); + $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.vmwareengine.v1.VmwareEngine/CreateNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPeeringId(); + $this->assertProtobufEquals($networkPeeringId, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPeering(); + $this->assertProtobufEquals($networkPeering, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); + $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 createNetworkPeeringExceptionTest() + { + $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/createNetworkPeeringTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPeeringId = 'networkPeeringId-2057959125'; + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $response = $gapicClient->createNetworkPeering($formattedParent, $networkPeeringId, $networkPeering); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPeeringTest'); + 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 createNetworkPolicyTest() + { + $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/createNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPolicyId = 'networkPolicyId173955703'; + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $response = $gapicClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); + $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.vmwareengine.v1.VmwareEngine/CreateNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPolicyId(); + $this->assertProtobufEquals($networkPolicyId, $actualValue); + $actualValue = $actualApiRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($networkPolicy, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); + $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 createNetworkPolicyExceptionTest() + { + $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/createNetworkPolicyTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $networkPolicyId = 'networkPolicyId173955703'; + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $response = $gapicClient->createNetworkPolicy($formattedParent, $networkPolicyId, $networkPolicy); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createNetworkPolicyTest'); + 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 createPrivateCloudTest() + { + $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/createPrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateCloudId = 'privateCloudId1366391457'; + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $response = $gapicClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); + $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.vmwareengine.v1.VmwareEngine/CreatePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateCloudId(); + $this->assertProtobufEquals($privateCloudId, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($privateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); + $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 createPrivateCloudExceptionTest() + { + $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/createPrivateCloudTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateCloudId = 'privateCloudId1366391457'; + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $response = $gapicClient->createPrivateCloud($formattedParent, $privateCloudId, $privateCloud); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateCloudTest'); + 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 createPrivateConnectionTest() + { + $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/createPrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createPrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateConnectionId = 'privateConnectionId-1948601248'; + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $response = $gapicClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); + $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.vmwareengine.v1.VmwareEngine/CreatePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateConnectionId(); + $this->assertProtobufEquals($privateConnectionId, $actualValue); + $actualValue = $actualApiRequestObject->getPrivateConnection(); + $this->assertProtobufEquals($privateConnection, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); + $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 createPrivateConnectionExceptionTest() + { + $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/createPrivateConnectionTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $privateConnectionId = 'privateConnectionId-1948601248'; + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $response = $gapicClient->createPrivateConnection($formattedParent, $privateConnectionId, $privateConnection); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createPrivateConnectionTest'); + 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 createVmwareEngineNetworkTest() + { + $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/createVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $response = $gapicClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); + $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.vmwareengine.v1.VmwareEngine/CreateVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getVmwareEngineNetworkId(); + $this->assertProtobufEquals($vmwareEngineNetworkId, $actualValue); + $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); + $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); + $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 createVmwareEngineNetworkExceptionTest() + { + $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/createVmwareEngineNetworkTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $vmwareEngineNetworkId = 'vmwareEngineNetworkId2131972382'; + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $response = $gapicClient->createVmwareEngineNetwork($formattedParent, $vmwareEngineNetworkId, $vmwareEngineNetwork); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createVmwareEngineNetworkTest'); + 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 deleteClusterTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + $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 deleteClusterExceptionTest() + { + $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/deleteClusterTest'); + $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 + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + 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 deleteExternalAccessRuleTest() + { + $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/deleteExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $response = $gapicClient->deleteExternalAccessRule($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); + $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 deleteExternalAccessRuleExceptionTest() + { + $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/deleteExternalAccessRuleTest'); + $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 + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $response = $gapicClient->deleteExternalAccessRule($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAccessRuleTest'); + 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 deleteExternalAddressTest() + { + $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/deleteExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $response = $gapicClient->deleteExternalAddress($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); + $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 deleteExternalAddressExceptionTest() + { + $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/deleteExternalAddressTest'); + $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 + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $response = $gapicClient->deleteExternalAddress($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteExternalAddressTest'); + 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 deleteLoggingServerTest() + { + $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/deleteLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $response = $gapicClient->deleteLoggingServer($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); + $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 deleteLoggingServerExceptionTest() + { + $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/deleteLoggingServerTest'); + $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 + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $response = $gapicClient->deleteLoggingServer($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLoggingServerTest'); + 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 deleteManagementDnsZoneBindingTest() + { + $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/deleteManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $response = $gapicClient->deleteManagementDnsZoneBinding($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); + $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 deleteManagementDnsZoneBindingExceptionTest() + { + $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/deleteManagementDnsZoneBindingTest'); + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $response = $gapicClient->deleteManagementDnsZoneBinding($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteManagementDnsZoneBindingTest'); + 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 deleteNetworkPeeringTest() + { + $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/deleteNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $response = $gapicClient->deleteNetworkPeering($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); + $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 deleteNetworkPeeringExceptionTest() + { + $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/deleteNetworkPeeringTest'); + $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 + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $response = $gapicClient->deleteNetworkPeering($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPeeringTest'); + 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 deleteNetworkPolicyTest() + { + $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/deleteNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $response = $gapicClient->deleteNetworkPolicy($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); + $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 deleteNetworkPolicyExceptionTest() + { + $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/deleteNetworkPolicyTest'); + $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 + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $response = $gapicClient->deleteNetworkPolicy($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteNetworkPolicyTest'); + 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 deletePrivateCloudTest() + { + $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/deletePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->deletePrivateCloud($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeletePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); + $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 deletePrivateCloudExceptionTest() + { + $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/deletePrivateCloudTest'); + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->deletePrivateCloud($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateCloudTest'); + 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 deletePrivateConnectionTest() + { + $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/deletePrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deletePrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $response = $gapicClient->deletePrivateConnection($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeletePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); + $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 deletePrivateConnectionExceptionTest() + { + $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/deletePrivateConnectionTest'); + $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 + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $response = $gapicClient->deletePrivateConnection($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deletePrivateConnectionTest'); + 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 deleteVmwareEngineNetworkTest() + { + $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/deleteVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $response = $gapicClient->deleteVmwareEngineNetwork($formattedName); + $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.vmwareengine.v1.VmwareEngine/DeleteVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); + $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 deleteVmwareEngineNetworkExceptionTest() + { + $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/deleteVmwareEngineNetworkTest'); + $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 + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $response = $gapicClient->deleteVmwareEngineNetwork($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteVmwareEngineNetworkTest'); + 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 fetchNetworkPolicyExternalAddressesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAddressesElement = new ExternalAddress(); + $externalAddresses = [ + $externalAddressesElement, + ]; + $expectedResponse = new FetchNetworkPolicyExternalAddressesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAddresses($externalAddresses); + $transport->addResponse($expectedResponse); + // Mock request + $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $response = $gapicClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/FetchNetworkPolicyExternalAddresses', $actualFuncCall); + $actualValue = $actualRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($formattedNetworkPolicy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchNetworkPolicyExternalAddressesExceptionTest() + { + $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 + $formattedNetworkPolicy = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + try { + $gapicClient->fetchNetworkPolicyExternalAddresses($formattedNetworkPolicy); + // 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()); + } + + /** @test */ + public function getClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $response = $gapicClient->getCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterExceptionTest() + { + $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 + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + try { + $gapicClient->getCluster($formattedName); + // 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()); + } + + /** @test */ + public function getDnsBindPermissionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->getDnsBindPermission($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetDnsBindPermission', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDnsBindPermissionExceptionTest() + { + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->getDnsBindPermission($formattedName); + // 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()); + } + + /** @test */ + public function getDnsForwardingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsForwarding(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->getDnsForwarding($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetDnsForwarding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDnsForwardingExceptionTest() + { + $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 + $formattedName = $gapicClient->dnsForwardingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->getDnsForwarding($formattedName); + // 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()); + } + + /** @test */ + public function getExternalAccessRuleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + $response = $gapicClient->getExternalAccessRule($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetExternalAccessRule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExternalAccessRuleExceptionTest() + { + $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 + $formattedName = $gapicClient->externalAccessRuleName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]', '[EXTERNAL_ACCESS_RULE]'); + try { + $gapicClient->getExternalAccessRule($formattedName); + // 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()); + } + + /** @test */ + public function getExternalAddressTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name2); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + $response = $gapicClient->getExternalAddress($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetExternalAddress', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExternalAddressExceptionTest() + { + $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 + $formattedName = $gapicClient->externalAddressName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[EXTERNAL_ADDRESS]'); + try { + $gapicClient->getExternalAddress($formattedName); + // 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()); + } + + /** @test */ + public function getHcxActivationKeyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $activationKey = 'activationKey-1343958090'; + $uid = 'uid115792'; + $expectedResponse = new HcxActivationKey(); + $expectedResponse->setName($name2); + $expectedResponse->setActivationKey($activationKey); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); + $response = $gapicClient->getHcxActivationKey($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetHcxActivationKey', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getHcxActivationKeyExceptionTest() + { + $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 + $formattedName = $gapicClient->hcxActivationKeyName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[HCX_ACTIVATION_KEY]'); + try { + $gapicClient->getHcxActivationKey($formattedName); + // 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()); + } + + /** @test */ + public function getLoggingServerTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name2); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + $response = $gapicClient->getLoggingServer($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetLoggingServer', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLoggingServerExceptionTest() + { + $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 + $formattedName = $gapicClient->loggingServerName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[LOGGING_SERVER]'); + try { + $gapicClient->getLoggingServer($formattedName); + // 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()); + } + + /** @test */ + public function getManagementDnsZoneBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $response = $gapicClient->getManagementDnsZoneBinding($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetManagementDnsZoneBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getManagementDnsZoneBindingExceptionTest() + { + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + try { + $gapicClient->getManagementDnsZoneBinding($formattedName); + // 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()); + } + + /** @test */ + public function getNetworkPeeringTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name2); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $response = $gapicClient->getNetworkPeering($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNetworkPeering', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNetworkPeeringExceptionTest() + { + $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 + $formattedName = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + try { + $gapicClient->getNetworkPeering($formattedName); + // 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()); + } + + /** @test */ + public function getNetworkPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name2); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $response = $gapicClient->getNetworkPolicy($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNetworkPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNetworkPolicyExceptionTest() + { + $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 + $formattedName = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + try { + $gapicClient->getNetworkPolicy($formattedName); + // 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()); + } + + /** @test */ + public function getNodeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $fqdn = 'fqdn3150485'; + $internalIp = 'internalIp-2080778775'; + $nodeTypeId = 'nodeTypeId585437955'; + $version = 'version351608024'; + $customCoreCount = 2091833853; + $expectedResponse = new Node(); + $expectedResponse->setName($name2); + $expectedResponse->setFqdn($fqdn); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setNodeTypeId($nodeTypeId); + $expectedResponse->setVersion($version); + $expectedResponse->setCustomCoreCount($customCoreCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); + $response = $gapicClient->getNode($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNode', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]', '[NODE]'); + try { + $gapicClient->getNode($formattedName); + // 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()); + } + + /** @test */ + public function getNodeTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $nodeTypeId = 'nodeTypeId585437955'; + $displayName = 'displayName1615086568'; + $virtualCpuCount = 289038212; + $totalCoreCount = 282953654; + $memoryGb = 1726613721; + $diskSizeGb = 757478089; + $expectedResponse = new NodeType(); + $expectedResponse->setName($name2); + $expectedResponse->setNodeTypeId($nodeTypeId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setVirtualCpuCount($virtualCpuCount); + $expectedResponse->setTotalCoreCount($totalCoreCount); + $expectedResponse->setMemoryGb($memoryGb); + $expectedResponse->setDiskSizeGb($diskSizeGb); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + $response = $gapicClient->getNodeType($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetNodeType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getNodeTypeExceptionTest() + { + $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 + $formattedName = $gapicClient->nodeTypeName('[PROJECT]', '[LOCATION]', '[NODE_TYPE]'); + try { + $gapicClient->getNodeType($formattedName); + // 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()); + } + + /** @test */ + public function getPrivateCloudTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->getPrivateCloud($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetPrivateCloud', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPrivateCloudExceptionTest() + { + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->getPrivateCloud($formattedName); + // 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()); + } + + /** @test */ + public function getPrivateConnectionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $response = $gapicClient->getPrivateConnection($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetPrivateConnection', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPrivateConnectionExceptionTest() + { + $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 + $formattedName = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + try { + $gapicClient->getPrivateConnection($formattedName); + // 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()); + } + + /** @test */ + public function getSubnetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $gatewayIp = 'gatewayIp955798786'; + $type = 'type3575610'; + $vlanId = 536153463; + $expectedResponse = new Subnet(); + $expectedResponse->setName($name2); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setGatewayIp($gatewayIp); + $expectedResponse->setType($type); + $expectedResponse->setVlanId($vlanId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); + $response = $gapicClient->getSubnet($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetSubnet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSubnetExceptionTest() + { + $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 + $formattedName = $gapicClient->subnetName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[SUBNET]'); + try { + $gapicClient->getSubnet($formattedName); + // 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()); + } + + /** @test */ + public function getVmwareEngineNetworkTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $response = $gapicClient->getVmwareEngineNetwork($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/GetVmwareEngineNetwork', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getVmwareEngineNetworkExceptionTest() + { + $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 + $formattedName = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + try { + $gapicClient->getVmwareEngineNetwork($formattedName); + // 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()); + } + + /** @test */ + public function grantDnsBindPermissionTest() + { + $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/grantDnsBindPermissionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/grantDnsBindPermissionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $response = $gapicClient->grantDnsBindPermission($formattedName, $principal); + $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.vmwareengine.v1.VmwareEngine/GrantDnsBindPermission', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getPrincipal(); + $this->assertProtobufEquals($principal, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); + $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 grantDnsBindPermissionExceptionTest() + { + $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/grantDnsBindPermissionTest'); + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $response = $gapicClient->grantDnsBindPermission($formattedName, $principal); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/grantDnsBindPermissionTest'); + 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 listClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $clustersElement = new Cluster(); + $clusters = [ + $clustersElement, + ]; + $expectedResponse = new ListClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setClusters($clusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listClustersExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listClusters($formattedParent); + // 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()); + } + + /** @test */ + public function listExternalAccessRulesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAccessRulesElement = new ExternalAccessRule(); + $externalAccessRules = [ + $externalAccessRulesElement, + ]; + $expectedResponse = new ListExternalAccessRulesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAccessRules($externalAccessRules); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + $response = $gapicClient->listExternalAccessRules($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAccessRules()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAccessRules', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExternalAccessRulesExceptionTest() + { + $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 + $formattedParent = $gapicClient->networkPolicyName('[PROJECT]', '[LOCATION]', '[NETWORK_POLICY]'); + try { + $gapicClient->listExternalAccessRules($formattedParent); + // 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()); + } + + /** @test */ + public function listExternalAddressesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $externalAddressesElement = new ExternalAddress(); + $externalAddresses = [ + $externalAddressesElement, + ]; + $expectedResponse = new ListExternalAddressesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExternalAddresses($externalAddresses); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listExternalAddresses($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExternalAddresses()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListExternalAddresses', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExternalAddressesExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listExternalAddresses($formattedParent); + // 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()); + } + + /** @test */ + public function listHcxActivationKeysTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $hcxActivationKeysElement = new HcxActivationKey(); + $hcxActivationKeys = [ + $hcxActivationKeysElement, + ]; + $expectedResponse = new ListHcxActivationKeysResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setHcxActivationKeys($hcxActivationKeys); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listHcxActivationKeys($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getHcxActivationKeys()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListHcxActivationKeys', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listHcxActivationKeysExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listHcxActivationKeys($formattedParent); + // 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()); + } + + /** @test */ + public function listLoggingServersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $loggingServersElement = new LoggingServer(); + $loggingServers = [ + $loggingServersElement, + ]; + $expectedResponse = new ListLoggingServersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLoggingServers($loggingServers); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listLoggingServers($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLoggingServers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListLoggingServers', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLoggingServersExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listLoggingServers($formattedParent); + // 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()); + } + + /** @test */ + public function listManagementDnsZoneBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $managementDnsZoneBindingsElement = new ManagementDnsZoneBinding(); + $managementDnsZoneBindings = [ + $managementDnsZoneBindingsElement, + ]; + $expectedResponse = new ListManagementDnsZoneBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setManagementDnsZoneBindings($managementDnsZoneBindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listManagementDnsZoneBindings($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getManagementDnsZoneBindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListManagementDnsZoneBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listManagementDnsZoneBindingsExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listManagementDnsZoneBindings($formattedParent); + // 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()); + } + + /** @test */ + public function listNetworkPeeringsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $networkPeeringsElement = new NetworkPeering(); + $networkPeerings = [ + $networkPeeringsElement, + ]; + $expectedResponse = new ListNetworkPeeringsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNetworkPeerings($networkPeerings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listNetworkPeerings($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNetworkPeerings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPeerings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNetworkPeeringsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listNetworkPeerings($formattedParent); + // 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()); + } + + /** @test */ + public function listNetworkPoliciesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $networkPoliciesElement = new NetworkPolicy(); + $networkPolicies = [ + $networkPoliciesElement, + ]; + $expectedResponse = new ListNetworkPoliciesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNetworkPolicies($networkPolicies); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listNetworkPolicies($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNetworkPolicies()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNetworkPolicies', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNetworkPoliciesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listNetworkPolicies($formattedParent); + // 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()); + } + + /** @test */ + public function listNodeTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodeTypesElement = new NodeType(); + $nodeTypes = [ + $nodeTypesElement, + ]; + $expectedResponse = new ListNodeTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodeTypes($nodeTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listNodeTypes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodeTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodeTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodeTypesExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listNodeTypes($formattedParent); + // 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()); + } + + /** @test */ + public function listNodesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $nodesElement = new Node(); + $nodes = [ + $nodesElement, + ]; + $expectedResponse = new ListNodesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setNodes($nodes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + $response = $gapicClient->listNodes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getNodes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListNodes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listNodesExceptionTest() + { + $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 + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[CLUSTER]'); + try { + $gapicClient->listNodes($formattedParent); + // 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()); + } + + /** @test */ + public function listPeeringRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $peeringRoutesElement = new PeeringRoute(); + $peeringRoutes = [ + $peeringRoutesElement, + ]; + $expectedResponse = new ListPeeringRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPeeringRoutes($peeringRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + $response = $gapicClient->listPeeringRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPeeringRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPeeringRoutesExceptionTest() + { + $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 + $formattedParent = $gapicClient->networkPeeringName('[PROJECT]', '[LOCATION]', '[NETWORK_PEERING]'); + try { + $gapicClient->listPeeringRoutes($formattedParent); + // 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()); + } + + /** @test */ + public function listPrivateCloudsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $privateCloudsElement = new PrivateCloud(); + $privateClouds = [ + $privateCloudsElement, + ]; + $expectedResponse = new ListPrivateCloudsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPrivateClouds($privateClouds); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listPrivateClouds($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPrivateClouds()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateClouds', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateCloudsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listPrivateClouds($formattedParent); + // 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()); + } + + /** @test */ + public function listPrivateConnectionPeeringRoutesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $peeringRoutesElement = new PeeringRoute(); + $peeringRoutes = [ + $peeringRoutesElement, + ]; + $expectedResponse = new ListPrivateConnectionPeeringRoutesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPeeringRoutes($peeringRoutes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + $response = $gapicClient->listPrivateConnectionPeeringRoutes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPeeringRoutes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnectionPeeringRoutes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateConnectionPeeringRoutesExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateConnectionName('[PROJECT]', '[LOCATION]', '[PRIVATE_CONNECTION]'); + try { + $gapicClient->listPrivateConnectionPeeringRoutes($formattedParent); + // 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()); + } + + /** @test */ + public function listPrivateConnectionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $privateConnectionsElement = new PrivateConnection(); + $privateConnections = [ + $privateConnectionsElement, + ]; + $expectedResponse = new ListPrivateConnectionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPrivateConnections($privateConnections); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listPrivateConnections($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPrivateConnections()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListPrivateConnections', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPrivateConnectionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listPrivateConnections($formattedParent); + // 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()); + } + + /** @test */ + public function listSubnetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $subnetsElement = new Subnet(); + $subnets = [ + $subnetsElement, + ]; + $expectedResponse = new ListSubnetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSubnets($subnets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->listSubnets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSubnets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListSubnets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSubnetsExceptionTest() + { + $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 + $formattedParent = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->listSubnets($formattedParent); + // 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()); + } + + /** @test */ + public function listVmwareEngineNetworksTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $vmwareEngineNetworksElement = new VmwareEngineNetwork(); + $vmwareEngineNetworks = [ + $vmwareEngineNetworksElement, + ]; + $expectedResponse = new ListVmwareEngineNetworksResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setVmwareEngineNetworks($vmwareEngineNetworks); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listVmwareEngineNetworks($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getVmwareEngineNetworks()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ListVmwareEngineNetworks', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listVmwareEngineNetworksExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listVmwareEngineNetworks($formattedParent); + // 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()); + } + + /** @test */ + public function repairManagementDnsZoneBindingTest() + { + $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/repairManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/repairManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $response = $gapicClient->repairManagementDnsZoneBinding($formattedName); + $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.vmwareengine.v1.VmwareEngine/RepairManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); + $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 repairManagementDnsZoneBindingExceptionTest() + { + $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/repairManagementDnsZoneBindingTest'); + $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 + $formattedName = $gapicClient->managementDnsZoneBindingName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]', '[MANAGEMENT_DNS_ZONE_BINDING]'); + $response = $gapicClient->repairManagementDnsZoneBinding($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/repairManagementDnsZoneBindingTest'); + 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 resetNsxCredentialsTest() + { + $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/resetNsxCredentialsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resetNsxCredentialsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->resetNsxCredentials($formattedPrivateCloud); + $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.vmwareengine.v1.VmwareEngine/ResetNsxCredentials', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); + $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 resetNsxCredentialsExceptionTest() + { + $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/resetNsxCredentialsTest'); + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->resetNsxCredentials($formattedPrivateCloud); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetNsxCredentialsTest'); + 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 resetVcenterCredentialsTest() + { + $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/resetVcenterCredentialsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/resetVcenterCredentialsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->resetVcenterCredentials($formattedPrivateCloud); + $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.vmwareengine.v1.VmwareEngine/ResetVcenterCredentials', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); + $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 resetVcenterCredentialsExceptionTest() + { + $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/resetVcenterCredentialsTest'); + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->resetVcenterCredentials($formattedPrivateCloud); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/resetVcenterCredentialsTest'); + 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 revokeDnsBindPermissionTest() + { + $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/revokeDnsBindPermissionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new DnsBindPermission(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/revokeDnsBindPermissionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $response = $gapicClient->revokeDnsBindPermission($formattedName, $principal); + $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.vmwareengine.v1.VmwareEngine/RevokeDnsBindPermission', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getPrincipal(); + $this->assertProtobufEquals($principal, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); + $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 revokeDnsBindPermissionExceptionTest() + { + $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/revokeDnsBindPermissionTest'); + $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 + $formattedName = $gapicClient->dnsBindPermissionName('[PROJECT]', '[LOCATION]'); + $principal = new Principal(); + $response = $gapicClient->revokeDnsBindPermission($formattedName, $principal); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/revokeDnsBindPermissionTest'); + 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 showNsxCredentialsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $username = 'username-265713450'; + $password = 'password1216985755'; + $expectedResponse = new Credentials(); + $expectedResponse->setUsername($username); + $expectedResponse->setPassword($password); + $transport->addResponse($expectedResponse); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->showNsxCredentials($formattedPrivateCloud); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowNsxCredentials', $actualFuncCall); + $actualValue = $actualRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function showNsxCredentialsExceptionTest() + { + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->showNsxCredentials($formattedPrivateCloud); + // 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()); + } + + /** @test */ + public function showVcenterCredentialsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $username2 = 'username2-1947551991'; + $password = 'password1216985755'; + $expectedResponse = new Credentials(); + $expectedResponse->setUsername($username2); + $expectedResponse->setPassword($password); + $transport->addResponse($expectedResponse); + // Mock request + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->showVcenterCredentials($formattedPrivateCloud); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vmwareengine.v1.VmwareEngine/ShowVcenterCredentials', $actualFuncCall); + $actualValue = $actualRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($formattedPrivateCloud, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function showVcenterCredentialsExceptionTest() + { + $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 + $formattedPrivateCloud = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + try { + $gapicClient->showVcenterCredentials($formattedPrivateCloud); + // 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()); + } + + /** @test */ + public function undeletePrivateCloudTest() + { + $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/undeletePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/undeletePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->undeletePrivateCloud($formattedName); + $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.vmwareengine.v1.VmwareEngine/UndeletePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); + $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 undeletePrivateCloudExceptionTest() + { + $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/undeletePrivateCloudTest'); + $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 + $formattedName = $gapicClient->privateCloudName('[PROJECT]', '[LOCATION]', '[PRIVATE_CLOUD]'); + $response = $gapicClient->undeletePrivateCloud($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeletePrivateCloudTest'); + 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 updateClusterTest() + { + $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/updateClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $management = false; + $uid = 'uid115792'; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setManagement($management); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $response = $gapicClient->updateCluster($updateMask, $cluster); + $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.vmwareengine.v1.VmwareEngine/UpdateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + $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 updateClusterExceptionTest() + { + $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/updateClusterTest'); + $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 + $updateMask = new FieldMask(); + $cluster = new Cluster(); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $clusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $cluster->setNodeTypeConfigs($clusterNodeTypeConfigs); + $response = $gapicClient->updateCluster($updateMask, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + 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 updateDnsForwardingTest() + { + $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/updateDnsForwardingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $expectedResponse = new DnsForwarding(); + $expectedResponse->setName($name); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDnsForwardingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $dnsForwarding = new DnsForwarding(); + $dnsForwardingForwardingRules = []; + $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); + $updateMask = new FieldMask(); + $response = $gapicClient->updateDnsForwarding($dnsForwarding, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdateDnsForwarding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDnsForwarding(); + $this->assertProtobufEquals($dnsForwarding, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); + $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 updateDnsForwardingExceptionTest() + { + $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/updateDnsForwardingTest'); + $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 + $dnsForwarding = new DnsForwarding(); + $dnsForwardingForwardingRules = []; + $dnsForwarding->setForwardingRules($dnsForwardingForwardingRules); + $updateMask = new FieldMask(); + $response = $gapicClient->updateDnsForwarding($dnsForwarding, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDnsForwardingTest'); + 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 updateExternalAccessRuleTest() + { + $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/updateExternalAccessRuleTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $priority = 1165461084; + $ipProtocol = 'ipProtocol-1134653776'; + $uid = 'uid115792'; + $expectedResponse = new ExternalAccessRule(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setPriority($priority); + $expectedResponse->setIpProtocol($ipProtocol); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateExternalAccessRuleTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $externalAccessRule = new ExternalAccessRule(); + $response = $gapicClient->updateExternalAccessRule($updateMask, $externalAccessRule); + $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.vmwareengine.v1.VmwareEngine/UpdateExternalAccessRule', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAccessRule(); + $this->assertProtobufEquals($externalAccessRule, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); + $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 updateExternalAccessRuleExceptionTest() + { + $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/updateExternalAccessRuleTest'); + $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 + $updateMask = new FieldMask(); + $externalAccessRule = new ExternalAccessRule(); + $response = $gapicClient->updateExternalAccessRule($updateMask, $externalAccessRule); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAccessRuleTest'); + 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 updateExternalAddressTest() + { + $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/updateExternalAddressTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $internalIp = 'internalIp-2080778775'; + $externalIp = 'externalIp-1153075685'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $expectedResponse = new ExternalAddress(); + $expectedResponse->setName($name); + $expectedResponse->setInternalIp($internalIp); + $expectedResponse->setExternalIp($externalIp); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateExternalAddressTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $externalAddress = new ExternalAddress(); + $response = $gapicClient->updateExternalAddress($updateMask, $externalAddress); + $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.vmwareengine.v1.VmwareEngine/UpdateExternalAddress', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getExternalAddress(); + $this->assertProtobufEquals($externalAddress, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); + $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 updateExternalAddressExceptionTest() + { + $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/updateExternalAddressTest'); + $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 + $updateMask = new FieldMask(); + $externalAddress = new ExternalAddress(); + $response = $gapicClient->updateExternalAddress($updateMask, $externalAddress); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateExternalAddressTest'); + 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 updateLoggingServerTest() + { + $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/updateLoggingServerTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $hostname = 'hostname-299803597'; + $port = 3446913; + $uid = 'uid115792'; + $expectedResponse = new LoggingServer(); + $expectedResponse->setName($name); + $expectedResponse->setHostname($hostname); + $expectedResponse->setPort($port); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateLoggingServerTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $response = $gapicClient->updateLoggingServer($updateMask, $loggingServer); + $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.vmwareengine.v1.VmwareEngine/UpdateLoggingServer', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getLoggingServer(); + $this->assertProtobufEquals($loggingServer, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); + $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 updateLoggingServerExceptionTest() + { + $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/updateLoggingServerTest'); + $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 + $updateMask = new FieldMask(); + $loggingServer = new LoggingServer(); + $loggingServerHostname = 'loggingServerHostname2082652629'; + $loggingServer->setHostname($loggingServerHostname); + $loggingServerPort = 243392733; + $loggingServer->setPort($loggingServerPort); + $loggingServerProtocol = Protocol::PROTOCOL_UNSPECIFIED; + $loggingServer->setProtocol($loggingServerProtocol); + $loggingServerSourceType = SourceType::SOURCE_TYPE_UNSPECIFIED; + $loggingServer->setSourceType($loggingServerSourceType); + $response = $gapicClient->updateLoggingServer($updateMask, $loggingServer); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateLoggingServerTest'); + 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 updateManagementDnsZoneBindingTest() + { + $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/updateManagementDnsZoneBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vpcNetwork = 'vpcNetwork-764161832'; + $uid = 'uid115792'; + $expectedResponse = new ManagementDnsZoneBinding(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVpcNetwork($vpcNetwork); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateManagementDnsZoneBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $response = $gapicClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); + $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.vmwareengine.v1.VmwareEngine/UpdateManagementDnsZoneBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getManagementDnsZoneBinding(); + $this->assertProtobufEquals($managementDnsZoneBinding, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); + $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 updateManagementDnsZoneBindingExceptionTest() + { + $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/updateManagementDnsZoneBindingTest'); + $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 + $updateMask = new FieldMask(); + $managementDnsZoneBinding = new ManagementDnsZoneBinding(); + $response = $gapicClient->updateManagementDnsZoneBinding($updateMask, $managementDnsZoneBinding); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateManagementDnsZoneBindingTest'); + 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 updateNetworkPeeringTest() + { + $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/updateNetworkPeeringTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $peerNetwork = 'peerNetwork2111238225'; + $exportCustomRoutes = false; + $importCustomRoutes = true; + $exchangeSubnetRoutes = true; + $exportCustomRoutesWithPublicIp = true; + $importCustomRoutesWithPublicIp = false; + $stateDetails = 'stateDetails632437908'; + $peerMtu = 69584721; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $expectedResponse = new NetworkPeering(); + $expectedResponse->setName($name); + $expectedResponse->setPeerNetwork($peerNetwork); + $expectedResponse->setExportCustomRoutes($exportCustomRoutes); + $expectedResponse->setImportCustomRoutes($importCustomRoutes); + $expectedResponse->setExchangeSubnetRoutes($exchangeSubnetRoutes); + $expectedResponse->setExportCustomRoutesWithPublicIp($exportCustomRoutesWithPublicIp); + $expectedResponse->setImportCustomRoutesWithPublicIp($importCustomRoutesWithPublicIp); + $expectedResponse->setStateDetails($stateDetails); + $expectedResponse->setPeerMtu($peerMtu); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateNetworkPeeringTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $updateMask = new FieldMask(); + $response = $gapicClient->updateNetworkPeering($networkPeering, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPeering', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getNetworkPeering(); + $this->assertProtobufEquals($networkPeering, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); + $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 updateNetworkPeeringExceptionTest() + { + $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/updateNetworkPeeringTest'); + $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 + $networkPeering = new NetworkPeering(); + $networkPeeringPeerNetwork = 'networkPeeringPeerNetwork-385302054'; + $networkPeering->setPeerNetwork($networkPeeringPeerNetwork); + $networkPeeringPeerNetworkType = PeerNetworkType::PEER_NETWORK_TYPE_UNSPECIFIED; + $networkPeering->setPeerNetworkType($networkPeeringPeerNetworkType); + $networkPeeringVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $networkPeering->setVmwareEngineNetwork($networkPeeringVmwareEngineNetwork); + $updateMask = new FieldMask(); + $response = $gapicClient->updateNetworkPeering($networkPeering, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPeeringTest'); + 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 updateNetworkPolicyTest() + { + $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/updateNetworkPolicyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $edgeServicesCidr = 'edgeServicesCidr-792872013'; + $uid = 'uid115792'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $description = 'description-1724546052'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $expectedResponse = new NetworkPolicy(); + $expectedResponse->setName($name); + $expectedResponse->setEdgeServicesCidr($edgeServicesCidr); + $expectedResponse->setUid($uid); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateNetworkPolicyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $updateMask = new FieldMask(); + $response = $gapicClient->updateNetworkPolicy($networkPolicy, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdateNetworkPolicy', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getNetworkPolicy(); + $this->assertProtobufEquals($networkPolicy, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); + $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 updateNetworkPolicyExceptionTest() + { + $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/updateNetworkPolicyTest'); + $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 + $networkPolicy = new NetworkPolicy(); + $networkPolicyEdgeServicesCidr = 'networkPolicyEdgeServicesCidr-602005393'; + $networkPolicy->setEdgeServicesCidr($networkPolicyEdgeServicesCidr); + $updateMask = new FieldMask(); + $response = $gapicClient->updateNetworkPolicy($networkPolicy, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateNetworkPolicyTest'); + 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 updatePrivateCloudTest() + { + $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/updatePrivateCloudTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $expectedResponse = new PrivateCloud(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePrivateCloudTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $updateMask = new FieldMask(); + $response = $gapicClient->updatePrivateCloud($privateCloud, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdatePrivateCloud', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateCloud(); + $this->assertProtobufEquals($privateCloud, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); + $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 updatePrivateCloudExceptionTest() + { + $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/updatePrivateCloudTest'); + $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 + $privateCloud = new PrivateCloud(); + $privateCloudNetworkConfig = new NetworkConfig(); + $networkConfigManagementCidr = 'networkConfigManagementCidr2092091783'; + $privateCloudNetworkConfig->setManagementCidr($networkConfigManagementCidr); + $privateCloud->setNetworkConfig($privateCloudNetworkConfig); + $privateCloudManagementCluster = new ManagementCluster(); + $managementClusterClusterId = 'managementClusterClusterId311493182'; + $privateCloudManagementCluster->setClusterId($managementClusterClusterId); + $nodeTypeConfigsValue = new NodeTypeConfig(); + $valueNodeCount = 1174748740; + $nodeTypeConfigsValue->setNodeCount($valueNodeCount); + $managementClusterNodeTypeConfigs = [ + 'nodeTypeConfigsKey' => $nodeTypeConfigsValue, + ]; + $privateCloudManagementCluster->setNodeTypeConfigs($managementClusterNodeTypeConfigs); + $privateCloud->setManagementCluster($privateCloudManagementCluster); + $updateMask = new FieldMask(); + $response = $gapicClient->updatePrivateCloud($privateCloud, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateCloudTest'); + 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 updatePrivateConnectionTest() + { + $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/updatePrivateConnectionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $vmwareEngineNetwork = 'vmwareEngineNetwork-90899684'; + $vmwareEngineNetworkCanonical = 'vmwareEngineNetworkCanonical779839377'; + $peeringId = 'peeringId-1561749894'; + $uid = 'uid115792'; + $serviceNetwork = 'serviceNetwork1072775844'; + $expectedResponse = new PrivateConnection(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setVmwareEngineNetwork($vmwareEngineNetwork); + $expectedResponse->setVmwareEngineNetworkCanonical($vmwareEngineNetworkCanonical); + $expectedResponse->setPeeringId($peeringId); + $expectedResponse->setUid($uid); + $expectedResponse->setServiceNetwork($serviceNetwork); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updatePrivateConnectionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $updateMask = new FieldMask(); + $response = $gapicClient->updatePrivateConnection($privateConnection, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdatePrivateConnection', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getPrivateConnection(); + $this->assertProtobufEquals($privateConnection, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); + $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 updatePrivateConnectionExceptionTest() + { + $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/updatePrivateConnectionTest'); + $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 + $privateConnection = new PrivateConnection(); + $privateConnectionVmwareEngineNetwork = $gapicClient->vmwareEngineNetworkName('[PROJECT]', '[LOCATION]', '[VMWARE_ENGINE_NETWORK]'); + $privateConnection->setVmwareEngineNetwork($privateConnectionVmwareEngineNetwork); + $privateConnectionType = Type::TYPE_UNSPECIFIED; + $privateConnection->setType($privateConnectionType); + $privateConnectionServiceNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $privateConnection->setServiceNetwork($privateConnectionServiceNetwork); + $updateMask = new FieldMask(); + $response = $gapicClient->updatePrivateConnection($privateConnection, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updatePrivateConnectionTest'); + 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 updateSubnetTest() + { + $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/updateSubnetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $gatewayIp = 'gatewayIp955798786'; + $type = 'type3575610'; + $vlanId = 536153463; + $expectedResponse = new Subnet(); + $expectedResponse->setName($name); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setGatewayIp($gatewayIp); + $expectedResponse->setType($type); + $expectedResponse->setVlanId($vlanId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSubnetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $updateMask = new FieldMask(); + $subnet = new Subnet(); + $response = $gapicClient->updateSubnet($updateMask, $subnet); + $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.vmwareengine.v1.VmwareEngine/UpdateSubnet', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getSubnet(); + $this->assertProtobufEquals($subnet, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); + $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 updateSubnetExceptionTest() + { + $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/updateSubnetTest'); + $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 + $updateMask = new FieldMask(); + $subnet = new Subnet(); + $response = $gapicClient->updateSubnet($updateMask, $subnet); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSubnetTest'); + 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 updateVmwareEngineNetworkTest() + { + $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/updateVmwareEngineNetworkTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $uid = 'uid115792'; + $etag = 'etag3123477'; + $expectedResponse = new VmwareEngineNetwork(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setUid($uid); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateVmwareEngineNetworkTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $updateMask = new FieldMask(); + $response = $gapicClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); + $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.vmwareengine.v1.VmwareEngine/UpdateVmwareEngineNetwork', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getVmwareEngineNetwork(); + $this->assertProtobufEquals($vmwareEngineNetwork, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); + $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 updateVmwareEngineNetworkExceptionTest() + { + $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/updateVmwareEngineNetworkTest'); + $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 + $vmwareEngineNetwork = new VmwareEngineNetwork(); + $vmwareEngineNetworkType = \Google\Cloud\VmwareEngine\V1\VmwareEngineNetwork\Type::TYPE_UNSPECIFIED; + $vmwareEngineNetwork->setType($vmwareEngineNetworkType); + $updateMask = new FieldMask(); + $response = $gapicClient->updateVmwareEngineNetwork($vmwareEngineNetwork, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateVmwareEngineNetworkTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + try { + $gapicClient->getLocation(); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // 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()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // 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()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.iam.v1.IAMPolicy/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $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 + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // 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()); + } +} diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/GPBMetadata/Google/Cloud/Vpcaccess/V1/VpcAccess.php b/owl-bot-staging/VpcAccess/v1/proto/src/GPBMetadata/Google/Cloud/Vpcaccess/V1/VpcAccess.php new file mode 100644 index 00000000000..d90990e0cb7 Binary files /dev/null and b/owl-bot-staging/VpcAccess/v1/proto/src/GPBMetadata/Google/Cloud/Vpcaccess/V1/VpcAccess.php differ diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector.php new file mode 100644 index 00000000000..25fa6427490 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector.php @@ -0,0 +1,421 @@ +google.cloud.vpcaccess.v1.Connector + */ +class Connector extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name in the format `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Name of a VPC network. + * + * Generated from protobuf field string network = 2; + */ + protected $network = ''; + /** + * The range of internal addresses that follows RFC 4632 notation. + * Example: `10.132.0.0/28`. + * + * Generated from protobuf field string ip_cidr_range = 3; + */ + protected $ip_cidr_range = ''; + /** + * Output only. State of the VPC access connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Minimum throughput of the connector in Mbps. Default and min is 200. + * + * Generated from protobuf field int32 min_throughput = 5; + */ + protected $min_throughput = 0; + /** + * Maximum throughput of the connector in Mbps. Default is 300, max is 1000. + * + * Generated from protobuf field int32 max_throughput = 6; + */ + protected $max_throughput = 0; + /** + * Output only. List of projects using the connector. + * + * Generated from protobuf field repeated string connected_projects = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $connected_projects; + /** + * The subnet in which to house the VPC Access Connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.Subnet subnet = 8; + */ + protected $subnet = null; + /** + * Machine type of VM Instance underlying connector. Default is e2-micro + * + * Generated from protobuf field string machine_type = 10; + */ + protected $machine_type = ''; + /** + * Minimum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 min_instances = 11; + */ + protected $min_instances = 0; + /** + * Maximum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 max_instances = 12; + */ + protected $max_instances = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name in the format `projects/*/locations/*/connectors/*`. + * @type string $network + * Name of a VPC network. + * @type string $ip_cidr_range + * The range of internal addresses that follows RFC 4632 notation. + * Example: `10.132.0.0/28`. + * @type int $state + * Output only. State of the VPC access connector. + * @type int $min_throughput + * Minimum throughput of the connector in Mbps. Default and min is 200. + * @type int $max_throughput + * Maximum throughput of the connector in Mbps. Default is 300, max is 1000. + * @type array|\Google\Protobuf\Internal\RepeatedField $connected_projects + * Output only. List of projects using the connector. + * @type \Google\Cloud\VpcAccess\V1\Connector\Subnet $subnet + * The subnet in which to house the VPC Access Connector. + * @type string $machine_type + * Machine type of VM Instance underlying connector. Default is e2-micro + * @type int $min_instances + * Minimum value of instances in autoscaling group underlying the connector. + * @type int $max_instances + * Maximum value of instances in autoscaling group underlying the connector. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * The resource name in the format `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name in the format `projects/*/locations/*/connectors/*`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Name of a VPC network. + * + * Generated from protobuf field string network = 2; + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Name of a VPC network. + * + * Generated from protobuf field string network = 2; + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * The range of internal addresses that follows RFC 4632 notation. + * Example: `10.132.0.0/28`. + * + * Generated from protobuf field string ip_cidr_range = 3; + * @return string + */ + public function getIpCidrRange() + { + return $this->ip_cidr_range; + } + + /** + * The range of internal addresses that follows RFC 4632 notation. + * Example: `10.132.0.0/28`. + * + * Generated from protobuf field string ip_cidr_range = 3; + * @param string $var + * @return $this + */ + public function setIpCidrRange($var) + { + GPBUtil::checkString($var, True); + $this->ip_cidr_range = $var; + + return $this; + } + + /** + * Output only. State of the VPC access connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the VPC access connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\VpcAccess\V1\Connector\State::class); + $this->state = $var; + + return $this; + } + + /** + * Minimum throughput of the connector in Mbps. Default and min is 200. + * + * Generated from protobuf field int32 min_throughput = 5; + * @return int + */ + public function getMinThroughput() + { + return $this->min_throughput; + } + + /** + * Minimum throughput of the connector in Mbps. Default and min is 200. + * + * Generated from protobuf field int32 min_throughput = 5; + * @param int $var + * @return $this + */ + public function setMinThroughput($var) + { + GPBUtil::checkInt32($var); + $this->min_throughput = $var; + + return $this; + } + + /** + * Maximum throughput of the connector in Mbps. Default is 300, max is 1000. + * + * Generated from protobuf field int32 max_throughput = 6; + * @return int + */ + public function getMaxThroughput() + { + return $this->max_throughput; + } + + /** + * Maximum throughput of the connector in Mbps. Default is 300, max is 1000. + * + * Generated from protobuf field int32 max_throughput = 6; + * @param int $var + * @return $this + */ + public function setMaxThroughput($var) + { + GPBUtil::checkInt32($var); + $this->max_throughput = $var; + + return $this; + } + + /** + * Output only. List of projects using the connector. + * + * Generated from protobuf field repeated string connected_projects = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConnectedProjects() + { + return $this->connected_projects; + } + + /** + * Output only. List of projects using the connector. + * + * Generated from protobuf field repeated string connected_projects = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConnectedProjects($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->connected_projects = $arr; + + return $this; + } + + /** + * The subnet in which to house the VPC Access Connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.Subnet subnet = 8; + * @return \Google\Cloud\VpcAccess\V1\Connector\Subnet|null + */ + public function getSubnet() + { + return $this->subnet; + } + + public function hasSubnet() + { + return isset($this->subnet); + } + + public function clearSubnet() + { + unset($this->subnet); + } + + /** + * The subnet in which to house the VPC Access Connector. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector.Subnet subnet = 8; + * @param \Google\Cloud\VpcAccess\V1\Connector\Subnet $var + * @return $this + */ + public function setSubnet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VpcAccess\V1\Connector\Subnet::class); + $this->subnet = $var; + + return $this; + } + + /** + * Machine type of VM Instance underlying connector. Default is e2-micro + * + * Generated from protobuf field string machine_type = 10; + * @return string + */ + public function getMachineType() + { + return $this->machine_type; + } + + /** + * Machine type of VM Instance underlying connector. Default is e2-micro + * + * Generated from protobuf field string machine_type = 10; + * @param string $var + * @return $this + */ + public function setMachineType($var) + { + GPBUtil::checkString($var, True); + $this->machine_type = $var; + + return $this; + } + + /** + * Minimum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 min_instances = 11; + * @return int + */ + public function getMinInstances() + { + return $this->min_instances; + } + + /** + * Minimum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 min_instances = 11; + * @param int $var + * @return $this + */ + public function setMinInstances($var) + { + GPBUtil::checkInt32($var); + $this->min_instances = $var; + + return $this; + } + + /** + * Maximum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 max_instances = 12; + * @return int + */ + public function getMaxInstances() + { + return $this->max_instances; + } + + /** + * Maximum value of instances in autoscaling group underlying the connector. + * + * Generated from protobuf field int32 max_instances = 12; + * @param int $var + * @return $this + */ + public function setMaxInstances($var) + { + GPBUtil::checkInt32($var); + $this->max_instances = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/State.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/State.php new file mode 100644 index 00000000000..a8ea7061ed8 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/State.php @@ -0,0 +1,85 @@ +google.cloud.vpcaccess.v1.Connector.State + */ +class State +{ + /** + * Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Connector is deployed and ready to receive traffic. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * An Insert operation is in progress. Transient condition. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * A Delete operation is in progress. Transient condition. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + /** + * Connector is in a bad state, manual deletion recommended. + * + * Generated from protobuf enum ERROR = 4; + */ + const ERROR = 4; + /** + * The connector is being updated. + * + * Generated from protobuf enum UPDATING = 5; + */ + const UPDATING = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::ERROR => 'ERROR', + self::UPDATING => 'UPDATING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\VpcAccess\V1\Connector_State::class); + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/Subnet.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/Subnet.php new file mode 100644 index 00000000000..4ea82c2b319 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/Connector/Subnet.php @@ -0,0 +1,124 @@ +google.cloud.vpcaccess.v1.Connector.Subnet + */ +class Subnet extends \Google\Protobuf\Internal\Message +{ + /** + * Subnet name (relative, not fully qualified). + * E.g. if the full subnet selfLink is + * https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} + * the correct input for this field would be {subnetName} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Project in which the subnet exists. + * If not set, this project is assumed to be the project for which + * the connector create request was issued. + * + * Generated from protobuf field string project_id = 2; + */ + protected $project_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Subnet name (relative, not fully qualified). + * E.g. if the full subnet selfLink is + * https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} + * the correct input for this field would be {subnetName} + * @type string $project_id + * Project in which the subnet exists. + * If not set, this project is assumed to be the project for which + * the connector create request was issued. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Subnet name (relative, not fully qualified). + * E.g. if the full subnet selfLink is + * https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} + * the correct input for this field would be {subnetName} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Subnet name (relative, not fully qualified). + * E.g. if the full subnet selfLink is + * https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/subnetworks/{subnetName} + * the correct input for this field would be {subnetName} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Project in which the subnet exists. + * If not set, this project is assumed to be the project for which + * the connector create request was issued. + * + * Generated from protobuf field string project_id = 2; + * @return string + */ + public function getProjectId() + { + return $this->project_id; + } + + /** + * Project in which the subnet exists. + * If not set, this project is assumed to be the project for which + * the connector create request was issued. + * + * Generated from protobuf field string project_id = 2; + * @param string $var + * @return $this + */ + public function setProjectId($var) + { + GPBUtil::checkString($var, True); + $this->project_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Subnet::class, \Google\Cloud\VpcAccess\V1\Connector_Subnet::class); + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/CreateConnectorRequest.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/CreateConnectorRequest.php new file mode 100644 index 00000000000..8b40233b6b2 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/CreateConnectorRequest.php @@ -0,0 +1,168 @@ +google.cloud.vpcaccess.v1.CreateConnectorRequest + */ +class CreateConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID to use for this connector. + * + * Generated from protobuf field string connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $connector_id = ''; + /** + * Required. Resource to create. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector connector = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $connector = null; + + /** + * @param string $parent Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. Please see + * {@see VpcAccessServiceClient::locationName()} for help formatting this field. + * @param string $connectorId Required. The ID to use for this connector. + * @param \Google\Cloud\VpcAccess\V1\Connector $connector Required. Resource to create. + * + * @return \Google\Cloud\VpcAccess\V1\CreateConnectorRequest + * + * @experimental + */ + public static function build(string $parent, string $connectorId, \Google\Cloud\VpcAccess\V1\Connector $connector): self + { + return (new self()) + ->setParent($parent) + ->setConnectorId($connectorId) + ->setConnector($connector); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. + * @type string $connector_id + * Required. The ID to use for this connector. + * @type \Google\Cloud\VpcAccess\V1\Connector $connector + * Required. Resource to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ID to use for this connector. + * + * Generated from protobuf field string connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getConnectorId() + { + return $this->connector_id; + } + + /** + * Required. The ID to use for this connector. + * + * Generated from protobuf field string connector_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setConnectorId($var) + { + GPBUtil::checkString($var, True); + $this->connector_id = $var; + + return $this; + } + + /** + * Required. Resource to create. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector connector = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\VpcAccess\V1\Connector|null + */ + public function getConnector() + { + return $this->connector; + } + + public function hasConnector() + { + return isset($this->connector); + } + + public function clearConnector() + { + unset($this->connector); + } + + /** + * Required. Resource to create. + * + * Generated from protobuf field .google.cloud.vpcaccess.v1.Connector connector = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\VpcAccess\V1\Connector $var + * @return $this + */ + public function setConnector($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\VpcAccess\V1\Connector::class); + $this->connector = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/DeleteConnectorRequest.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/DeleteConnectorRequest.php new file mode 100644 index 00000000000..dff74532e1f --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/DeleteConnectorRequest.php @@ -0,0 +1,81 @@ +google.cloud.vpcaccess.v1.DeleteConnectorRequest + */ +class DeleteConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of a Serverless VPC Access connector to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of a Serverless VPC Access connector to delete. Please see + * {@see VpcAccessServiceClient::connectorName()} for help formatting this field. + * + * @return \Google\Cloud\VpcAccess\V1\DeleteConnectorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of a Serverless VPC Access connector to delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of a Serverless VPC Access connector to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of a Serverless VPC Access connector to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/GetConnectorRequest.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/GetConnectorRequest.php new file mode 100644 index 00000000000..e0e5f30df34 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/GetConnectorRequest.php @@ -0,0 +1,81 @@ +google.cloud.vpcaccess.v1.GetConnectorRequest + */ +class GetConnectorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of a Serverless VPC Access connector to get. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of a Serverless VPC Access connector to get. Please see + * {@see VpcAccessServiceClient::connectorName()} for help formatting this field. + * + * @return \Google\Cloud\VpcAccess\V1\GetConnectorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of a Serverless VPC Access connector to get. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of a Serverless VPC Access connector to get. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of a Serverless VPC Access connector to get. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsRequest.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsRequest.php new file mode 100644 index 00000000000..c5aa1382821 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsRequest.php @@ -0,0 +1,149 @@ +google.cloud.vpcaccess.v1.ListConnectorsRequest + */ +class ListConnectorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project and location from which the routes should be listed. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Continuation token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The project and location from which the routes should be listed. Please see + * {@see VpcAccessServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\VpcAccess\V1\ListConnectorsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project and location from which the routes should be listed. + * @type int $page_size + * Maximum number of functions to return per call. + * @type string $page_token + * Continuation token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project and location from which the routes should be listed. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project and location from which the routes should be listed. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of functions to return per call. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Continuation token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Continuation token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsResponse.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsResponse.php new file mode 100644 index 00000000000..58ddaece491 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/ListConnectorsResponse.php @@ -0,0 +1,101 @@ +google.cloud.vpcaccess.v1.ListConnectorsResponse + */ +class ListConnectorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of Serverless VPC Access connectors. + * + * Generated from protobuf field repeated .google.cloud.vpcaccess.v1.Connector connectors = 1; + */ + private $connectors; + /** + * Continuation token. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\VpcAccess\V1\Connector>|\Google\Protobuf\Internal\RepeatedField $connectors + * List of Serverless VPC Access connectors. + * @type string $next_page_token + * Continuation token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * List of Serverless VPC Access connectors. + * + * Generated from protobuf field repeated .google.cloud.vpcaccess.v1.Connector connectors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConnectors() + { + return $this->connectors; + } + + /** + * List of Serverless VPC Access connectors. + * + * Generated from protobuf field repeated .google.cloud.vpcaccess.v1.Connector connectors = 1; + * @param array<\Google\Cloud\VpcAccess\V1\Connector>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConnectors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\VpcAccess\V1\Connector::class); + $this->connectors = $arr; + + return $this; + } + + /** + * Continuation token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Continuation token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/OperationMetadata.php b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/OperationMetadata.php new file mode 100644 index 00000000000..45680ee1e15 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/proto/src/Google/Cloud/VpcAccess/V1/OperationMetadata.php @@ -0,0 +1,197 @@ +google.cloud.vpcaccess.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Method that initiated the operation e.g. + * google.cloud.vpcaccess.v1.Connectors.CreateConnector. + * + * Generated from protobuf field string method = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $method = ''; + /** + * Output only. Time when the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Time when the operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Name of the resource that this operation is acting on e.g. + * projects/my-project/locations/us-central1/connectors/v1. + * + * Generated from protobuf field string target = 5 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $target = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $method + * Output only. Method that initiated the operation e.g. + * google.cloud.vpcaccess.v1.Connectors.CreateConnector. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Time when the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. Time when the operation completed. + * @type string $target + * Output only. Name of the resource that this operation is acting on e.g. + * projects/my-project/locations/us-central1/connectors/v1. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vpcaccess\V1\VpcAccess::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Method that initiated the operation e.g. + * google.cloud.vpcaccess.v1.Connectors.CreateConnector. + * + * Generated from protobuf field string method = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * Output only. Method that initiated the operation e.g. + * google.cloud.vpcaccess.v1.Connectors.CreateConnector. + * + * Generated from protobuf field string method = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setMethod($var) + { + GPBUtil::checkString($var, True); + $this->method = $var; + + return $this; + } + + /** + * Output only. Time when the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Time when the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Time when the operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. Time when the operation completed. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Name of the resource that this operation is acting on e.g. + * projects/my-project/locations/us-central1/connectors/v1. + * + * Generated from protobuf field string target = 5 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Name of the resource that this operation is acting on e.g. + * projects/my-project/locations/us-central1/connectors/v1. + * + * Generated from protobuf field string target = 5 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/create_connector.php b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/create_connector.php new file mode 100644 index 00000000000..5594e856200 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/create_connector.php @@ -0,0 +1,89 @@ +setParent($formattedParent) + ->setConnectorId($connectorId) + ->setConnector($connector); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vpcAccessServiceClient->createConnector($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Connector $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VpcAccessServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $connectorId = '[CONNECTOR_ID]'; + + create_connector_sample($formattedParent, $connectorId); +} +// [END vpcaccess_v1_generated_VpcAccessService_CreateConnector_sync] diff --git a/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/delete_connector.php b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/delete_connector.php new file mode 100644 index 00000000000..bddd6f649db --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/delete_connector.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $vpcAccessServiceClient->deleteConnector($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VpcAccessServiceClient::connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + + delete_connector_sample($formattedName); +} +// [END vpcaccess_v1_generated_VpcAccessService_DeleteConnector_sync] diff --git a/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/get_connector.php b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/get_connector.php new file mode 100644 index 00000000000..7456e8311ff --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/get_connector.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Connector $response */ + $response = $vpcAccessServiceClient->getConnector($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VpcAccessServiceClient::connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + + get_connector_sample($formattedName); +} +// [END vpcaccess_v1_generated_VpcAccessService_GetConnector_sync] diff --git a/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_connectors.php b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_connectors.php new file mode 100644 index 00000000000..5a3af4c6caa --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_connectors.php @@ -0,0 +1,76 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $vpcAccessServiceClient->listConnectors($request); + + /** @var Connector $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VpcAccessServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_connectors_sample($formattedParent); +} +// [END vpcaccess_v1_generated_VpcAccessService_ListConnectors_sync] diff --git a/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_locations.php b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_locations.php new file mode 100644 index 00000000000..0d93ad77f3b --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/samples/V1/VpcAccessServiceClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END vpcaccess_v1_generated_VpcAccessService_ListLocations_sync] diff --git a/owl-bot-staging/VpcAccess/v1/src/V1/Client/VpcAccessServiceClient.php b/owl-bot-staging/VpcAccess/v1/src/V1/Client/VpcAccessServiceClient.php new file mode 100644 index 00000000000..ed7f911a46e --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/src/V1/Client/VpcAccessServiceClient.php @@ -0,0 +1,409 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vpc_access_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vpc_access_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vpc_access_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vpc_access_service_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName(string $project, string $location, string $connector): string + { + return self::getPathTemplate('connector')->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'vpcaccess.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a Serverless VPC Access connector, returns an operation. + * + * The async variant is {@see VpcAccessServiceClient::createConnectorAsync()} . + * + * @example samples/V1/VpcAccessServiceClient/create_connector.php + * + * @param CreateConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createConnector(CreateConnectorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateConnector', $request, $callOptions)->wait(); + } + + /** + * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the + * resource does not exist. + * + * The async variant is {@see VpcAccessServiceClient::deleteConnectorAsync()} . + * + * @example samples/V1/VpcAccessServiceClient/delete_connector.php + * + * @param DeleteConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteConnector(DeleteConnectorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteConnector', $request, $callOptions)->wait(); + } + + /** + * Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource + * does not exist. + * + * The async variant is {@see VpcAccessServiceClient::getConnectorAsync()} . + * + * @example samples/V1/VpcAccessServiceClient/get_connector.php + * + * @param GetConnectorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Connector + * + * @throws ApiException Thrown if the API call fails. + */ + public function getConnector(GetConnectorRequest $request, array $callOptions = []): Connector + { + return $this->startApiCall('GetConnector', $request, $callOptions)->wait(); + } + + /** + * Lists Serverless VPC Access connectors. + * + * The async variant is {@see VpcAccessServiceClient::listConnectorsAsync()} . + * + * @example samples/V1/VpcAccessServiceClient/list_connectors.php + * + * @param ListConnectorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listConnectors(ListConnectorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListConnectors', $request, $callOptions); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see VpcAccessServiceClient::listLocationsAsync()} . + * + * @example samples/V1/VpcAccessServiceClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/VpcAccess/v1/src/V1/Gapic/VpcAccessServiceGapicClient.php b/owl-bot-staging/VpcAccess/v1/src/V1/Gapic/VpcAccessServiceGapicClient.php new file mode 100644 index 00000000000..c7d2749815f --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/src/V1/Gapic/VpcAccessServiceGapicClient.php @@ -0,0 +1,671 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $connectorId = 'connector_id'; + * $connector = new Connector(); + * $operationResponse = $vpcAccessServiceClient->createConnector($formattedParent, $connectorId, $connector); + * $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 = $vpcAccessServiceClient->createConnector($formattedParent, $connectorId, $connector); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vpcAccessServiceClient->resumeOperation($operationName, 'createConnector'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\VpcAccess\V1\Client\VpcAccessServiceClient}. + */ +class VpcAccessServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.vpcaccess.v1.VpcAccessService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'vpcaccess.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'vpcaccess.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 static $connectorNameTemplate; + + private static $locationNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/vpc_access_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/vpc_access_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/vpc_access_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/vpc_access_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getConnectorNameTemplate() + { + if (self::$connectorNameTemplate == null) { + self::$connectorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/connectors/{connector}'); + } + + return self::$connectorNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'connector' => self::getConnectorNameTemplate(), + 'location' => self::getLocationNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a connector + * resource. + * + * @param string $project + * @param string $location + * @param string $connector + * + * @return string The formatted connector resource. + */ + public static function connectorName($project, $location, $connector) + { + return self::getConnectorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'connector' => $connector, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - connector: projects/{project}/locations/{location}/connectors/{connector} + * - location: projects/{project}/locations/{location} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'vpcaccess.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); + } + + /** + * Creates a Serverless VPC Access connector, returns an operation. + * + * Sample code: + * ``` + * $vpcAccessServiceClient = new VpcAccessServiceClient(); + * try { + * $formattedParent = $vpcAccessServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $connectorId = 'connector_id'; + * $connector = new Connector(); + * $operationResponse = $vpcAccessServiceClient->createConnector($formattedParent, $connectorId, $connector); + * $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 = $vpcAccessServiceClient->createConnector($formattedParent, $connectorId, $connector); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vpcAccessServiceClient->resumeOperation($operationName, 'createConnector'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location in which the configuration should be created, + * specified in the format `projects/*/locations/*`. + * @param string $connectorId Required. The ID to use for this connector. + * @param Connector $connector Required. Resource to create. + * @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 createConnector($parent, $connectorId, $connector, array $optionalArgs = []) + { + $request = new CreateConnectorRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setConnectorId($connectorId); + $request->setConnector($connector); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateConnector', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the + * resource does not exist. + * + * Sample code: + * ``` + * $vpcAccessServiceClient = new VpcAccessServiceClient(); + * try { + * $formattedName = $vpcAccessServiceClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + * $operationResponse = $vpcAccessServiceClient->deleteConnector($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $vpcAccessServiceClient->deleteConnector($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $vpcAccessServiceClient->resumeOperation($operationName, 'deleteConnector'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of a Serverless VPC Access connector to delete. + * @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 deleteConnector($name, array $optionalArgs = []) + { + $request = new DeleteConnectorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteConnector', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource + * does not exist. + * + * Sample code: + * ``` + * $vpcAccessServiceClient = new VpcAccessServiceClient(); + * try { + * $formattedName = $vpcAccessServiceClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + * $response = $vpcAccessServiceClient->getConnector($formattedName); + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Name of a Serverless VPC Access connector to get. + * @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\Cloud\VpcAccess\V1\Connector + * + * @throws ApiException if the remote call fails + */ + public function getConnector($name, array $optionalArgs = []) + { + $request = new GetConnectorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetConnector', Connector::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists Serverless VPC Access connectors. + * + * Sample code: + * ``` + * $vpcAccessServiceClient = new VpcAccessServiceClient(); + * try { + * $formattedParent = $vpcAccessServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $vpcAccessServiceClient->listConnectors($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vpcAccessServiceClient->listConnectors($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project and location from which the routes should be listed. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listConnectors($parent, array $optionalArgs = []) + { + $request = new ListConnectorsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListConnectors', $optionalArgs, ListConnectorsResponse::class, $request); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $vpcAccessServiceClient = new VpcAccessServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $vpcAccessServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $vpcAccessServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $vpcAccessServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/VpcAccess/v1/src/V1/VpcAccessServiceClient.php b/owl-bot-staging/VpcAccess/v1/src/V1/VpcAccessServiceClient.php new file mode 100644 index 00000000000..8c79d8a8e6c --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/src/V1/VpcAccessServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.vpcaccess.v1.VpcAccessService' => [ + 'CreateConnector' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\VpcAccess\V1\Connector', + 'metadataReturnType' => '\Google\Cloud\VpcAccess\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteConnector' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\VpcAccess\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetConnector' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\VpcAccess\V1\Connector', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListConnectors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getConnectors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\VpcAccess\V1\ListConnectorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'connector' => 'projects/{project}/locations/{location}/connectors/{connector}', + 'location' => 'projects/{project}/locations/{location}', + ], + ], + ], +]; diff --git a/owl-bot-staging/VpcAccess/v1/src/V1/resources/vpc_access_service_rest_client_config.php b/owl-bot-staging/VpcAccess/v1/src/V1/resources/vpc_access_service_rest_client_config.php new file mode 100644 index 00000000000..941ea819618 --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/src/V1/resources/vpc_access_service_rest_client_config.php @@ -0,0 +1,94 @@ + [ + 'google.cloud.location.Locations' => [ + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.vpcaccess.v1.VpcAccessService' => [ + 'CreateConnector' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/connectors', + 'body' => 'connector', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'connector_id', + ], + ], + 'DeleteConnector' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/connectors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetConnector' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/connectors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListConnectors' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/connectors', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/Client/VpcAccessServiceClientTest.php b/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/Client/VpcAccessServiceClientTest.php new file mode 100644 index 00000000000..96d97e62b4c --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/Client/VpcAccessServiceClientTest.php @@ -0,0 +1,646 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VpcAccessServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VpcAccessServiceClient($options); + } + + /** @test */ + public function createConnectorTest() + { + $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/createConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $minThroughput = 2064735799; + $maxThroughput = 1407819749; + $machineType = 'machineType1838323762'; + $minInstances = 1491624145; + $maxInstances = 330682013; + $expectedResponse = new Connector(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setMinThroughput($minThroughput); + $expectedResponse->setMaxThroughput($maxThroughput); + $expectedResponse->setMachineType($machineType); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setMaxInstances($maxInstances); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $connectorId = 'connectorId1928724045'; + $connector = new Connector(); + $request = (new CreateConnectorRequest()) + ->setParent($formattedParent) + ->setConnectorId($connectorId) + ->setConnector($connector); + $response = $gapicClient->createConnector($request); + $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.vpcaccess.v1.VpcAccessService/CreateConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getConnectorId(); + $this->assertProtobufEquals($connectorId, $actualValue); + $actualValue = $actualApiRequestObject->getConnector(); + $this->assertProtobufEquals($connector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createConnectorTest'); + $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 createConnectorExceptionTest() + { + $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/createConnectorTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $connectorId = 'connectorId1928724045'; + $connector = new Connector(); + $request = (new CreateConnectorRequest()) + ->setParent($formattedParent) + ->setConnectorId($connectorId) + ->setConnector($connector); + $response = $gapicClient->createConnector($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createConnectorTest'); + 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 deleteConnectorTest() + { + $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/deleteConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $request = (new DeleteConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteConnector($request); + $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.vpcaccess.v1.VpcAccessService/DeleteConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteConnectorTest'); + $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 deleteConnectorExceptionTest() + { + $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/deleteConnectorTest'); + $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 + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $request = (new DeleteConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteConnector($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteConnectorTest'); + 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 getConnectorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $minThroughput = 2064735799; + $maxThroughput = 1407819749; + $machineType = 'machineType1838323762'; + $minInstances = 1491624145; + $maxInstances = 330682013; + $expectedResponse = new Connector(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setMinThroughput($minThroughput); + $expectedResponse->setMaxThroughput($maxThroughput); + $expectedResponse->setMachineType($machineType); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setMaxInstances($maxInstances); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $request = (new GetConnectorRequest()) + ->setName($formattedName); + $response = $gapicClient->getConnector($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vpcaccess.v1.VpcAccessService/GetConnector', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConnectorExceptionTest() + { + $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 + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $request = (new GetConnectorRequest()) + ->setName($formattedName); + try { + $gapicClient->getConnector($request); + // 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()); + } + + /** @test */ + public function listConnectorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $connectorsElement = new Connector(); + $connectors = [ + $connectorsElement, + ]; + $expectedResponse = new ListConnectorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setConnectors($connectors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListConnectorsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listConnectors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getConnectors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vpcaccess.v1.VpcAccessService/ListConnectors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listConnectorsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListConnectorsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listConnectors($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function createConnectorAsyncTest() + { + $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/createConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $minThroughput = 2064735799; + $maxThroughput = 1407819749; + $machineType = 'machineType1838323762'; + $minInstances = 1491624145; + $maxInstances = 330682013; + $expectedResponse = new Connector(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setMinThroughput($minThroughput); + $expectedResponse->setMaxThroughput($maxThroughput); + $expectedResponse->setMachineType($machineType); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setMaxInstances($maxInstances); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $connectorId = 'connectorId1928724045'; + $connector = new Connector(); + $request = (new CreateConnectorRequest()) + ->setParent($formattedParent) + ->setConnectorId($connectorId) + ->setConnector($connector); + $response = $gapicClient->createConnectorAsync($request)->wait(); + $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.vpcaccess.v1.VpcAccessService/CreateConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getConnectorId(); + $this->assertProtobufEquals($connectorId, $actualValue); + $actualValue = $actualApiRequestObject->getConnector(); + $this->assertProtobufEquals($connector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createConnectorTest'); + $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()); + } +} diff --git a/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/VpcAccessServiceClientTest.php b/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/VpcAccessServiceClientTest.php new file mode 100644 index 00000000000..dc2f0a1093d --- /dev/null +++ b/owl-bot-staging/VpcAccess/v1/tests/Unit/V1/VpcAccessServiceClientTest.php @@ -0,0 +1,531 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return VpcAccessServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new VpcAccessServiceClient($options); + } + + /** @test */ + public function createConnectorTest() + { + $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/createConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $network = 'network1843485230'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $minThroughput = 2064735799; + $maxThroughput = 1407819749; + $machineType = 'machineType1838323762'; + $minInstances = 1491624145; + $maxInstances = 330682013; + $expectedResponse = new Connector(); + $expectedResponse->setName($name); + $expectedResponse->setNetwork($network); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setMinThroughput($minThroughput); + $expectedResponse->setMaxThroughput($maxThroughput); + $expectedResponse->setMachineType($machineType); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setMaxInstances($maxInstances); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $connectorId = 'connectorId1928724045'; + $connector = new Connector(); + $response = $gapicClient->createConnector($formattedParent, $connectorId, $connector); + $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.vpcaccess.v1.VpcAccessService/CreateConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getConnectorId(); + $this->assertProtobufEquals($connectorId, $actualValue); + $actualValue = $actualApiRequestObject->getConnector(); + $this->assertProtobufEquals($connector, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createConnectorTest'); + $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 createConnectorExceptionTest() + { + $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/createConnectorTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $connectorId = 'connectorId1928724045'; + $connector = new Connector(); + $response = $gapicClient->createConnector($formattedParent, $connectorId, $connector); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createConnectorTest'); + 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 deleteConnectorTest() + { + $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/deleteConnectorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteConnectorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $response = $gapicClient->deleteConnector($formattedName); + $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.vpcaccess.v1.VpcAccessService/DeleteConnector', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteConnectorTest'); + $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 deleteConnectorExceptionTest() + { + $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/deleteConnectorTest'); + $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 + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $response = $gapicClient->deleteConnector($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteConnectorTest'); + 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 getConnectorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $network = 'network1843485230'; + $ipCidrRange = 'ipCidrRange-2049366326'; + $minThroughput = 2064735799; + $maxThroughput = 1407819749; + $machineType = 'machineType1838323762'; + $minInstances = 1491624145; + $maxInstances = 330682013; + $expectedResponse = new Connector(); + $expectedResponse->setName($name2); + $expectedResponse->setNetwork($network); + $expectedResponse->setIpCidrRange($ipCidrRange); + $expectedResponse->setMinThroughput($minThroughput); + $expectedResponse->setMaxThroughput($maxThroughput); + $expectedResponse->setMachineType($machineType); + $expectedResponse->setMinInstances($minInstances); + $expectedResponse->setMaxInstances($maxInstances); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + $response = $gapicClient->getConnector($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vpcaccess.v1.VpcAccessService/GetConnector', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConnectorExceptionTest() + { + $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 + $formattedName = $gapicClient->connectorName('[PROJECT]', '[LOCATION]', '[CONNECTOR]'); + try { + $gapicClient->getConnector($formattedName); + // 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()); + } + + /** @test */ + public function listConnectorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $connectorsElement = new Connector(); + $connectors = [ + $connectorsElement, + ]; + $expectedResponse = new ListConnectorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setConnectors($connectors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listConnectors($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getConnectors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vpcaccess.v1.VpcAccessService/ListConnectors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listConnectorsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listConnectors($formattedParent); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + try { + $gapicClient->listLocations(); + // 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()); + } +} diff --git a/owl-bot-staging/WebRisk/v1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1/Webrisk.php b/owl-bot-staging/WebRisk/v1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1/Webrisk.php new file mode 100644 index 00000000000..3e8a896437e Binary files /dev/null and b/owl-bot-staging/WebRisk/v1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1/Webrisk.php differ diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CompressionType.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CompressionType.php new file mode 100644 index 00000000000..04df8985314 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CompressionType.php @@ -0,0 +1,61 @@ +google.cloud.webrisk.v1.CompressionType + */ +class CompressionType +{ + /** + * Unknown. + * + * Generated from protobuf enum COMPRESSION_TYPE_UNSPECIFIED = 0; + */ + const COMPRESSION_TYPE_UNSPECIFIED = 0; + /** + * Raw, uncompressed data. + * + * Generated from protobuf enum RAW = 1; + */ + const RAW = 1; + /** + * Rice-Golomb encoded data. + * + * Generated from protobuf enum RICE = 2; + */ + const RICE = 2; + + private static $valueToName = [ + self::COMPRESSION_TYPE_UNSPECIFIED => 'COMPRESSION_TYPE_UNSPECIFIED', + self::RAW => 'RAW', + self::RICE => 'RICE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest.php new file mode 100644 index 00000000000..d894cf32783 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest.php @@ -0,0 +1,193 @@ +google.cloud.webrisk.v1.ComputeThreatListDiffRequest + */ +class ComputeThreatListDiffRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $threat_type = 0; + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * + * Generated from protobuf field bytes version_token = 2; + */ + protected $version_token = ''; + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $constraints = null; + + /** + * @param int $threatType Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * @param string $versionToken The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * @param \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints $constraints Required. The constraints associated with this request. + * + * @return \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest + * + * @experimental + */ + public static function build(int $threatType, string $versionToken, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints $constraints): self + { + return (new self()) + ->setThreatType($threatType) + ->setVersionToken($versionToken) + ->setConstraints($constraints); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $threat_type + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * @type string $version_token + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * @type \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints $constraints + * Required. The constraints associated with this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getThreatType() + { + return $this->threat_type; + } + + /** + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setThreatType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_type = $var; + + return $this; + } + + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * + * Generated from protobuf field bytes version_token = 2; + * @return string + */ + public function getVersionToken() + { + return $this->version_token; + } + + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * + * Generated from protobuf field bytes version_token = 2; + * @param string $var + * @return $this + */ + public function setVersionToken($var) + { + GPBUtil::checkString($var, False); + $this->version_token = $var; + + return $this; + } + + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints|null + */ + public function getConstraints() + { + return $this->constraints; + } + + public function hasConstraints() + { + return isset($this->constraints); + } + + public function clearConstraints() + { + unset($this->constraints); + } + + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints $var + * @return $this + */ + public function setConstraints($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest\Constraints::class); + $this->constraints = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest/Constraints.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest/Constraints.php new file mode 100644 index 00000000000..c232ef01ef1 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffRequest/Constraints.php @@ -0,0 +1,154 @@ +google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints + */ +class Constraints extends \Google\Protobuf\Internal\Message +{ + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + */ + protected $max_diff_entries = 0; + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + */ + protected $max_database_entries = 0; + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + */ + private $supported_compressions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_diff_entries + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * @type int $max_database_entries + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_compressions + * The compression types supported by the client. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + * @return int + */ + public function getMaxDiffEntries() + { + return $this->max_diff_entries; + } + + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + * @param int $var + * @return $this + */ + public function setMaxDiffEntries($var) + { + GPBUtil::checkInt32($var); + $this->max_diff_entries = $var; + + return $this; + } + + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + * @return int + */ + public function getMaxDatabaseEntries() + { + return $this->max_database_entries; + } + + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + * @param int $var + * @return $this + */ + public function setMaxDatabaseEntries($var) + { + GPBUtil::checkInt32($var); + $this->max_database_entries = $var; + + return $this; + } + + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedCompressions() + { + return $this->supported_compressions; + } + + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.CompressionType supported_compressions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedCompressions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\CompressionType::class); + $this->supported_compressions = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Constraints::class, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffRequest_Constraints::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse.php new file mode 100644 index 00000000000..501d0b91126 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse.php @@ -0,0 +1,315 @@ +google.cloud.webrisk.v1.ComputeThreatListDiffResponse + */ +class ComputeThreatListDiffResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + */ + protected $response_type = 0; + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + */ + protected $additions = null; + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + */ + protected $removals = null; + /** + * The new opaque client version token. This should be retained by the client + * and passed into the next call of ComputeThreatListDiff as 'version_token'. + * A separate version token should be stored and used for each threatList. + * + * Generated from protobuf field bytes new_version_token = 7; + */ + protected $new_version_token = ''; + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * discard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + protected $checksum = null; + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + */ + protected $recommended_next_diff = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * @type \Google\Cloud\WebRisk\V1\ThreatEntryAdditions $additions + * A set of entries to add to a local threat type's list. + * @type \Google\Cloud\WebRisk\V1\ThreatEntryRemovals $removals + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * @type string $new_version_token + * The new opaque client version token. This should be retained by the client + * and passed into the next call of ComputeThreatListDiff as 'version_token'. + * A separate version token should be stored and used for each threatList. + * @type \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse\Checksum $checksum + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * discard this diff and retry later. + * @type \Google\Protobuf\Timestamp $recommended_next_diff + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse\ResponseType::class); + $this->response_type = $var; + + return $this; + } + + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * @return \Google\Cloud\WebRisk\V1\ThreatEntryAdditions|null + */ + public function getAdditions() + { + return $this->additions; + } + + public function hasAdditions() + { + return isset($this->additions); + } + + public function clearAdditions() + { + unset($this->additions); + } + + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryAdditions additions = 5; + * @param \Google\Cloud\WebRisk\V1\ThreatEntryAdditions $var + * @return $this + */ + public function setAdditions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatEntryAdditions::class); + $this->additions = $var; + + return $this; + } + + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * @return \Google\Cloud\WebRisk\V1\ThreatEntryRemovals|null + */ + public function getRemovals() + { + return $this->removals; + } + + public function hasRemovals() + { + return isset($this->removals); + } + + public function clearRemovals() + { + unset($this->removals); + } + + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatEntryRemovals removals = 6; + * @param \Google\Cloud\WebRisk\V1\ThreatEntryRemovals $var + * @return $this + */ + public function setRemovals($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatEntryRemovals::class); + $this->removals = $var; + + return $this; + } + + /** + * The new opaque client version token. This should be retained by the client + * and passed into the next call of ComputeThreatListDiff as 'version_token'. + * A separate version token should be stored and used for each threatList. + * + * Generated from protobuf field bytes new_version_token = 7; + * @return string + */ + public function getNewVersionToken() + { + return $this->new_version_token; + } + + /** + * The new opaque client version token. This should be retained by the client + * and passed into the next call of ComputeThreatListDiff as 'version_token'. + * A separate version token should be stored and used for each threatList. + * + * Generated from protobuf field bytes new_version_token = 7; + * @param string $var + * @return $this + */ + public function setNewVersionToken($var) + { + GPBUtil::checkString($var, False); + $this->new_version_token = $var; + + return $this; + } + + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * discard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * @return \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse\Checksum|null + */ + public function getChecksum() + { + return $this->checksum; + } + + public function hasChecksum() + { + return isset($this->checksum); + } + + public function clearChecksum() + { + unset($this->checksum); + } + + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * discard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * @param \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse\Checksum $var + * @return $this + */ + public function setChecksum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse\Checksum::class); + $this->checksum = $var; + + return $this; + } + + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRecommendedNextDiff() + { + return $this->recommended_next_diff; + } + + public function hasRecommendedNextDiff() + { + return isset($this->recommended_next_diff); + } + + public function clearRecommendedNextDiff() + { + unset($this->recommended_next_diff); + } + + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRecommendedNextDiff($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->recommended_next_diff = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/Checksum.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/Checksum.php new file mode 100644 index 00000000000..750cdf43d71 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/Checksum.php @@ -0,0 +1,74 @@ +google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum + */ +class Checksum extends \Google\Protobuf\Internal\Message +{ + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + */ + protected $sha256 = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $sha256 + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + * @return string + */ + public function getSha256() + { + return $this->sha256; + } + + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + * @param string $var + * @return $this + */ + public function setSha256($var) + { + GPBUtil::checkString($var, False); + $this->sha256 = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Checksum::class, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse_Checksum::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/ResponseType.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/ResponseType.php new file mode 100644 index 00000000000..99910931557 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ComputeThreatListDiffResponse/ResponseType.php @@ -0,0 +1,66 @@ +google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType + */ +class ResponseType +{ + /** + * Unknown. + * + * Generated from protobuf enum RESPONSE_TYPE_UNSPECIFIED = 0; + */ + const RESPONSE_TYPE_UNSPECIFIED = 0; + /** + * Partial updates are applied to the client's existing local database. + * + * Generated from protobuf enum DIFF = 1; + */ + const DIFF = 1; + /** + * Full updates resets the client's entire local database. This means + * that either the client had no state, was seriously out-of-date, + * or the client is believed to be corrupt. + * + * Generated from protobuf enum RESET = 2; + */ + const RESET = 2; + + private static $valueToName = [ + self::RESPONSE_TYPE_UNSPECIFIED => 'RESPONSE_TYPE_UNSPECIFIED', + self::DIFF => 'DIFF', + self::RESET => 'RESET', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResponseType::class, \Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse_ResponseType::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CreateSubmissionRequest.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CreateSubmissionRequest.php new file mode 100644 index 00000000000..ef012d860b5 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/CreateSubmissionRequest.php @@ -0,0 +1,132 @@ +google.cloud.webrisk.v1.CreateSubmissionRequest + */ +class CreateSubmissionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The submission that contains the content of the phishing report. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $submission = null; + + /** + * @param string $parent Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". Please see + * {@see WebRiskServiceClient::projectName()} for help formatting this field. + * @param \Google\Cloud\WebRisk\V1\Submission $submission Required. The submission that contains the content of the phishing report. + * + * @return \Google\Cloud\WebRisk\V1\CreateSubmissionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\WebRisk\V1\Submission $submission): self + { + return (new self()) + ->setParent($parent) + ->setSubmission($submission); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @type \Google\Cloud\WebRisk\V1\Submission $submission + * Required. The submission that contains the content of the phishing report. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The submission that contains the content of the phishing report. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebRisk\V1\Submission|null + */ + public function getSubmission() + { + return $this->submission; + } + + public function hasSubmission() + { + return isset($this->submission); + } + + public function clearSubmission() + { + unset($this->submission); + } + + /** + * Required. The submission that contains the content of the phishing report. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebRisk\V1\Submission $var + * @return $this + */ + public function setSubmission($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\Submission::class); + $this->submission = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawHashes.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawHashes.php new file mode 100644 index 00000000000..f78700b5e09 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawHashes.php @@ -0,0 +1,123 @@ +google.cloud.webrisk.v1.RawHashes + */ +class RawHashes extends \Google\Protobuf\Internal\Message +{ + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * In practice this is almost always 4, except in exceptional circumstances. + * + * Generated from protobuf field int32 prefix_size = 1; + */ + protected $prefix_size = 0; + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + */ + protected $raw_hashes = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $prefix_size + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * In practice this is almost always 4, except in exceptional circumstances. + * @type string $raw_hashes + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * In practice this is almost always 4, except in exceptional circumstances. + * + * Generated from protobuf field int32 prefix_size = 1; + * @return int + */ + public function getPrefixSize() + { + return $this->prefix_size; + } + + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * In practice this is almost always 4, except in exceptional circumstances. + * + * Generated from protobuf field int32 prefix_size = 1; + * @param int $var + * @return $this + */ + public function setPrefixSize($var) + { + GPBUtil::checkInt32($var); + $this->prefix_size = $var; + + return $this; + } + + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + * @return string + */ + public function getRawHashes() + { + return $this->raw_hashes; + } + + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + * @param string $var + * @return $this + */ + public function setRawHashes($var) + { + GPBUtil::checkString($var, False); + $this->raw_hashes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawIndices.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawIndices.php new file mode 100644 index 00000000000..49698f20272 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RawIndices.php @@ -0,0 +1,67 @@ +google.cloud.webrisk.v1.RawIndices + */ +class RawIndices extends \Google\Protobuf\Internal\Message +{ + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + */ + private $indices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $indices + * The indices to remove from a lexicographically-sorted local list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIndices() + { + return $this->indices; + } + + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->indices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RiceDeltaEncoding.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RiceDeltaEncoding.php new file mode 100644 index 00000000000..32b56a763a7 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/RiceDeltaEncoding.php @@ -0,0 +1,190 @@ +google.cloud.webrisk.v1.RiceDeltaEncoding + */ +class RiceDeltaEncoding extends \Google\Protobuf\Internal\Message +{ + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + */ + protected $first_value = 0; + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + */ + protected $rice_parameter = 0; + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + */ + protected $entry_count = 0; + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + */ + protected $encoded_data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $first_value + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * @type int $rice_parameter + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * @type int $entry_count + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * @type string $encoded_data + * The encoded deltas that are encoded using the Golomb-Rice coder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + * @return int|string + */ + public function getFirstValue() + { + return $this->first_value; + } + + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + * @param int|string $var + * @return $this + */ + public function setFirstValue($var) + { + GPBUtil::checkInt64($var); + $this->first_value = $var; + + return $this; + } + + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + * @return int + */ + public function getRiceParameter() + { + return $this->rice_parameter; + } + + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + * @param int $var + * @return $this + */ + public function setRiceParameter($var) + { + GPBUtil::checkInt32($var); + $this->rice_parameter = $var; + + return $this; + } + + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + * @return int + */ + public function getEntryCount() + { + return $this->entry_count; + } + + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + * @param int $var + * @return $this + */ + public function setEntryCount($var) + { + GPBUtil::checkInt32($var); + $this->entry_count = $var; + + return $this; + } + + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + * @return string + */ + public function getEncodedData() + { + return $this->encoded_data; + } + + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + * @param string $var + * @return $this + */ + public function setEncodedData($var) + { + GPBUtil::checkString($var, False); + $this->encoded_data = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesRequest.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesRequest.php new file mode 100644 index 00000000000..c9435e1e82a --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesRequest.php @@ -0,0 +1,137 @@ +google.cloud.webrisk.v1.SearchHashesRequest + */ +class SearchHashesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * + * Generated from protobuf field bytes hash_prefix = 1; + */ + protected $hash_prefix = ''; + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $threat_types; + + /** + * @param string $hashPrefix A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * @param int[] $threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * + * @return \Google\Cloud\WebRisk\V1\SearchHashesRequest + * + * @experimental + */ + public static function build(string $hashPrefix, array $threatTypes): self + { + return (new self()) + ->setHashPrefix($hashPrefix) + ->setThreatTypes($threatTypes); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $hash_prefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * + * Generated from protobuf field bytes hash_prefix = 1; + * @return string + */ + public function getHashPrefix() + { + return $this->hash_prefix; + } + + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * + * Generated from protobuf field bytes hash_prefix = 1; + * @param string $var + * @return $this + */ + public function setHashPrefix($var) + { + GPBUtil::checkString($var, False); + $this->hash_prefix = $var; + + return $this; + } + + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse.php new file mode 100644 index 00000000000..c390a94c67b --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse.php @@ -0,0 +1,117 @@ +google.cloud.webrisk.v1.SearchHashesResponse + */ +class SearchHashesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + */ + private $threats; + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + */ + protected $negative_expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebRisk\V1\SearchHashesResponse\ThreatHash>|\Google\Protobuf\Internal\RepeatedField $threats + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * @type \Google\Protobuf\Timestamp $negative_expire_time + * For requested entities that did not match the threat list, how long to + * cache the response until. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreats() + { + return $this->threats; + } + + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash threats = 1; + * @param array<\Google\Cloud\WebRisk\V1\SearchHashesResponse\ThreatHash>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebRisk\V1\SearchHashesResponse\ThreatHash::class); + $this->threats = $arr; + + return $this; + } + + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getNegativeExpireTime() + { + return $this->negative_expire_time; + } + + public function hasNegativeExpireTime() + { + return isset($this->negative_expire_time); + } + + public function clearNegativeExpireTime() + { + unset($this->negative_expire_time); + } + + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setNegativeExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->negative_expire_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse/ThreatHash.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse/ThreatHash.php new file mode 100644 index 00000000000..7e955685439 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchHashesResponse/ThreatHash.php @@ -0,0 +1,160 @@ +google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash + */ +class ThreatHash extends \Google\Protobuf\Internal\Message +{ + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + */ + private $threat_types; + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + */ + protected $hash = ''; + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + */ + protected $expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * @type string $hash + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * @type \Google\Protobuf\Timestamp $expire_time + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + * @return string + */ + public function getHash() + { + return $this->hash; + } + + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + * @param string $var + * @return $this + */ + public function setHash($var) + { + GPBUtil::checkString($var, False); + $this->hash = $var; + + return $this; + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ThreatHash::class, \Google\Cloud\WebRisk\V1\SearchHashesResponse_ThreatHash::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisRequest.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisRequest.php new file mode 100644 index 00000000000..f9697b4e866 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisRequest.php @@ -0,0 +1,122 @@ +google.cloud.webrisk.v1.SearchUrisRequest + */ +class SearchUrisRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $threat_types; + + /** + * @param string $uri Required. The URI to be checked for matches. + * @param int[] $threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * + * @return \Google\Cloud\WebRisk\V1\SearchUrisRequest + * + * @experimental + */ + public static function build(string $uri, array $threatTypes): self + { + return (new self()) + ->setUri($uri) + ->setThreatTypes($threatTypes); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. The URI to be checked for matches. + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse.php new file mode 100644 index 00000000000..0505e304946 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse.php @@ -0,0 +1,75 @@ +google.cloud.webrisk.v1.SearchUrisResponse + */ +class SearchUrisResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The threat list matches. This might be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + */ + protected $threat = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebRisk\V1\SearchUrisResponse\ThreatUri $threat + * The threat list matches. This might be empty if the URI is on no list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The threat list matches. This might be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * @return \Google\Cloud\WebRisk\V1\SearchUrisResponse\ThreatUri|null + */ + public function getThreat() + { + return $this->threat; + } + + public function hasThreat() + { + return isset($this->threat); + } + + public function clearThreat() + { + unset($this->threat); + } + + /** + * The threat list matches. This might be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri threat = 1; + * @param \Google\Cloud\WebRisk\V1\SearchUrisResponse\ThreatUri $var + * @return $this + */ + public function setThreat($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\SearchUrisResponse\ThreatUri::class); + $this->threat = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse/ThreatUri.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse/ThreatUri.php new file mode 100644 index 00000000000..30d655f4b0e --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SearchUrisResponse/ThreatUri.php @@ -0,0 +1,118 @@ +google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri + */ +class ThreatUri extends \Google\Protobuf\Internal\Message +{ + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + */ + private $threat_types; + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + */ + protected $expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * The ThreatList this threat belongs to. + * @type \Google\Protobuf\Timestamp $expire_time + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ThreatUri::class, \Google\Cloud\WebRisk\V1\SearchUrisResponse_ThreatUri::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/Submission.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/Submission.php new file mode 100644 index 00000000000..bd04f68cb94 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/Submission.php @@ -0,0 +1,113 @@ +google.cloud.webrisk.v1.Submission + */ +class Submission extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URI that is being reported for malicious content to be + * analyzed. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + /** + * Output only. ThreatTypes found to be associated with the submitted URI + * after reviewing it. This might be empty if the URI was not added to any + * list. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $threat_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. The URI that is being reported for malicious content to be + * analyzed. + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * Output only. ThreatTypes found to be associated with the submitted URI + * after reviewing it. This might be empty if the URI was not added to any + * list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URI that is being reported for malicious content to be + * analyzed. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The URI that is being reported for malicious content to be + * analyzed. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Output only. ThreatTypes found to be associated with the submitted URI + * after reviewing it. This might be empty if the URI was not added to any + * list. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * Output only. ThreatTypes found to be associated with the submitted URI + * after reviewing it. This might be empty if the URI was not added to any + * list. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatType threat_types = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata.php new file mode 100644 index 00000000000..d2148bdd384 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata.php @@ -0,0 +1,156 @@ +google.cloud.webrisk.v1.SubmitUriMetadata + */ +class SubmitUriMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + */ + protected $state = 0; + /** + * Creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + */ + protected $create_time = null; + /** + * Latest update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type \Google\Protobuf\Timestamp $create_time + * Creation time of the operation. + * @type \Google\Protobuf\Timestamp $update_time + * Latest update time of the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.webrisk.v1.SubmitUriMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\SubmitUriMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * Creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Latest update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Latest update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata/State.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata/State.php new file mode 100644 index 00000000000..9e9a51092de --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriMetadata/State.php @@ -0,0 +1,85 @@ +google.cloud.webrisk.v1.SubmitUriMetadata.State + */ +class State +{ + /** + * Default unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The operation is currently running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The operation finished with a success status. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The operation was cancelled. + * + * Generated from protobuf enum CANCELLED = 3; + */ + const CANCELLED = 3; + /** + * The operation finished with a failure status. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * The operation was closed with no action taken. + * + * Generated from protobuf enum CLOSED = 5; + */ + const CLOSED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + self::CLOSED => 'CLOSED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\WebRisk\V1\SubmitUriMetadata_State::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriRequest.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriRequest.php new file mode 100644 index 00000000000..2941f5f391b --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/SubmitUriRequest.php @@ -0,0 +1,203 @@ +google.cloud.webrisk.v1.SubmitUriRequest + */ +class SubmitUriRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The submission that contains the URI to be scanned. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $submission = null; + /** + * Provides additional information about the submission. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + */ + protected $threat_info = null; + /** + * Provides additional information about how the submission was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + */ + protected $threat_discovery = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @type \Google\Cloud\WebRisk\V1\Submission $submission + * Required. The submission that contains the URI to be scanned. + * @type \Google\Cloud\WebRisk\V1\ThreatInfo $threat_info + * Provides additional information about the submission. + * @type \Google\Cloud\WebRisk\V1\ThreatDiscovery $threat_discovery + * Provides additional information about how the submission was discovered. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The submission that contains the URI to be scanned. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebRisk\V1\Submission|null + */ + public function getSubmission() + { + return $this->submission; + } + + public function hasSubmission() + { + return isset($this->submission); + } + + public function clearSubmission() + { + unset($this->submission); + } + + /** + * Required. The submission that contains the URI to be scanned. + * + * Generated from protobuf field .google.cloud.webrisk.v1.Submission submission = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebRisk\V1\Submission $var + * @return $this + */ + public function setSubmission($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\Submission::class); + $this->submission = $var; + + return $this; + } + + /** + * Provides additional information about the submission. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * @return \Google\Cloud\WebRisk\V1\ThreatInfo|null + */ + public function getThreatInfo() + { + return $this->threat_info; + } + + public function hasThreatInfo() + { + return isset($this->threat_info); + } + + public function clearThreatInfo() + { + unset($this->threat_info); + } + + /** + * Provides additional information about the submission. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo threat_info = 3; + * @param \Google\Cloud\WebRisk\V1\ThreatInfo $var + * @return $this + */ + public function setThreatInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatInfo::class); + $this->threat_info = $var; + + return $this; + } + + /** + * Provides additional information about how the submission was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * @return \Google\Cloud\WebRisk\V1\ThreatDiscovery|null + */ + public function getThreatDiscovery() + { + return $this->threat_discovery; + } + + public function hasThreatDiscovery() + { + return isset($this->threat_discovery); + } + + public function clearThreatDiscovery() + { + unset($this->threat_discovery); + } + + /** + * Provides additional information about how the submission was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery threat_discovery = 4; + * @param \Google\Cloud\WebRisk\V1\ThreatDiscovery $var + * @return $this + */ + public function setThreatDiscovery($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatDiscovery::class); + $this->threat_discovery = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery.php new file mode 100644 index 00000000000..78c9f33a4c3 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery.php @@ -0,0 +1,105 @@ +google.cloud.webrisk.v1.ThreatDiscovery + */ +class ThreatDiscovery extends \Google\Protobuf\Internal\Message +{ + /** + * Platform on which the threat was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + */ + protected $platform = 0; + /** + * CLDR region code of the countries/regions the URI poses a threat ordered + * from most impact to least impact. Example: "US" for United States. + * + * Generated from protobuf field repeated string region_codes = 2; + */ + private $region_codes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $platform + * Platform on which the threat was discovered. + * @type array|\Google\Protobuf\Internal\RepeatedField $region_codes + * CLDR region code of the countries/regions the URI poses a threat ordered + * from most impact to least impact. Example: "US" for United States. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Platform on which the threat was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * @return int + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * Platform on which the threat was discovered. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatDiscovery.Platform platform = 1; + * @param int $var + * @return $this + */ + public function setPlatform($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\ThreatDiscovery\Platform::class); + $this->platform = $var; + + return $this; + } + + /** + * CLDR region code of the countries/regions the URI poses a threat ordered + * from most impact to least impact. Example: "US" for United States. + * + * Generated from protobuf field repeated string region_codes = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRegionCodes() + { + return $this->region_codes; + } + + /** + * CLDR region code of the countries/regions the URI poses a threat ordered + * from most impact to least impact. Example: "US" for United States. + * + * Generated from protobuf field repeated string region_codes = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRegionCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->region_codes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery/Platform.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery/Platform.php new file mode 100644 index 00000000000..21970d595dc --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatDiscovery/Platform.php @@ -0,0 +1,78 @@ +google.cloud.webrisk.v1.ThreatDiscovery.Platform + */ +class Platform +{ + /** + * Default. + * + * Generated from protobuf enum PLATFORM_UNSPECIFIED = 0; + */ + const PLATFORM_UNSPECIFIED = 0; + /** + * General Android platform. + * + * Generated from protobuf enum ANDROID = 1; + */ + const ANDROID = 1; + /** + * General iOS platform. + * + * Generated from protobuf enum IOS = 2; + */ + const IOS = 2; + /** + * General macOS platform. + * + * Generated from protobuf enum MACOS = 3; + */ + const MACOS = 3; + /** + * General Windows platform. + * + * Generated from protobuf enum WINDOWS = 4; + */ + const WINDOWS = 4; + + private static $valueToName = [ + self::PLATFORM_UNSPECIFIED => 'PLATFORM_UNSPECIFIED', + self::ANDROID => 'ANDROID', + self::IOS => 'IOS', + self::MACOS => 'MACOS', + self::WINDOWS => 'WINDOWS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Platform::class, \Google\Cloud\WebRisk\V1\ThreatDiscovery_Platform::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryAdditions.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryAdditions.php new file mode 100644 index 00000000000..ad3939be64a --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryAdditions.php @@ -0,0 +1,124 @@ +google.cloud.webrisk.v1.ThreatEntryAdditions + */ +class ThreatEntryAdditions extends \Google\Protobuf\Internal\Message +{ + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + */ + private $raw_hashes; + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + */ + protected $rice_hashes = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebRisk\V1\RawHashes>|\Google\Protobuf\Internal\RepeatedField $raw_hashes + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * @type \Google\Cloud\WebRisk\V1\RiceDeltaEncoding $rice_hashes + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRawHashes() + { + return $this->raw_hashes; + } + + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.RawHashes raw_hashes = 1; + * @param array<\Google\Cloud\WebRisk\V1\RawHashes>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRawHashes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebRisk\V1\RawHashes::class); + $this->raw_hashes = $arr; + + return $this; + } + + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * @return \Google\Cloud\WebRisk\V1\RiceDeltaEncoding|null + */ + public function getRiceHashes() + { + return $this->rice_hashes; + } + + public function hasRiceHashes() + { + return isset($this->rice_hashes); + } + + public function clearRiceHashes() + { + unset($this->rice_hashes); + } + + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_hashes = 2; + * @param \Google\Cloud\WebRisk\V1\RiceDeltaEncoding $var + * @return $this + */ + public function setRiceHashes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\RiceDeltaEncoding::class); + $this->rice_hashes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryRemovals.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryRemovals.php new file mode 100644 index 00000000000..d51634f6687 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatEntryRemovals.php @@ -0,0 +1,133 @@ +google.cloud.webrisk.v1.ThreatEntryRemovals + */ +class ThreatEntryRemovals extends \Google\Protobuf\Internal\Message +{ + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + */ + protected $raw_indices = null; + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + */ + protected $rice_indices = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebRisk\V1\RawIndices $raw_indices + * The raw removal indices for a local list. + * @type \Google\Cloud\WebRisk\V1\RiceDeltaEncoding $rice_indices + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * @return \Google\Cloud\WebRisk\V1\RawIndices|null + */ + public function getRawIndices() + { + return $this->raw_indices; + } + + public function hasRawIndices() + { + return isset($this->raw_indices); + } + + public function clearRawIndices() + { + unset($this->raw_indices); + } + + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RawIndices raw_indices = 1; + * @param \Google\Cloud\WebRisk\V1\RawIndices $var + * @return $this + */ + public function setRawIndices($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\RawIndices::class); + $this->raw_indices = $var; + + return $this; + } + + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * @return \Google\Cloud\WebRisk\V1\RiceDeltaEncoding|null + */ + public function getRiceIndices() + { + return $this->rice_indices; + } + + public function hasRiceIndices() + { + return isset($this->rice_indices); + } + + public function clearRiceIndices() + { + unset($this->rice_indices); + } + + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1.RiceDeltaEncoding rice_indices = 2; + * @param \Google\Cloud\WebRisk\V1\RiceDeltaEncoding $var + * @return $this + */ + public function setRiceIndices($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\RiceDeltaEncoding::class); + $this->rice_indices = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo.php new file mode 100644 index 00000000000..4536e1bea45 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo.php @@ -0,0 +1,157 @@ +google.cloud.webrisk.v1.ThreatInfo + */ +class ThreatInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The type of abuse. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + */ + protected $abuse_type = 0; + /** + * Confidence that the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + */ + protected $threat_confidence = null; + /** + * Context about why the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + */ + protected $threat_justification = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $abuse_type + * The type of abuse. + * @type \Google\Cloud\WebRisk\V1\ThreatInfo\Confidence $threat_confidence + * Confidence that the URI is unsafe. + * @type \Google\Cloud\WebRisk\V1\ThreatInfo\ThreatJustification $threat_justification + * Context about why the URI is unsafe. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The type of abuse. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * @return int + */ + public function getAbuseType() + { + return $this->abuse_type; + } + + /** + * The type of abuse. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.AbuseType abuse_type = 1; + * @param int $var + * @return $this + */ + public function setAbuseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\ThreatInfo\AbuseType::class); + $this->abuse_type = $var; + + return $this; + } + + /** + * Confidence that the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * @return \Google\Cloud\WebRisk\V1\ThreatInfo\Confidence|null + */ + public function getThreatConfidence() + { + return $this->threat_confidence; + } + + public function hasThreatConfidence() + { + return isset($this->threat_confidence); + } + + public function clearThreatConfidence() + { + unset($this->threat_confidence); + } + + /** + * Confidence that the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.Confidence threat_confidence = 2; + * @param \Google\Cloud\WebRisk\V1\ThreatInfo\Confidence $var + * @return $this + */ + public function setThreatConfidence($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatInfo\Confidence::class); + $this->threat_confidence = $var; + + return $this; + } + + /** + * Context about why the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * @return \Google\Cloud\WebRisk\V1\ThreatInfo\ThreatJustification|null + */ + public function getThreatJustification() + { + return $this->threat_justification; + } + + public function hasThreatJustification() + { + return isset($this->threat_justification); + } + + public function clearThreatJustification() + { + unset($this->threat_justification); + } + + /** + * Context about why the URI is unsafe. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification threat_justification = 3; + * @param \Google\Cloud\WebRisk\V1\ThreatInfo\ThreatJustification $var + * @return $this + */ + public function setThreatJustification($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1\ThreatInfo\ThreatJustification::class); + $this->threat_justification = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/AbuseType.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/AbuseType.php new file mode 100644 index 00000000000..70f7ef17ada --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/AbuseType.php @@ -0,0 +1,71 @@ +google.cloud.webrisk.v1.ThreatInfo.AbuseType + */ +class AbuseType +{ + /** + * Default. + * + * Generated from protobuf enum ABUSE_TYPE_UNSPECIFIED = 0; + */ + const ABUSE_TYPE_UNSPECIFIED = 0; + /** + * The URI contains malware. + * + * Generated from protobuf enum MALWARE = 1; + */ + const MALWARE = 1; + /** + * The URI contains social engineering. + * + * Generated from protobuf enum SOCIAL_ENGINEERING = 2; + */ + const SOCIAL_ENGINEERING = 2; + /** + * The URI contains unwanted software. + * + * Generated from protobuf enum UNWANTED_SOFTWARE = 3; + */ + const UNWANTED_SOFTWARE = 3; + + private static $valueToName = [ + self::ABUSE_TYPE_UNSPECIFIED => 'ABUSE_TYPE_UNSPECIFIED', + self::MALWARE => 'MALWARE', + self::SOCIAL_ENGINEERING => 'SOCIAL_ENGINEERING', + self::UNWANTED_SOFTWARE => 'UNWANTED_SOFTWARE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AbuseType::class, \Google\Cloud\WebRisk\V1\ThreatInfo_AbuseType::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence.php new file mode 100644 index 00000000000..88079fdc9e2 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence.php @@ -0,0 +1,117 @@ +google.cloud.webrisk.v1.ThreatInfo.Confidence + */ +class Confidence extends \Google\Protobuf\Internal\Message +{ + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $score + * A decimal representation of confidence in the range of 0 + * to 1 where 0 indicates no confidence and 1 indicates + * complete confidence. + * @type int $level + * Enum representation of confidence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * A decimal representation of confidence in the range of 0 + * to 1 where 0 indicates no confidence and 1 indicates + * complete confidence. + * + * Generated from protobuf field float score = 1; + * @return float + */ + public function getScore() + { + return $this->readOneof(1); + } + + public function hasScore() + { + return $this->hasOneof(1); + } + + /** + * A decimal representation of confidence in the range of 0 + * to 1 where 0 indicates no confidence and 1 indicates + * complete confidence. + * + * Generated from protobuf field float score = 1; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Enum representation of confidence. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * @return int + */ + public function getLevel() + { + return $this->readOneof(2); + } + + public function hasLevel() + { + return $this->hasOneof(2); + } + + /** + * Enum representation of confidence. + * + * Generated from protobuf field .google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel level = 2; + * @param int $var + * @return $this + */ + public function setLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1\ThreatInfo\Confidence\ConfidenceLevel::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Confidence::class, \Google\Cloud\WebRisk\V1\ThreatInfo_Confidence::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence/ConfidenceLevel.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence/ConfidenceLevel.php new file mode 100644 index 00000000000..04f25a28d07 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/Confidence/ConfidenceLevel.php @@ -0,0 +1,71 @@ +google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel + */ +class ConfidenceLevel +{ + /** + * Default. + * + * Generated from protobuf enum CONFIDENCE_LEVEL_UNSPECIFIED = 0; + */ + const CONFIDENCE_LEVEL_UNSPECIFIED = 0; + /** + * Less than 60% confidence that the URI is unsafe. + * + * Generated from protobuf enum LOW = 1; + */ + const LOW = 1; + /** + * Between 60% and 80% confidence that the URI is unsafe. + * + * Generated from protobuf enum MEDIUM = 2; + */ + const MEDIUM = 2; + /** + * Greater than 80% confidence that the URI is unsafe. + * + * Generated from protobuf enum HIGH = 3; + */ + const HIGH = 3; + + private static $valueToName = [ + self::CONFIDENCE_LEVEL_UNSPECIFIED => 'CONFIDENCE_LEVEL_UNSPECIFIED', + self::LOW => 'LOW', + self::MEDIUM => 'MEDIUM', + self::HIGH => 'HIGH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConfidenceLevel::class, \Google\Cloud\WebRisk\V1\ThreatInfo_Confidence_ConfidenceLevel::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification.php new file mode 100644 index 00000000000..fd68434daff --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification.php @@ -0,0 +1,104 @@ +google.cloud.webrisk.v1.ThreatInfo.ThreatJustification + */ +class ThreatJustification extends \Google\Protobuf\Internal\Message +{ + /** + * Labels associated with this URI that explain how it was classified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + */ + private $labels; + /** + * Free-form context on why this URI is unsafe. + * + * Generated from protobuf field repeated string comments = 2; + */ + private $comments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $labels + * Labels associated with this URI that explain how it was classified. + * @type array|\Google\Protobuf\Internal\RepeatedField $comments + * Free-form context on why this URI is unsafe. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Labels associated with this URI that explain how it was classified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this URI that explain how it was classified. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel labels = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1\ThreatInfo\ThreatJustification\JustificationLabel::class); + $this->labels = $arr; + + return $this; + } + + /** + * Free-form context on why this URI is unsafe. + * + * Generated from protobuf field repeated string comments = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getComments() + { + return $this->comments; + } + + /** + * Free-form context on why this URI is unsafe. + * + * Generated from protobuf field repeated string comments = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setComments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->comments = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ThreatJustification::class, \Google\Cloud\WebRisk\V1\ThreatInfo_ThreatJustification::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification/JustificationLabel.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification/JustificationLabel.php new file mode 100644 index 00000000000..49435a9f74f --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatInfo/ThreatJustification/JustificationLabel.php @@ -0,0 +1,71 @@ +google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel + */ +class JustificationLabel +{ + /** + * Default. + * + * Generated from protobuf enum JUSTIFICATION_LABEL_UNSPECIFIED = 0; + */ + const JUSTIFICATION_LABEL_UNSPECIFIED = 0; + /** + * The submitter manually verified that the submission is unsafe. + * + * Generated from protobuf enum MANUAL_VERIFICATION = 1; + */ + const MANUAL_VERIFICATION = 1; + /** + * The submitter received the submission from an end user. + * + * Generated from protobuf enum USER_REPORT = 2; + */ + const USER_REPORT = 2; + /** + * The submitter received the submission from an automated system. + * + * Generated from protobuf enum AUTOMATED_REPORT = 3; + */ + const AUTOMATED_REPORT = 3; + + private static $valueToName = [ + self::JUSTIFICATION_LABEL_UNSPECIFIED => 'JUSTIFICATION_LABEL_UNSPECIFIED', + self::MANUAL_VERIFICATION => 'MANUAL_VERIFICATION', + self::USER_REPORT => 'USER_REPORT', + self::AUTOMATED_REPORT => 'AUTOMATED_REPORT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JustificationLabel::class, \Google\Cloud\WebRisk\V1\ThreatInfo_ThreatJustification_JustificationLabel::class); + diff --git a/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatType.php b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatType.php new file mode 100644 index 00000000000..c9f1876eddb --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/proto/src/Google/Cloud/WebRisk/V1/ThreatType.php @@ -0,0 +1,77 @@ +google.cloud.webrisk.v1.ThreatType + */ +class ThreatType +{ + /** + * No entries should match this threat type. This threat type is unused. + * + * Generated from protobuf enum THREAT_TYPE_UNSPECIFIED = 0; + */ + const THREAT_TYPE_UNSPECIFIED = 0; + /** + * Malware targeting any platform. + * + * Generated from protobuf enum MALWARE = 1; + */ + const MALWARE = 1; + /** + * Social engineering targeting any platform. + * + * Generated from protobuf enum SOCIAL_ENGINEERING = 2; + */ + const SOCIAL_ENGINEERING = 2; + /** + * Unwanted software targeting any platform. + * + * Generated from protobuf enum UNWANTED_SOFTWARE = 3; + */ + const UNWANTED_SOFTWARE = 3; + /** + * A list of extended coverage social engineering URIs targeting any + * platform. + * + * Generated from protobuf enum SOCIAL_ENGINEERING_EXTENDED_COVERAGE = 4; + */ + const SOCIAL_ENGINEERING_EXTENDED_COVERAGE = 4; + + private static $valueToName = [ + self::THREAT_TYPE_UNSPECIFIED => 'THREAT_TYPE_UNSPECIFIED', + self::MALWARE => 'MALWARE', + self::SOCIAL_ENGINEERING => 'SOCIAL_ENGINEERING', + self::UNWANTED_SOFTWARE => 'UNWANTED_SOFTWARE', + self::SOCIAL_ENGINEERING_EXTENDED_COVERAGE => 'SOCIAL_ENGINEERING_EXTENDED_COVERAGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/compute_threat_list_diff.php b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/compute_threat_list_diff.php new file mode 100644 index 00000000000..d30925d70dc --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/compute_threat_list_diff.php @@ -0,0 +1,81 @@ +setThreatType($threatType) + ->setConstraints($constraints); + + // Call the API and handle any network failures. + try { + /** @var ComputeThreatListDiffResponse $response */ + $response = $webRiskServiceClient->computeThreatListDiff($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + + compute_threat_list_diff_sample($threatType); +} +// [END webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_sync] diff --git a/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/create_submission.php b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/create_submission.php new file mode 100644 index 00000000000..5a0a4d68042 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/create_submission.php @@ -0,0 +1,84 @@ +setUri($submissionUri); + $request = (new CreateSubmissionRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + + // Call the API and handle any network failures. + try { + /** @var Submission $response */ + $response = $webRiskServiceClient->createSubmission($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebRiskServiceClient::projectName('[PROJECT]'); + $submissionUri = '[URI]'; + + create_submission_sample($formattedParent, $submissionUri); +} +// [END webrisk_v1_generated_WebRiskService_CreateSubmission_sync] diff --git a/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_hashes.php b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_hashes.php new file mode 100644 index 00000000000..853bb26204a --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_hashes.php @@ -0,0 +1,77 @@ +setThreatTypes($threatTypes); + + // Call the API and handle any network failures. + try { + /** @var SearchHashesResponse $response */ + $response = $webRiskServiceClient->searchHashes($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $threatTypesElement = ThreatType::THREAT_TYPE_UNSPECIFIED; + + search_hashes_sample($threatTypesElement); +} +// [END webrisk_v1_generated_WebRiskService_SearchHashes_sync] diff --git a/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_uris.php b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_uris.php new file mode 100644 index 00000000000..ab744bb32b3 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/search_uris.php @@ -0,0 +1,80 @@ +setUri($uri) + ->setThreatTypes($threatTypes); + + // Call the API and handle any network failures. + try { + /** @var SearchUrisResponse $response */ + $response = $webRiskServiceClient->searchUris($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $uri = '[URI]'; + $threatTypesElement = ThreatType::THREAT_TYPE_UNSPECIFIED; + + search_uris_sample($uri, $threatTypesElement); +} +// [END webrisk_v1_generated_WebRiskService_SearchUris_sync] diff --git a/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/submit_uri.php b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/submit_uri.php new file mode 100644 index 00000000000..1081a75bf40 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/samples/V1/WebRiskServiceClient/submit_uri.php @@ -0,0 +1,99 @@ +setUri($submissionUri); + $request = (new SubmitUriRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $webRiskServiceClient->submitUri($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Submission $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebRiskServiceClient::projectName('[PROJECT]'); + $submissionUri = '[URI]'; + + submit_uri_sample($formattedParent, $submissionUri); +} +// [END webrisk_v1_generated_WebRiskService_SubmitUri_sync] diff --git a/owl-bot-staging/WebRisk/v1/src/V1/Client/WebRiskServiceClient.php b/owl-bot-staging/WebRisk/v1/src/V1/Client/WebRiskServiceClient.php new file mode 100644 index 00000000000..3af3c8c3520 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/src/V1/Client/WebRiskServiceClient.php @@ -0,0 +1,414 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/web_risk_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/web_risk_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/web_risk_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/web_risk_service_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'webrisk.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Gets the most recent threat list diffs. These diffs should be applied to + * a local database of hashes to keep it up-to-date. If the local database is + * empty or excessively out-of-date, a complete snapshot of the database will + * be returned. This Method only updates a single ThreatList at a time. To + * update multiple ThreatList databases, this method needs to be called once + * for each list. + * + * The async variant is {@see WebRiskServiceClient::computeThreatListDiffAsync()} . + * + * @example samples/V1/WebRiskServiceClient/compute_threat_list_diff.php + * + * @param ComputeThreatListDiffRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ComputeThreatListDiffResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function computeThreatListDiff(ComputeThreatListDiffRequest $request, array $callOptions = []): ComputeThreatListDiffResponse + { + return $this->startApiCall('ComputeThreatListDiff', $request, $callOptions)->wait(); + } + + /** + * Creates a Submission of a URI suspected of containing phishing content to + * be reviewed. If the result verifies the existence of malicious phishing + * content, the site will be added to the [Google's Social Engineering + * lists](https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * The async variant is {@see WebRiskServiceClient::createSubmissionAsync()} . + * + * @example samples/V1/WebRiskServiceClient/create_submission.php + * + * @param CreateSubmissionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Submission + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSubmission(CreateSubmissionRequest $request, array $callOptions = []): Submission + { + return $this->startApiCall('CreateSubmission', $request, $callOptions)->wait(); + } + + /** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * The async variant is {@see WebRiskServiceClient::searchHashesAsync()} . + * + * @example samples/V1/WebRiskServiceClient/search_hashes.php + * + * @param SearchHashesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 SearchHashesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function searchHashes(SearchHashesRequest $request, array $callOptions = []): SearchHashesResponse + { + return $this->startApiCall('SearchHashes', $request, $callOptions)->wait(); + } + + /** + * This method is used to check whether a URI is on a given threatList. + * Multiple threatLists may be searched in a single query. + * The response will list all requested threatLists the URI was found to + * match. If the URI is not found on any of the requested ThreatList an + * empty response will be returned. + * + * The async variant is {@see WebRiskServiceClient::searchUrisAsync()} . + * + * @example samples/V1/WebRiskServiceClient/search_uris.php + * + * @param SearchUrisRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 SearchUrisResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function searchUris(SearchUrisRequest $request, array $callOptions = []): SearchUrisResponse + { + return $this->startApiCall('SearchUris', $request, $callOptions)->wait(); + } + + /** + * Submits a URI suspected of containing malicious content to be reviewed. + * Returns a google.longrunning.Operation which, once the review is complete, + * is updated with its result. You can use the [Pub/Sub API] + * (https://cloud.google.com/pubsub) to receive notifications for the returned + * Operation. If the result verifies the existence of malicious content, the + * site will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * The async variant is {@see WebRiskServiceClient::submitUriAsync()} . + * + * @example samples/V1/WebRiskServiceClient/submit_uri.php + * + * @param SubmitUriRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function submitUri(SubmitUriRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('SubmitUri', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/WebRisk/v1/src/V1/Gapic/WebRiskServiceGapicClient.php b/owl-bot-staging/WebRisk/v1/src/V1/Gapic/WebRiskServiceGapicClient.php new file mode 100644 index 00000000000..defce35bbd7 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/src/V1/Gapic/WebRiskServiceGapicClient.php @@ -0,0 +1,584 @@ +computeThreatListDiff($threatType, $constraints); + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\WebRisk\V1\Client\WebRiskServiceClient}. + */ +class WebRiskServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.webrisk.v1.WebRiskService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'webrisk.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'webrisk.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 static $projectNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/web_risk_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/web_risk_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/web_risk_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/web_risk_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'webrisk.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); + } + + /** + * Gets the most recent threat list diffs. These diffs should be applied to + * a local database of hashes to keep it up-to-date. If the local database is + * empty or excessively out-of-date, a complete snapshot of the database will + * be returned. This Method only updates a single ThreatList at a time. To + * update multiple ThreatList databases, this method needs to be called once + * for each list. + * + * Sample code: + * ``` + * $webRiskServiceClient = new WebRiskServiceClient(); + * try { + * $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + * $constraints = new Constraints(); + * $response = $webRiskServiceClient->computeThreatListDiff($threatType, $constraints); + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * @param int $threatType Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * @param Constraints $constraints Required. The constraints associated with this request. + * @param array $optionalArgs { + * Optional. + * + * @type string $versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * @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\WebRisk\V1\ComputeThreatListDiffResponse + * + * @throws ApiException if the remote call fails + */ + public function computeThreatListDiff($threatType, $constraints, array $optionalArgs = []) + { + $request = new ComputeThreatListDiffRequest(); + $request->setThreatType($threatType); + $request->setConstraints($constraints); + if (isset($optionalArgs['versionToken'])) { + $request->setVersionToken($optionalArgs['versionToken']); + } + + return $this->startCall('ComputeThreatListDiff', ComputeThreatListDiffResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a Submission of a URI suspected of containing phishing content to + * be reviewed. If the result verifies the existence of malicious phishing + * content, the site will be added to the [Google's Social Engineering + * lists](https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * Sample code: + * ``` + * $webRiskServiceClient = new WebRiskServiceClient(); + * try { + * $formattedParent = $webRiskServiceClient->projectName('[PROJECT]'); + * $submission = new Submission(); + * $response = $webRiskServiceClient->createSubmission($formattedParent, $submission); + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param Submission $submission Required. The submission that contains the content of the phishing report. + * @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\Cloud\WebRisk\V1\Submission + * + * @throws ApiException if the remote call fails + */ + public function createSubmission($parent, $submission, array $optionalArgs = []) + { + $request = new CreateSubmissionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSubmission($submission); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSubmission', Submission::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * Sample code: + * ``` + * $webRiskServiceClient = new WebRiskServiceClient(); + * try { + * $threatTypes = []; + * $response = $webRiskServiceClient->searchHashes($threatTypes); + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * @param int[] $threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * @param array $optionalArgs { + * Optional. + * + * @type string $hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * @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\WebRisk\V1\SearchHashesResponse + * + * @throws ApiException if the remote call fails + */ + public function searchHashes($threatTypes, array $optionalArgs = []) + { + $request = new SearchHashesRequest(); + $request->setThreatTypes($threatTypes); + if (isset($optionalArgs['hashPrefix'])) { + $request->setHashPrefix($optionalArgs['hashPrefix']); + } + + return $this->startCall('SearchHashes', SearchHashesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * This method is used to check whether a URI is on a given threatList. + * Multiple threatLists may be searched in a single query. + * The response will list all requested threatLists the URI was found to + * match. If the URI is not found on any of the requested ThreatList an + * empty response will be returned. + * + * Sample code: + * ``` + * $webRiskServiceClient = new WebRiskServiceClient(); + * try { + * $uri = 'uri'; + * $threatTypes = []; + * $response = $webRiskServiceClient->searchUris($uri, $threatTypes); + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * @param string $uri Required. The URI to be checked for matches. + * @param int[] $threatTypes Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1\ThreatType} + * @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\Cloud\WebRisk\V1\SearchUrisResponse + * + * @throws ApiException if the remote call fails + */ + public function searchUris($uri, $threatTypes, array $optionalArgs = []) + { + $request = new SearchUrisRequest(); + $request->setUri($uri); + $request->setThreatTypes($threatTypes); + return $this->startCall('SearchUris', SearchUrisResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Submits a URI suspected of containing malicious content to be reviewed. + * Returns a google.longrunning.Operation which, once the review is complete, + * is updated with its result. You can use the [Pub/Sub API] + * (https://cloud.google.com/pubsub) to receive notifications for the returned + * Operation. If the result verifies the existence of malicious content, the + * site will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * Sample code: + * ``` + * $webRiskServiceClient = new WebRiskServiceClient(); + * try { + * $formattedParent = $webRiskServiceClient->projectName('[PROJECT]'); + * $submission = new Submission(); + * $operationResponse = $webRiskServiceClient->submitUri($formattedParent, $submission); + * $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 = $webRiskServiceClient->submitUri($formattedParent, $submission); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $webRiskServiceClient->resumeOperation($operationName, 'submitUri'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $webRiskServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param Submission $submission Required. The submission that contains the URI to be scanned. + * @param array $optionalArgs { + * Optional. + * + * @type ThreatInfo $threatInfo + * Provides additional information about the submission. + * @type ThreatDiscovery $threatDiscovery + * Provides additional information about how the submission was discovered. + * @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 submitUri($parent, $submission, array $optionalArgs = []) + { + $request = new SubmitUriRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSubmission($submission); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['threatInfo'])) { + $request->setThreatInfo($optionalArgs['threatInfo']); + } + + if (isset($optionalArgs['threatDiscovery'])) { + $request->setThreatDiscovery($optionalArgs['threatDiscovery']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('SubmitUri', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/WebRisk/v1/src/V1/WebRiskServiceClient.php b/owl-bot-staging/WebRisk/v1/src/V1/WebRiskServiceClient.php new file mode 100644 index 00000000000..cf56a12743c --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/src/V1/WebRiskServiceClient.php @@ -0,0 +1,34 @@ + [ + 'google.cloud.webrisk.v1.WebRiskService' => [ + 'SubmitUri' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\WebRisk\V1\Submission', + 'metadataReturnType' => '\Google\Cloud\WebRisk\V1\SubmitUriMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ComputeThreatListDiff' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebRisk\V1\ComputeThreatListDiffResponse', + ], + 'CreateSubmission' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebRisk\V1\Submission', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'SearchHashes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebRisk\V1\SearchHashesResponse', + ], + 'SearchUris' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebRisk\V1\SearchUrisResponse', + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/WebRisk/v1/src/V1/resources/web_risk_service_rest_client_config.php b/owl-bot-staging/WebRisk/v1/src/V1/resources/web_risk_service_rest_client_config.php new file mode 100644 index 00000000000..ab0a604ffee --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/src/V1/resources/web_risk_service_rest_client_config.php @@ -0,0 +1,92 @@ + [ + 'google.cloud.webrisk.v1.WebRiskService' => [ + 'ComputeThreatListDiff' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/threatLists:computeDiff', + ], + 'CreateSubmission' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/submissions', + 'body' => 'submission', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SearchHashes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/hashes:search', + ], + 'SearchUris' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/uris:search', + ], + 'SubmitUri' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/uris:submit', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/WebRisk/v1/tests/Unit/V1/Client/WebRiskServiceClientTest.php b/owl-bot-staging/WebRisk/v1/tests/Unit/V1/Client/WebRiskServiceClientTest.php new file mode 100644 index 00000000000..fdd29cf85eb --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/tests/Unit/V1/Client/WebRiskServiceClientTest.php @@ -0,0 +1,515 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WebRiskServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WebRiskServiceClient($options); + } + + /** @test */ + public function computeThreatListDiffTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $newVersionToken = '115'; + $expectedResponse = new ComputeThreatListDiffResponse(); + $expectedResponse->setNewVersionToken($newVersionToken); + $transport->addResponse($expectedResponse); + // Mock request + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + $request = (new ComputeThreatListDiffRequest()) + ->setThreatType($threatType) + ->setConstraints($constraints); + $response = $gapicClient->computeThreatListDiff($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatType(); + $this->assertProtobufEquals($threatType, $actualValue); + $actualValue = $actualRequestObject->getConstraints(); + $this->assertProtobufEquals($constraints, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function computeThreatListDiffExceptionTest() + { + $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 + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + $request = (new ComputeThreatListDiffRequest()) + ->setThreatType($threatType) + ->setConstraints($constraints); + try { + $gapicClient->computeThreatListDiff($request); + // 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()); + } + + /** @test */ + public function createSubmissionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uri = 'uri116076'; + $expectedResponse = new Submission(); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $request = (new CreateSubmissionRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + $response = $gapicClient->createSubmission($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/CreateSubmission', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSubmission(); + $this->assertProtobufEquals($submission, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubmissionExceptionTest() + { + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $request = (new CreateSubmissionRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + try { + $gapicClient->createSubmission($request); + // 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()); + } + + /** @test */ + public function searchHashesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchHashesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $threatTypes = []; + $request = (new SearchHashesRequest()) + ->setThreatTypes($threatTypes); + $response = $gapicClient->searchHashes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/SearchHashes', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchHashesExceptionTest() + { + $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 + $threatTypes = []; + $request = (new SearchHashesRequest()) + ->setThreatTypes($threatTypes); + try { + $gapicClient->searchHashes($request); + // 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()); + } + + /** @test */ + public function searchUrisTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchUrisResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $uri = 'uri116076'; + $threatTypes = []; + $request = (new SearchUrisRequest()) + ->setUri($uri) + ->setThreatTypes($threatTypes); + $response = $gapicClient->searchUris($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/SearchUris', $actualFuncCall); + $actualValue = $actualRequestObject->getUri(); + $this->assertProtobufEquals($uri, $actualValue); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchUrisExceptionTest() + { + $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 + $uri = 'uri116076'; + $threatTypes = []; + $request = (new SearchUrisRequest()) + ->setUri($uri) + ->setThreatTypes($threatTypes); + try { + $gapicClient->searchUris($request); + // 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()); + } + + /** @test */ + public function submitUriTest() + { + $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/submitUriTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $uri = 'uri116076'; + $expectedResponse = new Submission(); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/submitUriTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $request = (new SubmitUriRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + $response = $gapicClient->submitUri($request); + $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.webrisk.v1.WebRiskService/SubmitUri', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSubmission(); + $this->assertProtobufEquals($submission, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/submitUriTest'); + $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 submitUriExceptionTest() + { + $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/submitUriTest'); + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $request = (new SubmitUriRequest()) + ->setParent($formattedParent) + ->setSubmission($submission); + $response = $gapicClient->submitUri($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/submitUriTest'); + 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 computeThreatListDiffAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $newVersionToken = '115'; + $expectedResponse = new ComputeThreatListDiffResponse(); + $expectedResponse->setNewVersionToken($newVersionToken); + $transport->addResponse($expectedResponse); + // Mock request + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + $request = (new ComputeThreatListDiffRequest()) + ->setThreatType($threatType) + ->setConstraints($constraints); + $response = $gapicClient->computeThreatListDiffAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatType(); + $this->assertProtobufEquals($threatType, $actualValue); + $actualValue = $actualRequestObject->getConstraints(); + $this->assertProtobufEquals($constraints, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/WebRisk/v1/tests/Unit/V1/WebRiskServiceClientTest.php b/owl-bot-staging/WebRisk/v1/tests/Unit/V1/WebRiskServiceClientTest.php new file mode 100644 index 00000000000..5b8c624dff9 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1/tests/Unit/V1/WebRiskServiceClientTest.php @@ -0,0 +1,449 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WebRiskServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WebRiskServiceClient($options); + } + + /** @test */ + public function computeThreatListDiffTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $newVersionToken = '115'; + $expectedResponse = new ComputeThreatListDiffResponse(); + $expectedResponse->setNewVersionToken($newVersionToken); + $transport->addResponse($expectedResponse); + // Mock request + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + $response = $gapicClient->computeThreatListDiff($threatType, $constraints); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/ComputeThreatListDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatType(); + $this->assertProtobufEquals($threatType, $actualValue); + $actualValue = $actualRequestObject->getConstraints(); + $this->assertProtobufEquals($constraints, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function computeThreatListDiffExceptionTest() + { + $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 + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + try { + $gapicClient->computeThreatListDiff($threatType, $constraints); + // 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()); + } + + /** @test */ + public function createSubmissionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $uri = 'uri116076'; + $expectedResponse = new Submission(); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $response = $gapicClient->createSubmission($formattedParent, $submission); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/CreateSubmission', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSubmission(); + $this->assertProtobufEquals($submission, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSubmissionExceptionTest() + { + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + try { + $gapicClient->createSubmission($formattedParent, $submission); + // 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()); + } + + /** @test */ + public function searchHashesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchHashesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $threatTypes = []; + $response = $gapicClient->searchHashes($threatTypes); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/SearchHashes', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchHashesExceptionTest() + { + $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 + $threatTypes = []; + try { + $gapicClient->searchHashes($threatTypes); + // 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()); + } + + /** @test */ + public function searchUrisTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchUrisResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $uri = 'uri116076'; + $threatTypes = []; + $response = $gapicClient->searchUris($uri, $threatTypes); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1.WebRiskService/SearchUris', $actualFuncCall); + $actualValue = $actualRequestObject->getUri(); + $this->assertProtobufEquals($uri, $actualValue); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchUrisExceptionTest() + { + $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 + $uri = 'uri116076'; + $threatTypes = []; + try { + $gapicClient->searchUris($uri, $threatTypes); + // 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()); + } + + /** @test */ + public function submitUriTest() + { + $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/submitUriTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $uri = 'uri116076'; + $expectedResponse = new Submission(); + $expectedResponse->setUri($uri); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/submitUriTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $response = $gapicClient->submitUri($formattedParent, $submission); + $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.webrisk.v1.WebRiskService/SubmitUri', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getSubmission(); + $this->assertProtobufEquals($submission, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/submitUriTest'); + $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 submitUriExceptionTest() + { + $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/submitUriTest'); + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $submission = new Submission(); + $submissionUri = 'submissionUri-1560297856'; + $submission->setUri($submissionUri); + $response = $gapicClient->submitUri($formattedParent, $submission); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/submitUriTest'); + 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()); + } +} diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1Beta1/Webrisk.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1Beta1/Webrisk.php new file mode 100644 index 00000000000..824fb12d88c Binary files /dev/null and b/owl-bot-staging/WebRisk/v1beta1/proto/src/GPBMetadata/Google/Cloud/Webrisk/V1Beta1/Webrisk.php differ diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/CompressionType.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/CompressionType.php new file mode 100644 index 00000000000..82669697ca7 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/CompressionType.php @@ -0,0 +1,61 @@ +google.cloud.webrisk.v1beta1.CompressionType + */ +class CompressionType +{ + /** + * Unknown. + * + * Generated from protobuf enum COMPRESSION_TYPE_UNSPECIFIED = 0; + */ + const COMPRESSION_TYPE_UNSPECIFIED = 0; + /** + * Raw, uncompressed data. + * + * Generated from protobuf enum RAW = 1; + */ + const RAW = 1; + /** + * Rice-Golomb encoded data. + * + * Generated from protobuf enum RICE = 2; + */ + const RICE = 2; + + private static $valueToName = [ + self::COMPRESSION_TYPE_UNSPECIFIED => 'COMPRESSION_TYPE_UNSPECIFIED', + self::RAW => 'RAW', + self::RICE => 'RICE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest.php new file mode 100644 index 00000000000..def2b840744 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest.php @@ -0,0 +1,149 @@ +google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest + */ +class ComputeThreatListDiffRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The ThreatList to update. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $threat_type = 0; + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * + * Generated from protobuf field bytes version_token = 2; + */ + protected $version_token = ''; + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $constraints = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $threat_type + * The ThreatList to update. + * @type string $version_token + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * @type \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest\Constraints $constraints + * Required. The constraints associated with this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The ThreatList to update. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getThreatType() + { + return $this->threat_type; + } + + /** + * The ThreatList to update. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatType threat_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setThreatType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); + $this->threat_type = $var; + + return $this; + } + + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * + * Generated from protobuf field bytes version_token = 2; + * @return string + */ + public function getVersionToken() + { + return $this->version_token; + } + + /** + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * + * Generated from protobuf field bytes version_token = 2; + * @param string $var + * @return $this + */ + public function setVersionToken($var) + { + GPBUtil::checkString($var, False); + $this->version_token = $var; + + return $this; + } + + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest\Constraints|null + */ + public function getConstraints() + { + return $this->constraints; + } + + public function hasConstraints() + { + return isset($this->constraints); + } + + public function clearConstraints() + { + unset($this->constraints); + } + + /** + * Required. The constraints associated with this request. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints constraints = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest\Constraints $var + * @return $this + */ + public function setConstraints($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest\Constraints::class); + $this->constraints = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest/Constraints.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest/Constraints.php new file mode 100644 index 00000000000..87f9116eea3 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffRequest/Constraints.php @@ -0,0 +1,154 @@ +google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints + */ +class Constraints extends \Google\Protobuf\Internal\Message +{ + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + */ + protected $max_diff_entries = 0; + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + */ + protected $max_database_entries = 0; + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.CompressionType supported_compressions = 3; + */ + private $supported_compressions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_diff_entries + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * @type int $max_database_entries + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_compressions + * The compression types supported by the client. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + * @return int + */ + public function getMaxDiffEntries() + { + return $this->max_diff_entries; + } + + /** + * The maximum size in number of entries. The diff will not contain more + * entries than this value. This should be a power of 2 between 2**10 and + * 2**20. If zero, no diff size limit is set. + * + * Generated from protobuf field int32 max_diff_entries = 1; + * @param int $var + * @return $this + */ + public function setMaxDiffEntries($var) + { + GPBUtil::checkInt32($var); + $this->max_diff_entries = $var; + + return $this; + } + + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + * @return int + */ + public function getMaxDatabaseEntries() + { + return $this->max_database_entries; + } + + /** + * Sets the maximum number of entries that the client is willing to have + * in the local database. This should be a power of 2 between 2**10 and + * 2**20. If zero, no database size limit is set. + * + * Generated from protobuf field int32 max_database_entries = 2; + * @param int $var + * @return $this + */ + public function setMaxDatabaseEntries($var) + { + GPBUtil::checkInt32($var); + $this->max_database_entries = $var; + + return $this; + } + + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.CompressionType supported_compressions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedCompressions() + { + return $this->supported_compressions; + } + + /** + * The compression types supported by the client. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.CompressionType supported_compressions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedCompressions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\CompressionType::class); + $this->supported_compressions = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Constraints::class, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffRequest_Constraints::class); + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse.php new file mode 100644 index 00000000000..b713743b943 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse.php @@ -0,0 +1,307 @@ +google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse + */ +class ComputeThreatListDiffResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + */ + protected $response_type = 0; + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryAdditions additions = 5; + */ + protected $additions = null; + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryRemovals removals = 6; + */ + protected $removals = null; + /** + * The new opaque client version token. + * + * Generated from protobuf field bytes new_version_token = 7; + */ + protected $new_version_token = ''; + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * disregard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum checksum = 8; + */ + protected $checksum = null; + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + */ + protected $recommended_next_diff = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $response_type + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * @type \Google\Cloud\WebRisk\V1beta1\ThreatEntryAdditions $additions + * A set of entries to add to a local threat type's list. + * @type \Google\Cloud\WebRisk\V1beta1\ThreatEntryRemovals $removals + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * @type string $new_version_token + * The new opaque client version token. + * @type \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse\Checksum $checksum + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * disregard this diff and retry later. + * @type \Google\Protobuf\Timestamp $recommended_next_diff + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * The type of response. This may indicate that an action must be taken by the + * client when the response is received. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType response_type = 4; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse\ResponseType::class); + $this->response_type = $var; + + return $this; + } + + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryAdditions additions = 5; + * @return \Google\Cloud\WebRisk\V1beta1\ThreatEntryAdditions|null + */ + public function getAdditions() + { + return $this->additions; + } + + public function hasAdditions() + { + return isset($this->additions); + } + + public function clearAdditions() + { + unset($this->additions); + } + + /** + * A set of entries to add to a local threat type's list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryAdditions additions = 5; + * @param \Google\Cloud\WebRisk\V1beta1\ThreatEntryAdditions $var + * @return $this + */ + public function setAdditions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ThreatEntryAdditions::class); + $this->additions = $var; + + return $this; + } + + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryRemovals removals = 6; + * @return \Google\Cloud\WebRisk\V1beta1\ThreatEntryRemovals|null + */ + public function getRemovals() + { + return $this->removals; + } + + public function hasRemovals() + { + return isset($this->removals); + } + + public function clearRemovals() + { + unset($this->removals); + } + + /** + * A set of entries to remove from a local threat type's list. + * This field may be empty. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ThreatEntryRemovals removals = 6; + * @param \Google\Cloud\WebRisk\V1beta1\ThreatEntryRemovals $var + * @return $this + */ + public function setRemovals($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ThreatEntryRemovals::class); + $this->removals = $var; + + return $this; + } + + /** + * The new opaque client version token. + * + * Generated from protobuf field bytes new_version_token = 7; + * @return string + */ + public function getNewVersionToken() + { + return $this->new_version_token; + } + + /** + * The new opaque client version token. + * + * Generated from protobuf field bytes new_version_token = 7; + * @param string $var + * @return $this + */ + public function setNewVersionToken($var) + { + GPBUtil::checkString($var, False); + $this->new_version_token = $var; + + return $this; + } + + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * disregard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * @return \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse\Checksum|null + */ + public function getChecksum() + { + return $this->checksum; + } + + public function hasChecksum() + { + return isset($this->checksum); + } + + public function clearChecksum() + { + unset($this->checksum); + } + + /** + * The expected SHA256 hash of the client state; that is, of the sorted list + * of all hashes present in the database after applying the provided diff. + * If the client state doesn't match the expected state, the client must + * disregard this diff and retry later. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum checksum = 8; + * @param \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse\Checksum $var + * @return $this + */ + public function setChecksum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse\Checksum::class); + $this->checksum = $var; + + return $this; + } + + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRecommendedNextDiff() + { + return $this->recommended_next_diff; + } + + public function hasRecommendedNextDiff() + { + return isset($this->recommended_next_diff); + } + + public function clearRecommendedNextDiff() + { + unset($this->recommended_next_diff); + } + + /** + * The soonest the client should wait before issuing any diff + * request. Querying sooner is unlikely to produce a meaningful diff. + * Waiting longer is acceptable considering the use case. + * If this field is not set clients may update as soon as they want. + * + * Generated from protobuf field .google.protobuf.Timestamp recommended_next_diff = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRecommendedNextDiff($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->recommended_next_diff = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/Checksum.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/Checksum.php new file mode 100644 index 00000000000..f9c2d57899a --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/Checksum.php @@ -0,0 +1,74 @@ +google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.Checksum + */ +class Checksum extends \Google\Protobuf\Internal\Message +{ + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + */ + protected $sha256 = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $sha256 + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + * @return string + */ + public function getSha256() + { + return $this->sha256; + } + + /** + * The SHA256 hash of the client state; that is, of the sorted list of all + * hashes present in the database. + * + * Generated from protobuf field bytes sha256 = 1; + * @param string $var + * @return $this + */ + public function setSha256($var) + { + GPBUtil::checkString($var, False); + $this->sha256 = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Checksum::class, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse_Checksum::class); + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/ResponseType.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/ResponseType.php new file mode 100644 index 00000000000..a6a5478ca08 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ComputeThreatListDiffResponse/ResponseType.php @@ -0,0 +1,66 @@ +google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse.ResponseType + */ +class ResponseType +{ + /** + * Unknown. + * + * Generated from protobuf enum RESPONSE_TYPE_UNSPECIFIED = 0; + */ + const RESPONSE_TYPE_UNSPECIFIED = 0; + /** + * Partial updates are applied to the client's existing local database. + * + * Generated from protobuf enum DIFF = 1; + */ + const DIFF = 1; + /** + * Full updates resets the client's entire local database. This means + * that either the client had no state, was seriously out-of-date, + * or the client is believed to be corrupt. + * + * Generated from protobuf enum RESET = 2; + */ + const RESET = 2; + + private static $valueToName = [ + self::RESPONSE_TYPE_UNSPECIFIED => 'RESPONSE_TYPE_UNSPECIFIED', + self::DIFF => 'DIFF', + self::RESET => 'RESET', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResponseType::class, \Google\Cloud\WebRisk\V1beta1\ComputeThreatListDiffResponse_ResponseType::class); + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawHashes.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawHashes.php new file mode 100644 index 00000000000..da27e509ba2 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawHashes.php @@ -0,0 +1,119 @@ +google.cloud.webrisk.v1beta1.RawHashes + */ +class RawHashes extends \Google\Protobuf\Internal\Message +{ + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * + * Generated from protobuf field int32 prefix_size = 1; + */ + protected $prefix_size = 0; + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + */ + protected $raw_hashes = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $prefix_size + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * @type string $raw_hashes + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * + * Generated from protobuf field int32 prefix_size = 1; + * @return int + */ + public function getPrefixSize() + { + return $this->prefix_size; + } + + /** + * The number of bytes for each prefix encoded below. This field can be + * anywhere from 4 (shortest prefix) to 32 (full SHA256 hash). + * + * Generated from protobuf field int32 prefix_size = 1; + * @param int $var + * @return $this + */ + public function setPrefixSize($var) + { + GPBUtil::checkInt32($var); + $this->prefix_size = $var; + + return $this; + } + + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + * @return string + */ + public function getRawHashes() + { + return $this->raw_hashes; + } + + /** + * The hashes, in binary format, concatenated into one long string. Hashes are + * sorted in lexicographic order. For JSON API users, hashes are + * base64-encoded. + * + * Generated from protobuf field bytes raw_hashes = 2; + * @param string $var + * @return $this + */ + public function setRawHashes($var) + { + GPBUtil::checkString($var, False); + $this->raw_hashes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawIndices.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawIndices.php new file mode 100644 index 00000000000..c8849096063 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RawIndices.php @@ -0,0 +1,67 @@ +google.cloud.webrisk.v1beta1.RawIndices + */ +class RawIndices extends \Google\Protobuf\Internal\Message +{ + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + */ + private $indices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $indices + * The indices to remove from a lexicographically-sorted local list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIndices() + { + return $this->indices; + } + + /** + * The indices to remove from a lexicographically-sorted local list. + * + * Generated from protobuf field repeated int32 indices = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->indices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RiceDeltaEncoding.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RiceDeltaEncoding.php new file mode 100644 index 00000000000..427116c0bc3 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/RiceDeltaEncoding.php @@ -0,0 +1,190 @@ +google.cloud.webrisk.v1beta1.RiceDeltaEncoding + */ +class RiceDeltaEncoding extends \Google\Protobuf\Internal\Message +{ + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + */ + protected $first_value = 0; + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + */ + protected $rice_parameter = 0; + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + */ + protected $entry_count = 0; + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + */ + protected $encoded_data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $first_value + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * @type int $rice_parameter + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * @type int $entry_count + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * @type string $encoded_data + * The encoded deltas that are encoded using the Golomb-Rice coder. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + * @return int|string + */ + public function getFirstValue() + { + return $this->first_value; + } + + /** + * The offset of the first entry in the encoded data, or, if only a single + * integer was encoded, that single integer's value. If the field is empty or + * missing, assume zero. + * + * Generated from protobuf field int64 first_value = 1; + * @param int|string $var + * @return $this + */ + public function setFirstValue($var) + { + GPBUtil::checkInt64($var); + $this->first_value = $var; + + return $this; + } + + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + * @return int + */ + public function getRiceParameter() + { + return $this->rice_parameter; + } + + /** + * The Golomb-Rice parameter, which is a number between 2 and 28. This field + * is missing (that is, zero) if `num_entries` is zero. + * + * Generated from protobuf field int32 rice_parameter = 2; + * @param int $var + * @return $this + */ + public function setRiceParameter($var) + { + GPBUtil::checkInt32($var); + $this->rice_parameter = $var; + + return $this; + } + + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + * @return int + */ + public function getEntryCount() + { + return $this->entry_count; + } + + /** + * The number of entries that are delta encoded in the encoded data. If only a + * single integer was encoded, this will be zero and the single value will be + * stored in `first_value`. + * + * Generated from protobuf field int32 entry_count = 3; + * @param int $var + * @return $this + */ + public function setEntryCount($var) + { + GPBUtil::checkInt32($var); + $this->entry_count = $var; + + return $this; + } + + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + * @return string + */ + public function getEncodedData() + { + return $this->encoded_data; + } + + /** + * The encoded deltas that are encoded using the Golomb-Rice coder. + * + * Generated from protobuf field bytes encoded_data = 4; + * @param string $var + * @return $this + */ + public function setEncodedData($var) + { + GPBUtil::checkString($var, False); + $this->encoded_data = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesRequest.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesRequest.php new file mode 100644 index 00000000000..2b6b5be4b9e --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesRequest.php @@ -0,0 +1,105 @@ +google.cloud.webrisk.v1beta1.SearchHashesRequest + */ +class SearchHashesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * + * Generated from protobuf field bytes hash_prefix = 1; + */ + protected $hash_prefix = ''; + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $threat_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $hash_prefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * Required. The ThreatLists to search in. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * + * Generated from protobuf field bytes hash_prefix = 1; + * @return string + */ + public function getHashPrefix() + { + return $this->hash_prefix; + } + + /** + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * + * Generated from protobuf field bytes hash_prefix = 1; + * @param string $var + * @return $this + */ + public function setHashPrefix($var) + { + GPBUtil::checkString($var, False); + $this->hash_prefix = $var; + + return $this; + } + + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse.php new file mode 100644 index 00000000000..ed4e0619c77 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse.php @@ -0,0 +1,117 @@ +google.cloud.webrisk.v1beta1.SearchHashesResponse + */ +class SearchHashesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash threats = 1; + */ + private $threats; + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + */ + protected $negative_expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebRisk\V1beta1\SearchHashesResponse\ThreatHash>|\Google\Protobuf\Internal\RepeatedField $threats + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * @type \Google\Protobuf\Timestamp $negative_expire_time + * For requested entities that did not match the threat list, how long to + * cache the response until. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash threats = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreats() + { + return $this->threats; + } + + /** + * The full hashes that matched the requested prefixes. + * The hash will be populated in the key. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash threats = 1; + * @param array<\Google\Cloud\WebRisk\V1beta1\SearchHashesResponse\ThreatHash>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebRisk\V1beta1\SearchHashesResponse\ThreatHash::class); + $this->threats = $arr; + + return $this; + } + + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getNegativeExpireTime() + { + return $this->negative_expire_time; + } + + public function hasNegativeExpireTime() + { + return isset($this->negative_expire_time); + } + + public function clearNegativeExpireTime() + { + unset($this->negative_expire_time); + } + + /** + * For requested entities that did not match the threat list, how long to + * cache the response until. + * + * Generated from protobuf field .google.protobuf.Timestamp negative_expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setNegativeExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->negative_expire_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse/ThreatHash.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse/ThreatHash.php new file mode 100644 index 00000000000..e1b8fb56ba9 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchHashesResponse/ThreatHash.php @@ -0,0 +1,160 @@ +google.cloud.webrisk.v1beta1.SearchHashesResponse.ThreatHash + */ +class ThreatHash extends \Google\Protobuf\Internal\Message +{ + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + */ + private $threat_types; + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + */ + protected $hash = ''; + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + */ + protected $expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * @type string $hash + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * @type \Google\Protobuf\Timestamp $expire_time + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * The ThreatList this threat belongs to. + * This must contain at least one entry. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + * @return string + */ + public function getHash() + { + return $this->hash; + } + + /** + * A 32 byte SHA256 hash. This field is in binary format. For JSON + * requests, hashes are base64-encoded. + * + * Generated from protobuf field bytes hash = 2; + * @param string $var + * @return $this + */ + public function setHash($var) + { + GPBUtil::checkString($var, False); + $this->hash = $var; + + return $this; + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ThreatHash::class, \Google\Cloud\WebRisk\V1beta1\SearchHashesResponse_ThreatHash::class); + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisRequest.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisRequest.php new file mode 100644 index 00000000000..9b41a391e3f --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisRequest.php @@ -0,0 +1,101 @@ +google.cloud.webrisk.v1beta1.SearchUrisRequest + */ +class SearchUrisRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $threat_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. The URI to be checked for matches. + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * Required. The ThreatLists to search in. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The URI to be checked for matches. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * Required. The ThreatLists to search in. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse.php new file mode 100644 index 00000000000..6b0061d4d42 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse.php @@ -0,0 +1,75 @@ +google.cloud.webrisk.v1beta1.SearchUrisResponse + */ +class SearchUrisResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The threat list matches. This may be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri threat = 1; + */ + protected $threat = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse\ThreatUri $threat + * The threat list matches. This may be empty if the URI is on no list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The threat list matches. This may be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri threat = 1; + * @return \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse\ThreatUri|null + */ + public function getThreat() + { + return $this->threat; + } + + public function hasThreat() + { + return isset($this->threat); + } + + public function clearThreat() + { + unset($this->threat); + } + + /** + * The threat list matches. This may be empty if the URI is on no list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri threat = 1; + * @param \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse\ThreatUri $var + * @return $this + */ + public function setThreat($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse\ThreatUri::class); + $this->threat = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse/ThreatUri.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse/ThreatUri.php new file mode 100644 index 00000000000..18342b1f533 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/SearchUrisResponse/ThreatUri.php @@ -0,0 +1,118 @@ +google.cloud.webrisk.v1beta1.SearchUrisResponse.ThreatUri + */ +class ThreatUri extends \Google\Protobuf\Internal\Message +{ + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + */ + private $threat_types; + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + */ + protected $expire_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $threat_types + * The ThreatList this threat belongs to. + * @type \Google\Protobuf\Timestamp $expire_time + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getThreatTypes() + { + return $this->threat_types; + } + + /** + * The ThreatList this threat belongs to. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.ThreatType threat_types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setThreatTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebRisk\V1beta1\ThreatType::class); + $this->threat_types = $arr; + + return $this; + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * The cache lifetime for the returned match. Clients must not cache this + * response past this timestamp to avoid false positives. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ThreatUri::class, \Google\Cloud\WebRisk\V1beta1\SearchUrisResponse_ThreatUri::class); + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryAdditions.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryAdditions.php new file mode 100644 index 00000000000..24b83d090bf --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryAdditions.php @@ -0,0 +1,124 @@ +google.cloud.webrisk.v1beta1.ThreatEntryAdditions + */ +class ThreatEntryAdditions extends \Google\Protobuf\Internal\Message +{ + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.RawHashes raw_hashes = 1; + */ + private $raw_hashes; + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_hashes = 2; + */ + protected $rice_hashes = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebRisk\V1beta1\RawHashes>|\Google\Protobuf\Internal\RepeatedField $raw_hashes + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * @type \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding $rice_hashes + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.RawHashes raw_hashes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRawHashes() + { + return $this->raw_hashes; + } + + /** + * The raw SHA256-formatted entries. + * Repeated to allow returning sets of hashes with different prefix sizes. + * + * Generated from protobuf field repeated .google.cloud.webrisk.v1beta1.RawHashes raw_hashes = 1; + * @param array<\Google\Cloud\WebRisk\V1beta1\RawHashes>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRawHashes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebRisk\V1beta1\RawHashes::class); + $this->raw_hashes = $arr; + + return $this; + } + + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_hashes = 2; + * @return \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding|null + */ + public function getRiceHashes() + { + return $this->rice_hashes; + } + + public function hasRiceHashes() + { + return isset($this->rice_hashes); + } + + public function clearRiceHashes() + { + unset($this->rice_hashes); + } + + /** + * The encoded 4-byte prefixes of SHA256-formatted entries, using a + * Golomb-Rice encoding. The hashes are converted to uint32, sorted in + * ascending order, then delta encoded and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_hashes = 2; + * @param \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding $var + * @return $this + */ + public function setRiceHashes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding::class); + $this->rice_hashes = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryRemovals.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryRemovals.php new file mode 100644 index 00000000000..f26c06dd273 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatEntryRemovals.php @@ -0,0 +1,133 @@ +google.cloud.webrisk.v1beta1.ThreatEntryRemovals + */ +class ThreatEntryRemovals extends \Google\Protobuf\Internal\Message +{ + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RawIndices raw_indices = 1; + */ + protected $raw_indices = null; + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_indices = 2; + */ + protected $rice_indices = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebRisk\V1beta1\RawIndices $raw_indices + * The raw removal indices for a local list. + * @type \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding $rice_indices + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Webrisk\V1Beta1\Webrisk::initOnce(); + parent::__construct($data); + } + + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RawIndices raw_indices = 1; + * @return \Google\Cloud\WebRisk\V1beta1\RawIndices|null + */ + public function getRawIndices() + { + return $this->raw_indices; + } + + public function hasRawIndices() + { + return isset($this->raw_indices); + } + + public function clearRawIndices() + { + unset($this->raw_indices); + } + + /** + * The raw removal indices for a local list. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RawIndices raw_indices = 1; + * @param \Google\Cloud\WebRisk\V1beta1\RawIndices $var + * @return $this + */ + public function setRawIndices($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RawIndices::class); + $this->raw_indices = $var; + + return $this; + } + + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_indices = 2; + * @return \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding|null + */ + public function getRiceIndices() + { + return $this->rice_indices; + } + + public function hasRiceIndices() + { + return isset($this->rice_indices); + } + + public function clearRiceIndices() + { + unset($this->rice_indices); + } + + /** + * The encoded local, lexicographically-sorted list indices, using a + * Golomb-Rice encoding. Used for sending compressed removal indices. The + * removal indices (uint32) are sorted in ascending order, then delta encoded + * and stored as encoded_data. + * + * Generated from protobuf field .google.cloud.webrisk.v1beta1.RiceDeltaEncoding rice_indices = 2; + * @param \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding $var + * @return $this + */ + public function setRiceIndices($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebRisk\V1beta1\RiceDeltaEncoding::class); + $this->rice_indices = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatType.php b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatType.php new file mode 100644 index 00000000000..1b7a29aaf9b --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/proto/src/Google/Cloud/WebRisk/V1beta1/ThreatType.php @@ -0,0 +1,69 @@ +google.cloud.webrisk.v1beta1.ThreatType + */ +class ThreatType +{ + /** + * Unknown. + * + * Generated from protobuf enum THREAT_TYPE_UNSPECIFIED = 0; + */ + const THREAT_TYPE_UNSPECIFIED = 0; + /** + * Malware targeting any platform. + * + * Generated from protobuf enum MALWARE = 1; + */ + const MALWARE = 1; + /** + * Social engineering targeting any platform. + * + * Generated from protobuf enum SOCIAL_ENGINEERING = 2; + */ + const SOCIAL_ENGINEERING = 2; + /** + * Unwanted software targeting any platform. + * + * Generated from protobuf enum UNWANTED_SOFTWARE = 3; + */ + const UNWANTED_SOFTWARE = 3; + + private static $valueToName = [ + self::THREAT_TYPE_UNSPECIFIED => 'THREAT_TYPE_UNSPECIFIED', + self::MALWARE => 'MALWARE', + self::SOCIAL_ENGINEERING => 'SOCIAL_ENGINEERING', + self::UNWANTED_SOFTWARE => 'UNWANTED_SOFTWARE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/compute_threat_list_diff.php b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/compute_threat_list_diff.php new file mode 100644 index 00000000000..54b4da740e7 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/compute_threat_list_diff.php @@ -0,0 +1,70 @@ +computeThreatListDiff($threatType, $constraints); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + + compute_threat_list_diff_sample($threatType); +} +// [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_sync] diff --git a/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_hashes.php b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_hashes.php new file mode 100644 index 00000000000..1fad6d58e86 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_hashes.php @@ -0,0 +1,73 @@ +searchHashes($threatTypes); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $threatTypesElement = ThreatType::THREAT_TYPE_UNSPECIFIED; + + search_hashes_sample($threatTypesElement); +} +// [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_sync] diff --git a/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_uris.php b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_uris.php new file mode 100644 index 00000000000..d745fe0eca3 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/samples/V1beta1/WebRiskServiceV1Beta1Client/search_uris.php @@ -0,0 +1,71 @@ +searchUris($uri, $threatTypes); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $uri = '[URI]'; + $threatTypesElement = ThreatType::THREAT_TYPE_UNSPECIFIED; + + search_uris_sample($uri, $threatTypesElement); +} +// [END webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_sync] diff --git a/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/Gapic/WebRiskServiceV1Beta1GapicClient.php b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/Gapic/WebRiskServiceV1Beta1GapicClient.php new file mode 100644 index 00000000000..4d5def231c0 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/Gapic/WebRiskServiceV1Beta1GapicClient.php @@ -0,0 +1,313 @@ +computeThreatListDiff($threatType, $constraints); + * } finally { + * $webRiskServiceV1Beta1Client->close(); + * } + * ``` + * + * @experimental + * + * @deprecated This class will be removed in the next major version update. + */ +class WebRiskServiceV1Beta1GapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'webrisk.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'webrisk.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 static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/web_risk_service_v1_beta1_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/web_risk_service_v1_beta1_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/web_risk_service_v1_beta1_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/web_risk_service_v1_beta1_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'webrisk.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Gets the most recent threat list diffs. + * + * Sample code: + * ``` + * $webRiskServiceV1Beta1Client = new WebRiskServiceV1Beta1Client(); + * try { + * $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + * $constraints = new Constraints(); + * $response = $webRiskServiceV1Beta1Client->computeThreatListDiff($threatType, $constraints); + * } finally { + * $webRiskServiceV1Beta1Client->close(); + * } + * ``` + * + * @param int $threatType The ThreatList to update. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1beta1\ThreatType} + * @param Constraints $constraints Required. The constraints associated with this request. + * @param array $optionalArgs { + * Optional. + * + * @type string $versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * @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\WebRisk\V1beta1\ComputeThreatListDiffResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function computeThreatListDiff($threatType, $constraints, array $optionalArgs = []) + { + $request = new ComputeThreatListDiffRequest(); + $request->setThreatType($threatType); + $request->setConstraints($constraints); + if (isset($optionalArgs['versionToken'])) { + $request->setVersionToken($optionalArgs['versionToken']); + } + + return $this->startCall('ComputeThreatListDiff', ComputeThreatListDiffResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * Sample code: + * ``` + * $webRiskServiceV1Beta1Client = new WebRiskServiceV1Beta1Client(); + * try { + * $threatTypes = []; + * $response = $webRiskServiceV1Beta1Client->searchHashes($threatTypes); + * } finally { + * $webRiskServiceV1Beta1Client->close(); + * } + * ``` + * + * @param int[] $threatTypes Required. The ThreatLists to search in. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1beta1\ThreatType} + * @param array $optionalArgs { + * Optional. + * + * @type string $hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * @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\WebRisk\V1beta1\SearchHashesResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function searchHashes($threatTypes, array $optionalArgs = []) + { + $request = new SearchHashesRequest(); + $request->setThreatTypes($threatTypes); + if (isset($optionalArgs['hashPrefix'])) { + $request->setHashPrefix($optionalArgs['hashPrefix']); + } + + return $this->startCall('SearchHashes', SearchHashesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * This method is used to check whether a URI is on a given threatList. + * + * Sample code: + * ``` + * $webRiskServiceV1Beta1Client = new WebRiskServiceV1Beta1Client(); + * try { + * $uri = 'uri'; + * $threatTypes = []; + * $response = $webRiskServiceV1Beta1Client->searchUris($uri, $threatTypes); + * } finally { + * $webRiskServiceV1Beta1Client->close(); + * } + * ``` + * + * @param string $uri Required. The URI to be checked for matches. + * @param int[] $threatTypes Required. The ThreatLists to search in. + * For allowed values, use constants defined on {@see \Google\Cloud\WebRisk\V1beta1\ThreatType} + * @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\Cloud\WebRisk\V1beta1\SearchUrisResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function searchUris($uri, $threatTypes, array $optionalArgs = []) + { + $request = new SearchUrisRequest(); + $request->setUri($uri); + $request->setThreatTypes($threatTypes); + return $this->startCall('SearchUris', SearchUrisResponse::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/WebRiskServiceV1Beta1Client.php b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/WebRiskServiceV1Beta1Client.php new file mode 100644 index 00000000000..2c9f57a4616 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/WebRiskServiceV1Beta1Client.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1' => [], + ], +]; diff --git a/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/resources/web_risk_service_v1_beta1_rest_client_config.php b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/resources/web_risk_service_v1_beta1_rest_client_config.php new file mode 100644 index 00000000000..d7ca5b4f993 --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/src/V1beta1/resources/web_risk_service_v1_beta1_rest_client_config.php @@ -0,0 +1,21 @@ + [ + 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1' => [ + 'ComputeThreatListDiff' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/threatLists:computeDiff', + ], + 'SearchHashes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/hashes:search', + ], + 'SearchUris' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta1/uris:search', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/WebRisk/v1beta1/tests/Unit/V1beta1/WebRiskServiceV1Beta1ClientTest.php b/owl-bot-staging/WebRisk/v1beta1/tests/Unit/V1beta1/WebRiskServiceV1Beta1ClientTest.php new file mode 100644 index 00000000000..8530f340caa --- /dev/null +++ b/owl-bot-staging/WebRisk/v1beta1/tests/Unit/V1beta1/WebRiskServiceV1Beta1ClientTest.php @@ -0,0 +1,249 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WebRiskServiceV1Beta1Client */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WebRiskServiceV1Beta1Client($options); + } + + /** @test */ + public function computeThreatListDiffTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $newVersionToken = '115'; + $expectedResponse = new ComputeThreatListDiffResponse(); + $expectedResponse->setNewVersionToken($newVersionToken); + $transport->addResponse($expectedResponse); + // Mock request + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + $response = $gapicClient->computeThreatListDiff($threatType, $constraints); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/ComputeThreatListDiff', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatType(); + $this->assertProtobufEquals($threatType, $actualValue); + $actualValue = $actualRequestObject->getConstraints(); + $this->assertProtobufEquals($constraints, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function computeThreatListDiffExceptionTest() + { + $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 + $threatType = ThreatType::THREAT_TYPE_UNSPECIFIED; + $constraints = new Constraints(); + try { + $gapicClient->computeThreatListDiff($threatType, $constraints); + // 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()); + } + + /** @test */ + public function searchHashesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchHashesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $threatTypes = []; + $response = $gapicClient->searchHashes($threatTypes); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchHashes', $actualFuncCall); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchHashesExceptionTest() + { + $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 + $threatTypes = []; + try { + $gapicClient->searchHashes($threatTypes); + // 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()); + } + + /** @test */ + public function searchUrisTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new SearchUrisResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $uri = 'uri116076'; + $threatTypes = []; + $response = $gapicClient->searchUris($uri, $threatTypes); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1/SearchUris', $actualFuncCall); + $actualValue = $actualRequestObject->getUri(); + $this->assertProtobufEquals($uri, $actualValue); + $actualValue = $actualRequestObject->getThreatTypes(); + $this->assertProtobufEquals($threatTypes, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function searchUrisExceptionTest() + { + $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 + $uri = 'uri116076'; + $threatTypes = []; + try { + $gapicClient->searchUris($uri, $threatTypes); + // 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()); + } +} diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/CrawledUrl.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/CrawledUrl.php new file mode 100644 index 00000000000..7abf286dcd0 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/CrawledUrl.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' + +4google/cloud/websecurityscanner/v1/crawled_url.proto"google.cloud.websecurityscanner.v1"< + +CrawledUrl + http_method (  +url (  +body ( B +&com.google.cloud.websecurityscanner.v1BCrawledUrlProtoPZVcloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"Google.Cloud.WebSecurityScanner.V1"Google\\Cloud\\WebSecurityScanner\\V1%Google::Cloud::WebSecurityScanner::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/Finding.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/Finding.php new file mode 100644 index 00000000000..18c485bde73 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/Finding.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingAddon.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingAddon.php new file mode 100644 index 00000000000..c02f052dabd Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingAddon.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingTypeStats.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingTypeStats.php new file mode 100644 index 00000000000..5adf798d211 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/FindingTypeStats.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +;google/cloud/websecurityscanner/v1/finding_type_stats.proto"google.cloud.websecurityscanner.v1"? +FindingTypeStats + finding_type (  + finding_count (B +&com.google.cloud.websecurityscanner.v1BFindingTypeStatsProtoPZVcloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"Google.Cloud.WebSecurityScanner.V1"Google\\Cloud\\WebSecurityScanner\\V1%Google::Cloud::WebSecurityScanner::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfig.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfig.php new file mode 100644 index 00000000000..c76e4b19e97 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfig.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfigError.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfigError.php new file mode 100644 index 00000000000..b7027109c6e Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanConfigError.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRun.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRun.php new file mode 100644 index 00000000000..26b7e2bce31 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRun.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunErrorTrace.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunErrorTrace.php new file mode 100644 index 00000000000..40fb8ea299f Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunErrorTrace.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunLog.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunLog.php new file mode 100644 index 00000000000..1a1d25862cc --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunLog.php @@ -0,0 +1,39 @@ +internalAddGeneratedFile( + ' + +5google/cloud/websecurityscanner/v1/scan_run_log.proto"google.cloud.websecurityscanner.v1=google/cloud/websecurityscanner/v1/scan_run_error_trace.proto" + +ScanRunLog +summary (  +name ( S +execution_state (2:.google.cloud.websecurityscanner.v1.ScanRun.ExecutionStateM + result_state (27.google.cloud.websecurityscanner.v1.ScanRun.ResultState +urls_crawled_count ( +urls_tested_count ( + has_findings (J + error_trace ( 25.google.cloud.websecurityscanner.v1.ScanRunErrorTraceB +&com.google.cloud.websecurityscanner.v1BScanRunLogProtoPZVcloud.google.com/go/websecurityscanner/apiv1/websecurityscannerpb;websecurityscannerpb"Google.Cloud.WebSecurityScanner.V1"Google\\Cloud\\WebSecurityScanner\\V1%Google::Cloud::WebSecurityScanner::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunWarningTrace.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunWarningTrace.php new file mode 100644 index 00000000000..186f828d82c Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/ScanRunWarningTrace.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/WebSecurityScanner.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/WebSecurityScanner.php new file mode 100644 index 00000000000..a95d6eef8c5 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1/WebSecurityScanner.php @@ -0,0 +1,107 @@ +internalAddGeneratedFile( + ' +$ +=google/cloud/websecurityscanner/v1/web_security_scanner.proto"google.cloud.websecurityscanner.v1google/api/client.proto4google/cloud/websecurityscanner/v1/crawled_url.proto0google/cloud/websecurityscanner/v1/finding.proto;google/cloud/websecurityscanner/v1/finding_type_stats.proto4google/cloud/websecurityscanner/v1/scan_config.proto1google/cloud/websecurityscanner/v1/scan_run.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"n +CreateScanConfigRequest +parent ( C + scan_config ( 2..google.cloud.websecurityscanner.v1.ScanConfig"\' +DeleteScanConfigRequest +name ( "$ +GetScanConfigRequest +name ( "O +ListScanConfigsRequest +parent (  + +page_token (  + page_size (" +UpdateScanConfigRequestC + scan_config ( 2..google.cloud.websecurityscanner.v1.ScanConfig/ + update_mask ( 2.google.protobuf.FieldMask"x +ListScanConfigsResponseD + scan_configs ( 2..google.cloud.websecurityscanner.v1.ScanConfig +next_page_token ( "# +StartScanRunRequest +name ( "! +GetScanRunRequest +name ( "L +ListScanRunsRequest +parent (  + +page_token (  + page_size ("o +ListScanRunsResponse> + scan_runs ( 2+.google.cloud.websecurityscanner.v1.ScanRun +next_page_token ( "" +StopScanRunRequest +name ( "O +ListCrawledUrlsRequest +parent (  + +page_token (  + page_size ("x +ListCrawledUrlsResponseD + crawled_urls ( 2..google.cloud.websecurityscanner.v1.CrawledUrl +next_page_token ( "! +GetFindingRequest +name ( "\\ +ListFindingsRequest +parent (  +filter (  + +page_token (  + page_size ("n +ListFindingsResponse= +findings ( 2+.google.cloud.websecurityscanner.v1.Finding +next_page_token ( "- +ListFindingTypeStatsRequest +parent ( "p +ListFindingTypeStatsResponseP +finding_type_stats ( 24.google.cloud.websecurityscanner.v1.FindingTypeStats2 +WebSecurityScanner +CreateScanConfig;.google.cloud.websecurityscanner.v1.CreateScanConfigRequest..google.cloud.websecurityscanner.v1.ScanConfig"82"#/v1/{parent=projects/*}/scanConfigs: scan_config +DeleteScanConfig;.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest.google.protobuf.Empty"+%*#/v1/{name=projects/*/scanConfigs/*} + GetScanConfig8.google.cloud.websecurityscanner.v1.GetScanConfigRequest..google.cloud.websecurityscanner.v1.ScanConfig"+%#/v1/{name=projects/*/scanConfigs/*} +ListScanConfigs:.google.cloud.websecurityscanner.v1.ListScanConfigsRequest;.google.cloud.websecurityscanner.v1.ListScanConfigsResponse"+%#/v1/{parent=projects/*}/scanConfigs +UpdateScanConfig;.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest..google.cloud.websecurityscanner.v1.ScanConfig"D>2//v1/{scan_config.name=projects/*/scanConfigs/*}: scan_config + StartScanRun7.google.cloud.websecurityscanner.v1.StartScanRunRequest+.google.cloud.websecurityscanner.v1.ScanRun"4.")/v1/{name=projects/*/scanConfigs/*}:start:* + +GetScanRun5.google.cloud.websecurityscanner.v1.GetScanRunRequest+.google.cloud.websecurityscanner.v1.ScanRun"60./v1/{name=projects/*/scanConfigs/*/scanRuns/*} + ListScanRuns7.google.cloud.websecurityscanner.v1.ListScanRunsRequest8.google.cloud.websecurityscanner.v1.ListScanRunsResponse"60./v1/{parent=projects/*/scanConfigs/*}/scanRuns + StopScanRun6.google.cloud.websecurityscanner.v1.StopScanRunRequest+.google.cloud.websecurityscanner.v1.ScanRun">8"3/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop:* +ListCrawledUrls:.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest;.google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse"D>google.cloud.websecurityscanner.v1.CrawledUrl + */ +class CrawledUrl extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + */ + protected $http_method = ''; + /** + * Output only. The URL that was crawled. + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + /** + * Output only. The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + */ + protected $body = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $http_method + * Output only. The http method of the request that was used to visit the URL, in + * uppercase. + * @type string $url + * Output only. The URL that was crawled. + * @type string $body + * Output only. The body of the request that was used to visit the URL. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\CrawledUrl::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + * @return string + */ + public function getHttpMethod() + { + return $this->http_method; + } + + /** + * Output only. The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + * @param string $var + * @return $this + */ + public function setHttpMethod($var) + { + GPBUtil::checkString($var, True); + $this->http_method = $var; + + return $this; + } + + /** + * Output only. The URL that was crawled. + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Output only. The URL that was crawled. + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * Output only. The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * Output only. The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/CreateScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/CreateScanConfigRequest.php new file mode 100644 index 00000000000..fff8861ade4 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/CreateScanConfigRequest.php @@ -0,0 +1,115 @@ +google.cloud.websecurityscanner.v1.CreateScanConfigRequest + */ +class CreateScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + */ + protected $scan_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig $scan_config + * Required. The ScanConfig to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig|null + */ + public function getScanConfig() + { + return $this->scan_config; + } + + public function hasScanConfig() + { + return isset($this->scan_config); + } + + public function clearScanConfig() + { + unset($this->scan_config); + } + + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig $var + * @return $this + */ + public function setScanConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig::class); + $this->scan_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/DeleteScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/DeleteScanConfigRequest.php new file mode 100644 index 00000000000..c425beafce9 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/DeleteScanConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1.DeleteScanConfigRequest + */ +class DeleteScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding.php new file mode 100644 index 00000000000..4bc03c3293b --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding.php @@ -0,0 +1,764 @@ +google.cloud.websecurityscanner.v1.Finding + */ +class Finding extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + * + * Generated from protobuf field string finding_type = 2; + */ + protected $finding_type = ''; + /** + * Output only. The severity level of the reported vulnerability. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Finding.Severity severity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $severity = 0; + /** + * Output only. The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + */ + protected $http_method = ''; + /** + * Output only. The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + */ + protected $fuzzed_url = ''; + /** + * Output only. The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + */ + protected $body = ''; + /** + * Output only. The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * Output only. The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + */ + protected $reproduction_url = ''; + /** + * Output only. If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + */ + protected $frame_url = ''; + /** + * Output only. The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + */ + protected $final_url = ''; + /** + * Output only. The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + */ + protected $tracking_id = ''; + /** + * Output only. An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Form form = 16; + */ + protected $form = null; + /** + * Output only. An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.OutdatedLibrary outdated_library = 11; + */ + protected $outdated_library = null; + /** + * Output only. An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ViolatingResource violating_resource = 12; + */ + protected $violating_resource = null; + /** + * Output only. An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableHeaders vulnerable_headers = 15; + */ + protected $vulnerable_headers = null; + /** + * Output only. An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableParameters vulnerable_parameters = 13; + */ + protected $vulnerable_parameters = null; + /** + * Output only. An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss xss = 14; + */ + protected $xss = null; + /** + * Output only. An addon containing information reported for an XXE, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe xxe = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $xxe = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * @type string $finding_type + * Output only. The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + * @type int $severity + * Output only. The severity level of the reported vulnerability. + * @type string $http_method + * Output only. The http method of the request that triggered the vulnerability, in + * uppercase. + * @type string $fuzzed_url + * Output only. The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * @type string $body + * Output only. The body of the request that triggered the vulnerability. + * @type string $description + * Output only. The description of the vulnerability. + * @type string $reproduction_url + * Output only. The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * @type string $frame_url + * Output only. If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * @type string $final_url + * Output only. The URL where the browser lands when the vulnerability is detected. + * @type string $tracking_id + * Output only. The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * @type \Google\Cloud\WebSecurityScanner\V1\Form $form + * Output only. An addon containing information reported for a vulnerability with an HTML + * form, if any. + * @type \Google\Cloud\WebSecurityScanner\V1\OutdatedLibrary $outdated_library + * Output only. An addon containing information about outdated libraries. + * @type \Google\Cloud\WebSecurityScanner\V1\ViolatingResource $violating_resource + * Output only. An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * @type \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders $vulnerable_headers + * Output only. An addon containing information about vulnerable or missing HTTP headers. + * @type \Google\Cloud\WebSecurityScanner\V1\VulnerableParameters $vulnerable_parameters + * Output only. An addon containing information about request parameters which were found + * to be vulnerable. + * @type \Google\Cloud\WebSecurityScanner\V1\Xss $xss + * Output only. An addon containing information reported for an XSS, if any. + * @type \Google\Cloud\WebSecurityScanner\V1\Xxe $xxe + * Output only. An addon containing information reported for an XXE, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\Finding::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + * + * Generated from protobuf field string finding_type = 2; + * @return string + */ + public function getFindingType() + { + return $this->finding_type; + } + + /** + * Output only. The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + * + * Generated from protobuf field string finding_type = 2; + * @param string $var + * @return $this + */ + public function setFindingType($var) + { + GPBUtil::checkString($var, True); + $this->finding_type = $var; + + return $this; + } + + /** + * Output only. The severity level of the reported vulnerability. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Finding.Severity severity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Output only. The severity level of the reported vulnerability. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Finding.Severity severity = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\Finding\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + * @return string + */ + public function getHttpMethod() + { + return $this->http_method; + } + + /** + * Output only. The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + * @param string $var + * @return $this + */ + public function setHttpMethod($var) + { + GPBUtil::checkString($var, True); + $this->http_method = $var; + + return $this; + } + + /** + * Output only. The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + * @return string + */ + public function getFuzzedUrl() + { + return $this->fuzzed_url; + } + + /** + * Output only. The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + * @param string $var + * @return $this + */ + public function setFuzzedUrl($var) + { + GPBUtil::checkString($var, True); + $this->fuzzed_url = $var; + + return $this; + } + + /** + * Output only. The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * Output only. The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + + /** + * Output only. The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + * @return string + */ + public function getReproductionUrl() + { + return $this->reproduction_url; + } + + /** + * Output only. The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + * @param string $var + * @return $this + */ + public function setReproductionUrl($var) + { + GPBUtil::checkString($var, True); + $this->reproduction_url = $var; + + return $this; + } + + /** + * Output only. If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + * @return string + */ + public function getFrameUrl() + { + return $this->frame_url; + } + + /** + * Output only. If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + * @param string $var + * @return $this + */ + public function setFrameUrl($var) + { + GPBUtil::checkString($var, True); + $this->frame_url = $var; + + return $this; + } + + /** + * Output only. The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + * @return string + */ + public function getFinalUrl() + { + return $this->final_url; + } + + /** + * Output only. The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + * @param string $var + * @return $this + */ + public function setFinalUrl($var) + { + GPBUtil::checkString($var, True); + $this->final_url = $var; + + return $this; + } + + /** + * Output only. The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + * @return string + */ + public function getTrackingId() + { + return $this->tracking_id; + } + + /** + * Output only. The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + * @param string $var + * @return $this + */ + public function setTrackingId($var) + { + GPBUtil::checkString($var, True); + $this->tracking_id = $var; + + return $this; + } + + /** + * Output only. An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Form form = 16; + * @return \Google\Cloud\WebSecurityScanner\V1\Form|null + */ + public function getForm() + { + return $this->form; + } + + public function hasForm() + { + return isset($this->form); + } + + public function clearForm() + { + unset($this->form); + } + + /** + * Output only. An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Form form = 16; + * @param \Google\Cloud\WebSecurityScanner\V1\Form $var + * @return $this + */ + public function setForm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\Form::class); + $this->form = $var; + + return $this; + } + + /** + * Output only. An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.OutdatedLibrary outdated_library = 11; + * @return \Google\Cloud\WebSecurityScanner\V1\OutdatedLibrary|null + */ + public function getOutdatedLibrary() + { + return $this->outdated_library; + } + + public function hasOutdatedLibrary() + { + return isset($this->outdated_library); + } + + public function clearOutdatedLibrary() + { + unset($this->outdated_library); + } + + /** + * Output only. An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.OutdatedLibrary outdated_library = 11; + * @param \Google\Cloud\WebSecurityScanner\V1\OutdatedLibrary $var + * @return $this + */ + public function setOutdatedLibrary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\OutdatedLibrary::class); + $this->outdated_library = $var; + + return $this; + } + + /** + * Output only. An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ViolatingResource violating_resource = 12; + * @return \Google\Cloud\WebSecurityScanner\V1\ViolatingResource|null + */ + public function getViolatingResource() + { + return $this->violating_resource; + } + + public function hasViolatingResource() + { + return isset($this->violating_resource); + } + + public function clearViolatingResource() + { + unset($this->violating_resource); + } + + /** + * Output only. An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ViolatingResource violating_resource = 12; + * @param \Google\Cloud\WebSecurityScanner\V1\ViolatingResource $var + * @return $this + */ + public function setViolatingResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ViolatingResource::class); + $this->violating_resource = $var; + + return $this; + } + + /** + * Output only. An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableHeaders vulnerable_headers = 15; + * @return \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders|null + */ + public function getVulnerableHeaders() + { + return $this->vulnerable_headers; + } + + public function hasVulnerableHeaders() + { + return isset($this->vulnerable_headers); + } + + public function clearVulnerableHeaders() + { + unset($this->vulnerable_headers); + } + + /** + * Output only. An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableHeaders vulnerable_headers = 15; + * @param \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders $var + * @return $this + */ + public function setVulnerableHeaders($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders::class); + $this->vulnerable_headers = $var; + + return $this; + } + + /** + * Output only. An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableParameters vulnerable_parameters = 13; + * @return \Google\Cloud\WebSecurityScanner\V1\VulnerableParameters|null + */ + public function getVulnerableParameters() + { + return $this->vulnerable_parameters; + } + + public function hasVulnerableParameters() + { + return isset($this->vulnerable_parameters); + } + + public function clearVulnerableParameters() + { + unset($this->vulnerable_parameters); + } + + /** + * Output only. An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.VulnerableParameters vulnerable_parameters = 13; + * @param \Google\Cloud\WebSecurityScanner\V1\VulnerableParameters $var + * @return $this + */ + public function setVulnerableParameters($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\VulnerableParameters::class); + $this->vulnerable_parameters = $var; + + return $this; + } + + /** + * Output only. An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss xss = 14; + * @return \Google\Cloud\WebSecurityScanner\V1\Xss|null + */ + public function getXss() + { + return $this->xss; + } + + public function hasXss() + { + return isset($this->xss); + } + + public function clearXss() + { + unset($this->xss); + } + + /** + * Output only. An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss xss = 14; + * @param \Google\Cloud\WebSecurityScanner\V1\Xss $var + * @return $this + */ + public function setXss($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\Xss::class); + $this->xss = $var; + + return $this; + } + + /** + * Output only. An addon containing information reported for an XXE, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe xxe = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\WebSecurityScanner\V1\Xxe|null + */ + public function getXxe() + { + return $this->xxe; + } + + public function hasXxe() + { + return isset($this->xxe); + } + + public function clearXxe() + { + unset($this->xxe); + } + + /** + * Output only. An addon containing information reported for an XXE, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe xxe = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\WebSecurityScanner\V1\Xxe $var + * @return $this + */ + public function setXxe($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\Xxe::class); + $this->xxe = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding/Severity.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding/Severity.php new file mode 100644 index 00000000000..414c89667eb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Finding/Severity.php @@ -0,0 +1,78 @@ +google.cloud.websecurityscanner.v1.Finding.Severity + */ +class Severity +{ + /** + * No severity specified. The default value. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * Critical severity. + * + * Generated from protobuf enum CRITICAL = 1; + */ + const CRITICAL = 1; + /** + * High severity. + * + * Generated from protobuf enum HIGH = 2; + */ + const HIGH = 2; + /** + * Medium severity. + * + * Generated from protobuf enum MEDIUM = 3; + */ + const MEDIUM = 3; + /** + * Low severity. + * + * Generated from protobuf enum LOW = 4; + */ + const LOW = 4; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::CRITICAL => 'CRITICAL', + self::HIGH => 'HIGH', + self::MEDIUM => 'MEDIUM', + self::LOW => 'LOW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Severity::class, \Google\Cloud\WebSecurityScanner\V1\Finding_Severity::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/FindingTypeStats.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/FindingTypeStats.php new file mode 100644 index 00000000000..52c1f5d5855 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/FindingTypeStats.php @@ -0,0 +1,102 @@ +google.cloud.websecurityscanner.v1.FindingTypeStats + */ +class FindingTypeStats extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + */ + protected $finding_type = ''; + /** + * Output only. The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + */ + protected $finding_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $finding_type + * Output only. The finding type associated with the stats. + * @type int $finding_count + * Output only. The count of findings belonging to this finding type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingTypeStats::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + * @return string + */ + public function getFindingType() + { + return $this->finding_type; + } + + /** + * Output only. The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + * @param string $var + * @return $this + */ + public function setFindingType($var) + { + GPBUtil::checkString($var, True); + $this->finding_type = $var; + + return $this; + } + + /** + * Output only. The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + * @return int + */ + public function getFindingCount() + { + return $this->finding_count; + } + + /** + * Output only. The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + * @param int $var + * @return $this + */ + public function setFindingCount($var) + { + GPBUtil::checkInt32($var); + $this->finding_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Form.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Form.php new file mode 100644 index 00000000000..d7c8fa1b4d6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Form.php @@ -0,0 +1,101 @@ +google.cloud.websecurityscanner.v1.Form + */ +class Form extends \Google\Protobuf\Internal\Message +{ + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + */ + protected $action_uri = ''; + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + */ + private $fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action_uri + * ! The URI where to send the form when it's submitted. + * @type array|\Google\Protobuf\Internal\RepeatedField $fields + * ! The names of form fields related to the vulnerability. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + * @return string + */ + public function getActionUri() + { + return $this->action_uri; + } + + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + * @param string $var + * @return $this + */ + public function setActionUri($var) + { + GPBUtil::checkString($var, True); + $this->action_uri = $var; + + return $this; + } + + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->fields = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetFindingRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetFindingRequest.php new file mode 100644 index 00000000000..56613939f49 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetFindingRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1.GetFindingRequest + */ +class GetFindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanConfigRequest.php new file mode 100644 index 00000000000..b2835242fe3 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1.GetScanConfigRequest + */ +class GetScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanRunRequest.php new file mode 100644 index 00000000000..b7d3f11f9e1 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/GetScanRunRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1.GetScanRunRequest + */ +class GetScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsRequest.php new file mode 100644 index 00000000000..55c61e7b7fb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsRequest.php @@ -0,0 +1,159 @@ +google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest + */ +class ListCrawledUrlsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsResponse.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsResponse.php new file mode 100644 index 00000000000..2a14aca6699 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListCrawledUrlsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse + */ +class ListCrawledUrlsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.CrawledUrl crawled_urls = 1; + */ + private $crawled_urls; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\CrawledUrl>|\Google\Protobuf\Internal\RepeatedField $crawled_urls + * The list of CrawledUrls returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.CrawledUrl crawled_urls = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCrawledUrls() + { + return $this->crawled_urls; + } + + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.CrawledUrl crawled_urls = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\CrawledUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCrawledUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\CrawledUrl::class); + $this->crawled_urls = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsRequest.php new file mode 100644 index 00000000000..2e969337f77 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest + */ +class ListFindingTypeStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsResponse.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsResponse.php new file mode 100644 index 00000000000..68c1c6ea819 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingTypeStatsResponse.php @@ -0,0 +1,67 @@ +google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse + */ +class ListFindingTypeStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.FindingTypeStats finding_type_stats = 1; + */ + private $finding_type_stats; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\FindingTypeStats>|\Google\Protobuf\Internal\RepeatedField $finding_type_stats + * The list of FindingTypeStats returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.FindingTypeStats finding_type_stats = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFindingTypeStats() + { + return $this->finding_type_stats; + } + + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.FindingTypeStats finding_type_stats = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\FindingTypeStats>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFindingTypeStats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\FindingTypeStats::class); + $this->finding_type_stats = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsRequest.php new file mode 100644 index 00000000000..44485fffb63 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsRequest.php @@ -0,0 +1,205 @@ +google.cloud.websecurityscanner.v1.ListFindingsRequest + */ +class ListFindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @type string $filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsResponse.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsResponse.php new file mode 100644 index 00000000000..8adbe0f0cb9 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListFindingsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1.ListFindingsResponse + */ +class ListFindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.Finding findings = 1; + */ + private $findings; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\Finding>|\Google\Protobuf\Internal\RepeatedField $findings + * The list of Findings returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.Finding findings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFindings() + { + return $this->findings; + } + + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.Finding findings = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\Finding>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\Finding::class); + $this->findings = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsRequest.php new file mode 100644 index 00000000000..fdd69ae7994 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsRequest.php @@ -0,0 +1,155 @@ +google.cloud.websecurityscanner.v1.ListScanConfigsRequest + */ +class ListScanConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsResponse.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsResponse.php new file mode 100644 index 00000000000..4fe50cac7c9 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanConfigsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1.ListScanConfigsResponse + */ +class ListScanConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanConfig scan_configs = 1; + */ + private $scan_configs; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\ScanConfig>|\Google\Protobuf\Internal\RepeatedField $scan_configs + * The list of ScanConfigs returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanConfig scan_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScanConfigs() + { + return $this->scan_configs; + } + + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanConfig scan_configs = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\ScanConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScanConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\ScanConfig::class); + $this->scan_configs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsRequest.php new file mode 100644 index 00000000000..ad0f4a66754 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsRequest.php @@ -0,0 +1,155 @@ +google.cloud.websecurityscanner.v1.ListScanRunsRequest + */ +class ListScanRunsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1; + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsResponse.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsResponse.php new file mode 100644 index 00000000000..716f771565e --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ListScanRunsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1.ListScanRunsResponse + */ +class ListScanRunsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRun scan_runs = 1; + */ + private $scan_runs; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\ScanRun>|\Google\Protobuf\Internal\RepeatedField $scan_runs + * The list of ScanRuns returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRun scan_runs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScanRuns() + { + return $this->scan_runs; + } + + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRun scan_runs = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\ScanRun>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScanRuns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\ScanRun::class); + $this->scan_runs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/OutdatedLibrary.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/OutdatedLibrary.php new file mode 100644 index 00000000000..2ec473bc7ee --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/OutdatedLibrary.php @@ -0,0 +1,135 @@ +google.cloud.websecurityscanner.v1.OutdatedLibrary + */ +class OutdatedLibrary extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + */ + protected $library_name = ''; + /** + * The version number. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + */ + private $learn_more_urls; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $library_name + * The name of the outdated library. + * @type string $version + * The version number. + * @type array|\Google\Protobuf\Internal\RepeatedField $learn_more_urls + * URLs to learn more information about the vulnerabilities in the library. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + * @return string + */ + public function getLibraryName() + { + return $this->library_name; + } + + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + * @param string $var + * @return $this + */ + public function setLibraryName($var) + { + GPBUtil::checkString($var, True); + $this->library_name = $var; + + return $this; + } + + /** + * The version number. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version number. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLearnMoreUrls() + { + return $this->learn_more_urls; + } + + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLearnMoreUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->learn_more_urls = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig.php new file mode 100644 index 00000000000..2a96fcca040 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig.php @@ -0,0 +1,535 @@ +google.cloud.websecurityscanner.v1.ScanConfig + */ +class ScanConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + */ + protected $max_qps = 0; + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4; + */ + private $starting_urls; + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication authentication = 5; + */ + protected $authentication = null; + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.UserAgent user_agent = 6; + */ + protected $user_agent = 0; + /** + * The excluded URL patterns as described in + * https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + */ + private $blacklist_patterns; + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Schedule schedule = 8; + */ + protected $schedule = null; + /** + * Controls export of scan configurations and results to Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + */ + protected $export_to_security_command_center = 0; + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.RiskLevel risk_level = 12; + */ + protected $risk_level = 0; + /** + * Whether the scan config is managed by Web Security Scanner, output + * only. + * + * Generated from protobuf field bool managed_scan = 13; + */ + protected $managed_scan = false; + /** + * Whether the scan configuration has enabled static IP address scan feature. + * If enabled, the scanner will access applications from static IP addresses. + * + * Generated from protobuf field bool static_ip_scan = 14; + */ + protected $static_ip_scan = false; + /** + * Whether to keep scanning even if most requests return HTTP error codes. + * + * Generated from protobuf field bool ignore_http_status_errors = 15; + */ + protected $ignore_http_status_errors = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * @type string $display_name + * Required. The user provided display name of the ScanConfig. + * @type int $max_qps + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * @type array|\Google\Protobuf\Internal\RepeatedField $starting_urls + * Required. The starting URLs from which the scanner finds site pages. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication $authentication + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * @type int $user_agent + * The user agent used during scanning. + * @type array|\Google\Protobuf\Internal\RepeatedField $blacklist_patterns + * The excluded URL patterns as described in + * https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Schedule $schedule + * The schedule of the ScanConfig. + * @type int $export_to_security_command_center + * Controls export of scan configurations and results to Security + * Command Center. + * @type int $risk_level + * The risk level selected for the scan + * @type bool $managed_scan + * Whether the scan config is managed by Web Security Scanner, output + * only. + * @type bool $static_ip_scan + * Whether the scan configuration has enabled static IP address scan feature. + * If enabled, the scanner will access applications from static IP addresses. + * @type bool $ignore_http_status_errors + * Whether to keep scanning even if most requests return HTTP error codes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + * @return int + */ + public function getMaxQps() + { + return $this->max_qps; + } + + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + * @param int $var + * @return $this + */ + public function setMaxQps($var) + { + GPBUtil::checkInt32($var); + $this->max_qps = $var; + + return $this; + } + + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartingUrls() + { + return $this->starting_urls; + } + + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartingUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->starting_urls = $arr; + + return $this; + } + + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication authentication = 5; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication|null + */ + public function getAuthentication() + { + return $this->authentication; + } + + public function hasAuthentication() + { + return isset($this->authentication); + } + + public function clearAuthentication() + { + unset($this->authentication); + } + + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication authentication = 5; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication $var + * @return $this + */ + public function setAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication::class); + $this->authentication = $var; + + return $this; + } + + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.UserAgent user_agent = 6; + * @return int + */ + public function getUserAgent() + { + return $this->user_agent; + } + + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.UserAgent user_agent = 6; + * @param int $var + * @return $this + */ + public function setUserAgent($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\UserAgent::class); + $this->user_agent = $var; + + return $this; + } + + /** + * The excluded URL patterns as described in + * https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBlacklistPatterns() + { + return $this->blacklist_patterns; + } + + /** + * The excluded URL patterns as described in + * https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBlacklistPatterns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->blacklist_patterns = $arr; + + return $this; + } + + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Schedule schedule = 8; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Schedule|null + */ + public function getSchedule() + { + return $this->schedule; + } + + public function hasSchedule() + { + return isset($this->schedule); + } + + public function clearSchedule() + { + unset($this->schedule); + } + + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Schedule schedule = 8; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Schedule $var + * @return $this + */ + public function setSchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Schedule::class); + $this->schedule = $var; + + return $this; + } + + /** + * Controls export of scan configurations and results to Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + * @return int + */ + public function getExportToSecurityCommandCenter() + { + return $this->export_to_security_command_center; + } + + /** + * Controls export of scan configurations and results to Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + * @param int $var + * @return $this + */ + public function setExportToSecurityCommandCenter($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\ExportToSecurityCommandCenter::class); + $this->export_to_security_command_center = $var; + + return $this; + } + + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.RiskLevel risk_level = 12; + * @return int + */ + public function getRiskLevel() + { + return $this->risk_level; + } + + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.RiskLevel risk_level = 12; + * @param int $var + * @return $this + */ + public function setRiskLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\RiskLevel::class); + $this->risk_level = $var; + + return $this; + } + + /** + * Whether the scan config is managed by Web Security Scanner, output + * only. + * + * Generated from protobuf field bool managed_scan = 13; + * @return bool + */ + public function getManagedScan() + { + return $this->managed_scan; + } + + /** + * Whether the scan config is managed by Web Security Scanner, output + * only. + * + * Generated from protobuf field bool managed_scan = 13; + * @param bool $var + * @return $this + */ + public function setManagedScan($var) + { + GPBUtil::checkBool($var); + $this->managed_scan = $var; + + return $this; + } + + /** + * Whether the scan configuration has enabled static IP address scan feature. + * If enabled, the scanner will access applications from static IP addresses. + * + * Generated from protobuf field bool static_ip_scan = 14; + * @return bool + */ + public function getStaticIpScan() + { + return $this->static_ip_scan; + } + + /** + * Whether the scan configuration has enabled static IP address scan feature. + * If enabled, the scanner will access applications from static IP addresses. + * + * Generated from protobuf field bool static_ip_scan = 14; + * @param bool $var + * @return $this + */ + public function setStaticIpScan($var) + { + GPBUtil::checkBool($var); + $this->static_ip_scan = $var; + + return $this; + } + + /** + * Whether to keep scanning even if most requests return HTTP error codes. + * + * Generated from protobuf field bool ignore_http_status_errors = 15; + * @return bool + */ + public function getIgnoreHttpStatusErrors() + { + return $this->ignore_http_status_errors; + } + + /** + * Whether to keep scanning even if most requests return HTTP error codes. + * + * Generated from protobuf field bool ignore_http_status_errors = 15; + * @param bool $var + * @return $this + */ + public function setIgnoreHttpStatusErrors($var) + { + GPBUtil::checkBool($var); + $this->ignore_http_status_errors = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication.php new file mode 100644 index 00000000000..35fe4660708 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication.php @@ -0,0 +1,149 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Authentication + */ +class Authentication extends \Google\Protobuf\Internal\Message +{ + protected $authentication; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\GoogleAccount $google_account + * Authentication using a Google account. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\CustomAccount $custom_account + * Authentication using a custom account. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential $iap_credential + * Authentication using Identity-Aware-Proxy (IAP). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Authentication using a Google account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.GoogleAccount google_account = 1 [deprecated = true]; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\GoogleAccount|null + * @deprecated + */ + public function getGoogleAccount() + { + @trigger_error('google_account is deprecated.', E_USER_DEPRECATED); + return $this->readOneof(1); + } + + public function hasGoogleAccount() + { + @trigger_error('google_account is deprecated.', E_USER_DEPRECATED); + return $this->hasOneof(1); + } + + /** + * Authentication using a Google account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.GoogleAccount google_account = 1 [deprecated = true]; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\GoogleAccount $var + * @return $this + * @deprecated + */ + public function setGoogleAccount($var) + { + @trigger_error('google_account is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\GoogleAccount::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Authentication using a custom account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.CustomAccount custom_account = 2; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\CustomAccount|null + */ + public function getCustomAccount() + { + return $this->readOneof(2); + } + + public function hasCustomAccount() + { + return $this->hasOneof(2); + } + + /** + * Authentication using a custom account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.CustomAccount custom_account = 2; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\CustomAccount $var + * @return $this + */ + public function setCustomAccount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\CustomAccount::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Authentication using Identity-Aware-Proxy (IAP). + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential iap_credential = 4; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential|null + */ + public function getIapCredential() + { + return $this->readOneof(4); + } + + public function hasIapCredential() + { + return $this->hasOneof(4); + } + + /** + * Authentication using Identity-Aware-Proxy (IAP). + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential iap_credential = 4; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential $var + * @return $this + */ + public function setIapCredential($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthentication() + { + return $this->whichOneof("authentication"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Authentication::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Authentication::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/CustomAccount.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/CustomAccount.php new file mode 100644 index 00000000000..ab282fcb92a --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/CustomAccount.php @@ -0,0 +1,142 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Authentication.CustomAccount + */ +class CustomAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1; + */ + protected $username = ''; + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3; + */ + protected $login_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The user name of the custom account. + * @type string $password + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * @type string $login_url + * Required. The login form URL of the website. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3; + * @return string + */ + public function getLoginUrl() + { + return $this->login_url; + } + + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3; + * @param string $var + * @return $this + */ + public function setLoginUrl($var) + { + GPBUtil::checkString($var, True); + $this->login_url = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CustomAccount::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Authentication_CustomAccount::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/GoogleAccount.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/GoogleAccount.php new file mode 100644 index 00000000000..c6a369fd893 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/GoogleAccount.php @@ -0,0 +1,109 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Authentication.GoogleAccount + */ +class GoogleAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1; + */ + protected $username = ''; + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The user name of the Google account. + * @type string $password + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GoogleAccount::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Authentication_GoogleAccount::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential.php new file mode 100644 index 00000000000..3d92e0c8b96 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential.php @@ -0,0 +1,81 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential + */ +class IapCredential extends \Google\Protobuf\Internal\Message +{ + protected $iap_credentials; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential\IapTestServiceAccountInfo $iap_test_service_account_info + * Authentication configuration when Web-Security-Scanner service + * account is added in Identity-Aware-Proxy (IAP) access policies. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Authentication configuration when Web-Security-Scanner service + * account is added in Identity-Aware-Proxy (IAP) access policies. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo iap_test_service_account_info = 1; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential\IapTestServiceAccountInfo|null + */ + public function getIapTestServiceAccountInfo() + { + return $this->readOneof(1); + } + + public function hasIapTestServiceAccountInfo() + { + return $this->hasOneof(1); + } + + /** + * Authentication configuration when Web-Security-Scanner service + * account is added in Identity-Aware-Proxy (IAP) access policies. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo iap_test_service_account_info = 1; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential\IapTestServiceAccountInfo $var + * @return $this + */ + public function setIapTestServiceAccountInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig\Authentication\IapCredential\IapTestServiceAccountInfo::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getIapCredentials() + { + return $this->whichOneof("iap_credentials"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IapCredential::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Authentication_IapCredential::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential/IapTestServiceAccountInfo.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential/IapTestServiceAccountInfo.php new file mode 100644 index 00000000000..9863073c274 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Authentication/IapCredential/IapTestServiceAccountInfo.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo + */ +class IapTestServiceAccountInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Describes OAuth2 client id of resources protected by + * Identity-Aware-Proxy (IAP). + * + * Generated from protobuf field string target_audience_client_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $target_audience_client_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target_audience_client_id + * Required. Describes OAuth2 client id of resources protected by + * Identity-Aware-Proxy (IAP). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. Describes OAuth2 client id of resources protected by + * Identity-Aware-Proxy (IAP). + * + * Generated from protobuf field string target_audience_client_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTargetAudienceClientId() + { + return $this->target_audience_client_id; + } + + /** + * Required. Describes OAuth2 client id of resources protected by + * Identity-Aware-Proxy (IAP). + * + * Generated from protobuf field string target_audience_client_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTargetAudienceClientId($var) + { + GPBUtil::checkString($var, True); + $this->target_audience_client_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IapTestServiceAccountInfo::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Authentication_IapCredential_IapTestServiceAccountInfo::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/ExportToSecurityCommandCenter.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/ExportToSecurityCommandCenter.php new file mode 100644 index 00000000000..db64d6cda21 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/ExportToSecurityCommandCenter.php @@ -0,0 +1,65 @@ +google.cloud.websecurityscanner.v1.ScanConfig.ExportToSecurityCommandCenter + */ +class ExportToSecurityCommandCenter +{ + /** + * Use default, which is ENABLED. + * + * Generated from protobuf enum EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + */ + const EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + /** + * Export results of this scan to Security Command Center. + * + * Generated from protobuf enum ENABLED = 1; + */ + const ENABLED = 1; + /** + * Do not export results of this scan to Security Command Center. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + + private static $valueToName = [ + self::EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED => 'EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED', + self::ENABLED => 'ENABLED', + self::DISABLED => 'DISABLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExportToSecurityCommandCenter::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_ExportToSecurityCommandCenter::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/RiskLevel.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/RiskLevel.php new file mode 100644 index 00000000000..4cc650314a1 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/RiskLevel.php @@ -0,0 +1,66 @@ +google.cloud.websecurityscanner.v1.ScanConfig.RiskLevel + */ +class RiskLevel +{ + /** + * Use default, which is NORMAL. + * + * Generated from protobuf enum RISK_LEVEL_UNSPECIFIED = 0; + */ + const RISK_LEVEL_UNSPECIFIED = 0; + /** + * Normal scanning (Recommended) + * + * Generated from protobuf enum NORMAL = 1; + */ + const NORMAL = 1; + /** + * Lower impact scanning + * + * Generated from protobuf enum LOW = 2; + */ + const LOW = 2; + + private static $valueToName = [ + self::RISK_LEVEL_UNSPECIFIED => 'RISK_LEVEL_UNSPECIFIED', + self::NORMAL => 'NORMAL', + self::LOW => 'LOW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RiskLevel::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_RiskLevel::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Schedule.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Schedule.php new file mode 100644 index 00000000000..0f776ecc871 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/Schedule.php @@ -0,0 +1,126 @@ +google.cloud.websecurityscanner.v1.ScanConfig.Schedule + */ +class Schedule extends \Google\Protobuf\Internal\Message +{ + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + */ + protected $schedule_time = null; + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2; + */ + protected $interval_duration_days = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $schedule_time + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * @type int $interval_duration_days + * Required. The duration of time between executions in days. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getScheduleTime() + { + return $this->schedule_time; + } + + public function hasScheduleTime() + { + return isset($this->schedule_time); + } + + public function clearScheduleTime() + { + unset($this->schedule_time); + } + + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setScheduleTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->schedule_time = $var; + + return $this; + } + + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2; + * @return int + */ + public function getIntervalDurationDays() + { + return $this->interval_duration_days; + } + + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2; + * @param int $var + * @return $this + */ + public function setIntervalDurationDays($var) + { + GPBUtil::checkInt32($var); + $this->interval_duration_days = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Schedule::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_Schedule::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/UserAgent.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/UserAgent.php new file mode 100644 index 00000000000..46d0537dec3 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfig/UserAgent.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1.ScanConfig.UserAgent + */ +class UserAgent +{ + /** + * The user agent is unknown. Service will default to CHROME_LINUX. + * + * Generated from protobuf enum USER_AGENT_UNSPECIFIED = 0; + */ + const USER_AGENT_UNSPECIFIED = 0; + /** + * Chrome on Linux. This is the service default if unspecified. + * + * Generated from protobuf enum CHROME_LINUX = 1; + */ + const CHROME_LINUX = 1; + /** + * Chrome on Android. + * + * Generated from protobuf enum CHROME_ANDROID = 2; + */ + const CHROME_ANDROID = 2; + /** + * Safari on IPhone. + * + * Generated from protobuf enum SAFARI_IPHONE = 3; + */ + const SAFARI_IPHONE = 3; + + private static $valueToName = [ + self::USER_AGENT_UNSPECIFIED => 'USER_AGENT_UNSPECIFIED', + self::CHROME_LINUX => 'CHROME_LINUX', + self::CHROME_ANDROID => 'CHROME_ANDROID', + self::SAFARI_IPHONE => 'SAFARI_IPHONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserAgent::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfig_UserAgent::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError.php new file mode 100644 index 00000000000..f29dc04e669 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError.php @@ -0,0 +1,116 @@ +google.cloud.websecurityscanner.v1.ScanConfigError + */ +class ScanConfigError extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError.Code code = 1; + */ + protected $code = 0; + /** + * Output only. Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + */ + protected $field_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Output only. Indicates the reason code for a configuration failure. + * @type string $field_name + * Output only. Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanConfigError::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfigError\Code::class); + $this->code = $var; + + return $this; + } + + /** + * Output only. Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + * @return string + */ + public function getFieldName() + { + return $this->field_name; + } + + /** + * Output only. Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + * @param string $var + * @return $this + */ + public function setFieldName($var) + { + GPBUtil::checkString($var, True); + $this->field_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError/Code.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError/Code.php new file mode 100644 index 00000000000..1346f35f878 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanConfigError/Code.php @@ -0,0 +1,355 @@ +google.cloud.websecurityscanner.v1.ScanConfigError.Code + */ +class Code +{ + /** + * There is no error. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * There is no error. + * + * Generated from protobuf enum OK = 0; + */ + const OK = 0; + /** + * Indicates an internal server error. + * Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + * + * Generated from protobuf enum INTERNAL_ERROR = 1; + */ + const INTERNAL_ERROR = 1; + /** + * One of the seed URLs is an App Engine URL but we cannot validate the scan + * settings due to an App Engine API backend error. + * + * Generated from protobuf enum APPENGINE_API_BACKEND_ERROR = 2; + */ + const APPENGINE_API_BACKEND_ERROR = 2; + /** + * One of the seed URLs is an App Engine URL but we cannot access the + * App Engine API to validate scan settings. + * + * Generated from protobuf enum APPENGINE_API_NOT_ACCESSIBLE = 3; + */ + const APPENGINE_API_NOT_ACCESSIBLE = 3; + /** + * One of the seed URLs is an App Engine URL but the Default Host of the + * App Engine is not set. + * + * Generated from protobuf enum APPENGINE_DEFAULT_HOST_MISSING = 4; + */ + const APPENGINE_DEFAULT_HOST_MISSING = 4; + /** + * Google corporate accounts can not be used for scanning. + * + * Generated from protobuf enum CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + */ + const CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + /** + * The account of the scan creator can not be used for scanning. + * + * Generated from protobuf enum CANNOT_USE_OWNER_ACCOUNT = 7; + */ + const CANNOT_USE_OWNER_ACCOUNT = 7; + /** + * This scan targets Compute Engine, but we cannot validate scan settings + * due to a Compute Engine API backend error. + * + * Generated from protobuf enum COMPUTE_API_BACKEND_ERROR = 8; + */ + const COMPUTE_API_BACKEND_ERROR = 8; + /** + * This scan targets Compute Engine, but we cannot access the Compute Engine + * API to validate the scan settings. + * + * Generated from protobuf enum COMPUTE_API_NOT_ACCESSIBLE = 9; + */ + const COMPUTE_API_NOT_ACCESSIBLE = 9; + /** + * The Custom Login URL does not belong to the current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + */ + const CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + /** + * The Custom Login URL is malformed (can not be parsed). + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MALFORMED = 11; + */ + const CUSTOM_LOGIN_URL_MALFORMED = 11; + /** + * The Custom Login URL is mapped to a non-routable IP address in DNS. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + */ + const CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + /** + * The Custom Login URL is mapped to an IP address which is not reserved for + * the current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + */ + const CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + /** + * The Custom Login URL has a non-routable IP address. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + */ + const CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + /** + * The Custom Login URL has an IP address which is not reserved for the + * current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + */ + const CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + /** + * Another scan with the same name (case-sensitive) already exists. + * + * Generated from protobuf enum DUPLICATE_SCAN_NAME = 16; + */ + const DUPLICATE_SCAN_NAME = 16; + /** + * A field is set to an invalid value. + * + * Generated from protobuf enum INVALID_FIELD_VALUE = 18; + */ + const INVALID_FIELD_VALUE = 18; + /** + * There was an error trying to authenticate to the scan target. + * + * Generated from protobuf enum FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + */ + const FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + /** + * Finding type value is not specified in the list findings request. + * + * Generated from protobuf enum FINDING_TYPE_UNSPECIFIED = 20; + */ + const FINDING_TYPE_UNSPECIFIED = 20; + /** + * Scan targets Compute Engine, yet current project was not whitelisted for + * Google Compute Engine Scanning Alpha access. + * + * Generated from protobuf enum FORBIDDEN_TO_SCAN_COMPUTE = 21; + */ + const FORBIDDEN_TO_SCAN_COMPUTE = 21; + /** + * User tries to update managed scan + * + * Generated from protobuf enum FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + */ + const FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + /** + * The supplied filter is malformed. For example, it can not be parsed, does + * not have a filter type in expression, or the same filter type appears + * more than once. + * + * Generated from protobuf enum MALFORMED_FILTER = 22; + */ + const MALFORMED_FILTER = 22; + /** + * The supplied resource name is malformed (can not be parsed). + * + * Generated from protobuf enum MALFORMED_RESOURCE_NAME = 23; + */ + const MALFORMED_RESOURCE_NAME = 23; + /** + * The current project is not in an active state. + * + * Generated from protobuf enum PROJECT_INACTIVE = 24; + */ + const PROJECT_INACTIVE = 24; + /** + * A required field is not set. + * + * Generated from protobuf enum REQUIRED_FIELD = 25; + */ + const REQUIRED_FIELD = 25; + /** + * Project id, scanconfig id, scanrun id, or finding id are not consistent + * with each other in resource name. + * + * Generated from protobuf enum RESOURCE_NAME_INCONSISTENT = 26; + */ + const RESOURCE_NAME_INCONSISTENT = 26; + /** + * The scan being requested to start is already running. + * + * Generated from protobuf enum SCAN_ALREADY_RUNNING = 27; + */ + const SCAN_ALREADY_RUNNING = 27; + /** + * The scan that was requested to be stopped is not running. + * + * Generated from protobuf enum SCAN_NOT_RUNNING = 28; + */ + const SCAN_NOT_RUNNING = 28; + /** + * One of the seed URLs does not belong to the current project. + * + * Generated from protobuf enum SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + */ + const SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + /** + * One of the seed URLs is malformed (can not be parsed). + * + * Generated from protobuf enum SEED_URL_MALFORMED = 30; + */ + const SEED_URL_MALFORMED = 30; + /** + * One of the seed URLs is mapped to a non-routable IP address in DNS. + * + * Generated from protobuf enum SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + */ + const SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + /** + * One of the seed URLs is mapped to an IP address which is not reserved + * for the current project. + * + * Generated from protobuf enum SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + */ + const SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + /** + * One of the seed URLs has on-routable IP address. + * + * Generated from protobuf enum SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + */ + const SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + /** + * One of the seed URLs has an IP address that is not reserved + * for the current project. + * + * Generated from protobuf enum SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + */ + const SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + /** + * The Web Security Scanner service account is not configured under the + * project. + * + * Generated from protobuf enum SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + */ + const SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + /** + * A project has reached the maximum number of scans. + * + * Generated from protobuf enum TOO_MANY_SCANS = 37; + */ + const TOO_MANY_SCANS = 37; + /** + * Resolving the details of the current project fails. + * + * Generated from protobuf enum UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + */ + const UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + /** + * One or more blacklist patterns were in the wrong format. + * + * Generated from protobuf enum UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + */ + const UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + /** + * The supplied filter is not supported. + * + * Generated from protobuf enum UNSUPPORTED_FILTER = 40; + */ + const UNSUPPORTED_FILTER = 40; + /** + * The supplied finding type is not supported. For example, we do not + * provide findings of the given finding type. + * + * Generated from protobuf enum UNSUPPORTED_FINDING_TYPE = 41; + */ + const UNSUPPORTED_FINDING_TYPE = 41; + /** + * The URL scheme of one or more of the supplied URLs is not supported. + * + * Generated from protobuf enum UNSUPPORTED_URL_SCHEME = 42; + */ + const UNSUPPORTED_URL_SCHEME = 42; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::OK => 'OK', + self::INTERNAL_ERROR => 'INTERNAL_ERROR', + self::APPENGINE_API_BACKEND_ERROR => 'APPENGINE_API_BACKEND_ERROR', + self::APPENGINE_API_NOT_ACCESSIBLE => 'APPENGINE_API_NOT_ACCESSIBLE', + self::APPENGINE_DEFAULT_HOST_MISSING => 'APPENGINE_DEFAULT_HOST_MISSING', + self::CANNOT_USE_GOOGLE_COM_ACCOUNT => 'CANNOT_USE_GOOGLE_COM_ACCOUNT', + self::CANNOT_USE_OWNER_ACCOUNT => 'CANNOT_USE_OWNER_ACCOUNT', + self::COMPUTE_API_BACKEND_ERROR => 'COMPUTE_API_BACKEND_ERROR', + self::COMPUTE_API_NOT_ACCESSIBLE => 'COMPUTE_API_NOT_ACCESSIBLE', + self::CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT => 'CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT', + self::CUSTOM_LOGIN_URL_MALFORMED => 'CUSTOM_LOGIN_URL_MALFORMED', + self::CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS => 'CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS', + self::CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS => 'CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS', + self::CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS => 'CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS', + self::CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS => 'CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS', + self::DUPLICATE_SCAN_NAME => 'DUPLICATE_SCAN_NAME', + self::INVALID_FIELD_VALUE => 'INVALID_FIELD_VALUE', + self::FAILED_TO_AUTHENTICATE_TO_TARGET => 'FAILED_TO_AUTHENTICATE_TO_TARGET', + self::FINDING_TYPE_UNSPECIFIED => 'FINDING_TYPE_UNSPECIFIED', + self::FORBIDDEN_TO_SCAN_COMPUTE => 'FORBIDDEN_TO_SCAN_COMPUTE', + self::FORBIDDEN_UPDATE_TO_MANAGED_SCAN => 'FORBIDDEN_UPDATE_TO_MANAGED_SCAN', + self::MALFORMED_FILTER => 'MALFORMED_FILTER', + self::MALFORMED_RESOURCE_NAME => 'MALFORMED_RESOURCE_NAME', + self::PROJECT_INACTIVE => 'PROJECT_INACTIVE', + self::REQUIRED_FIELD => 'REQUIRED_FIELD', + self::RESOURCE_NAME_INCONSISTENT => 'RESOURCE_NAME_INCONSISTENT', + self::SCAN_ALREADY_RUNNING => 'SCAN_ALREADY_RUNNING', + self::SCAN_NOT_RUNNING => 'SCAN_NOT_RUNNING', + self::SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT => 'SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT', + self::SEED_URL_MALFORMED => 'SEED_URL_MALFORMED', + self::SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS => 'SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS', + self::SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS => 'SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS', + self::SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS => 'SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS', + self::SEED_URL_HAS_UNRESERVED_IP_ADDRESS => 'SEED_URL_HAS_UNRESERVED_IP_ADDRESS', + self::SERVICE_ACCOUNT_NOT_CONFIGURED => 'SERVICE_ACCOUNT_NOT_CONFIGURED', + self::TOO_MANY_SCANS => 'TOO_MANY_SCANS', + self::UNABLE_TO_RESOLVE_PROJECT_INFO => 'UNABLE_TO_RESOLVE_PROJECT_INFO', + self::UNSUPPORTED_BLACKLIST_PATTERN_FORMAT => 'UNSUPPORTED_BLACKLIST_PATTERN_FORMAT', + self::UNSUPPORTED_FILTER => 'UNSUPPORTED_FILTER', + self::UNSUPPORTED_FINDING_TYPE => 'UNSUPPORTED_FINDING_TYPE', + self::UNSUPPORTED_URL_SCHEME => 'UNSUPPORTED_URL_SCHEME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1\ScanConfigError_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun.php new file mode 100644 index 00000000000..ff25c1ee8cb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun.php @@ -0,0 +1,486 @@ +google.cloud.websecurityscanner.v1.ScanRun + */ +class ScanRun extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 2; + */ + protected $execution_state = 0; + /** + * Output only. The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 3; + */ + protected $result_state = 0; + /** + * Output only. The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + */ + protected $start_time = null; + /** + * Output only. The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + */ + protected $end_time = null; + /** + * Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + */ + protected $urls_crawled_count = 0; + /** + * Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + */ + protected $urls_tested_count = 0; + /** + * Output only. Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + */ + protected $has_vulnerabilities = false; + /** + * Output only. The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + */ + protected $progress_percent = 0; + /** + * Output only. If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 10; + */ + protected $error_trace = null; + /** + * Output only. A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRunWarningTrace warning_traces = 11; + */ + private $warning_traces; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * @type int $execution_state + * Output only. The execution state of the ScanRun. + * @type int $result_state + * Output only. The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time at which the ScanRun started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * @type int|string $urls_crawled_count + * Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * @type int|string $urls_tested_count + * Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * @type bool $has_vulnerabilities + * Output only. Whether the scan run has found any vulnerabilities. + * @type int $progress_percent + * Output only. The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace $error_trace + * Output only. If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * @type array<\Google\Cloud\WebSecurityScanner\V1\ScanRunWarningTrace>|\Google\Protobuf\Internal\RepeatedField $warning_traces + * Output only. A list of warnings, if such are encountered during this scan run. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanRun::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 2; + * @return int + */ + public function getExecutionState() + { + return $this->execution_state; + } + + /** + * Output only. The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 2; + * @param int $var + * @return $this + */ + public function setExecutionState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRun\ExecutionState::class); + $this->execution_state = $var; + + return $this; + } + + /** + * Output only. The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 3; + * @return int + */ + public function getResultState() + { + return $this->result_state; + } + + /** + * Output only. The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 3; + * @param int $var + * @return $this + */ + public function setResultState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRun\ResultState::class); + $this->result_state = $var; + + return $this; + } + + /** + * Output only. The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + * @return int|string + */ + public function getUrlsCrawledCount() + { + return $this->urls_crawled_count; + } + + /** + * Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + * @param int|string $var + * @return $this + */ + public function setUrlsCrawledCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_crawled_count = $var; + + return $this; + } + + /** + * Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + * @return int|string + */ + public function getUrlsTestedCount() + { + return $this->urls_tested_count; + } + + /** + * Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + * @param int|string $var + * @return $this + */ + public function setUrlsTestedCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_tested_count = $var; + + return $this; + } + + /** + * Output only. Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + * @return bool + */ + public function getHasVulnerabilities() + { + return $this->has_vulnerabilities; + } + + /** + * Output only. Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + * @param bool $var + * @return $this + */ + public function setHasVulnerabilities($var) + { + GPBUtil::checkBool($var); + $this->has_vulnerabilities = $var; + + return $this; + } + + /** + * Output only. The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Output only. The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Output only. If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 10; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace|null + */ + public function getErrorTrace() + { + return $this->error_trace; + } + + public function hasErrorTrace() + { + return isset($this->error_trace); + } + + public function clearErrorTrace() + { + unset($this->error_trace); + } + + /** + * Output only. If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 10; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace $var + * @return $this + */ + public function setErrorTrace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace::class); + $this->error_trace = $var; + + return $this; + } + + /** + * Output only. A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRunWarningTrace warning_traces = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWarningTraces() + { + return $this->warning_traces; + } + + /** + * Output only. A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.ScanRunWarningTrace warning_traces = 11; + * @param array<\Google\Cloud\WebSecurityScanner\V1\ScanRunWarningTrace>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWarningTraces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\ScanRunWarningTrace::class); + $this->warning_traces = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ExecutionState.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ExecutionState.php new file mode 100644 index 00000000000..3667287981a --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ExecutionState.php @@ -0,0 +1,72 @@ +google.cloud.websecurityscanner.v1.ScanRun.ExecutionState + */ +class ExecutionState +{ + /** + * Represents an invalid state caused by internal server error. This value + * should never be returned. + * + * Generated from protobuf enum EXECUTION_STATE_UNSPECIFIED = 0; + */ + const EXECUTION_STATE_UNSPECIFIED = 0; + /** + * The scan is waiting in the queue. + * + * Generated from protobuf enum QUEUED = 1; + */ + const QUEUED = 1; + /** + * The scan is in progress. + * + * Generated from protobuf enum SCANNING = 2; + */ + const SCANNING = 2; + /** + * The scan is either finished or stopped by user. + * + * Generated from protobuf enum FINISHED = 3; + */ + const FINISHED = 3; + + private static $valueToName = [ + self::EXECUTION_STATE_UNSPECIFIED => 'EXECUTION_STATE_UNSPECIFIED', + self::QUEUED => 'QUEUED', + self::SCANNING => 'SCANNING', + self::FINISHED => 'FINISHED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExecutionState::class, \Google\Cloud\WebSecurityScanner\V1\ScanRun_ExecutionState::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ResultState.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ResultState.php new file mode 100644 index 00000000000..1d961ad419f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRun/ResultState.php @@ -0,0 +1,72 @@ +google.cloud.websecurityscanner.v1.ScanRun.ResultState + */ +class ResultState +{ + /** + * Default value. This value is returned when the ScanRun is not yet + * finished. + * + * Generated from protobuf enum RESULT_STATE_UNSPECIFIED = 0; + */ + const RESULT_STATE_UNSPECIFIED = 0; + /** + * The scan finished without errors. + * + * Generated from protobuf enum SUCCESS = 1; + */ + const SUCCESS = 1; + /** + * The scan finished with errors. + * + * Generated from protobuf enum ERROR = 2; + */ + const ERROR = 2; + /** + * The scan was terminated by user. + * + * Generated from protobuf enum KILLED = 3; + */ + const KILLED = 3; + + private static $valueToName = [ + self::RESULT_STATE_UNSPECIFIED => 'RESULT_STATE_UNSPECIFIED', + self::SUCCESS => 'SUCCESS', + self::ERROR => 'ERROR', + self::KILLED => 'KILLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResultState::class, \Google\Cloud\WebSecurityScanner\V1\ScanRun_ResultState::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace.php new file mode 100644 index 00000000000..688868b5b24 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace.php @@ -0,0 +1,162 @@ +google.cloud.websecurityscanner.v1.ScanRunErrorTrace + */ +class ScanRunErrorTrace extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace.Code code = 1; + */ + protected $code = 0; + /** + * Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError scan_config_error = 2; + */ + protected $scan_config_error = null; + /** + * Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + */ + protected $most_common_http_error_code = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Output only. Indicates the error reason code. + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfigError $scan_config_error + * Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * @type int $most_common_http_error_code + * Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanRunErrorTrace::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace\Code::class); + $this->code = $var; + + return $this; + } + + /** + * Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError scan_config_error = 2; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfigError|null + */ + public function getScanConfigError() + { + return $this->scan_config_error; + } + + public function hasScanConfigError() + { + return isset($this->scan_config_error); + } + + public function clearScanConfigError() + { + unset($this->scan_config_error); + } + + /** + * Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfigError scan_config_error = 2; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfigError $var + * @return $this + */ + public function setScanConfigError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfigError::class); + $this->scan_config_error = $var; + + return $this; + } + + /** + * Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + * @return int + */ + public function getMostCommonHttpErrorCode() + { + return $this->most_common_http_error_code; + } + + /** + * Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + * @param int $var + * @return $this + */ + public function setMostCommonHttpErrorCode($var) + { + GPBUtil::checkInt32($var); + $this->most_common_http_error_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace/Code.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace/Code.php new file mode 100644 index 00000000000..c49b3a0f42b --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunErrorTrace/Code.php @@ -0,0 +1,99 @@ +google.cloud.websecurityscanner.v1.ScanRunErrorTrace.Code + */ +class Code +{ + /** + * Default value is never used. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * Indicates that the scan run failed due to an internal server error. + * + * Generated from protobuf enum INTERNAL_ERROR = 1; + */ + const INTERNAL_ERROR = 1; + /** + * Indicates a scan configuration error, usually due to outdated ScanConfig + * settings, such as starting_urls or the DNS configuration. + * + * Generated from protobuf enum SCAN_CONFIG_ISSUE = 2; + */ + const SCAN_CONFIG_ISSUE = 2; + /** + * Indicates an authentication error, usually due to outdated ScanConfig + * authentication settings. + * + * Generated from protobuf enum AUTHENTICATION_CONFIG_ISSUE = 3; + */ + const AUTHENTICATION_CONFIG_ISSUE = 3; + /** + * Indicates a scan operation timeout, usually caused by a very large site. + * + * Generated from protobuf enum TIMED_OUT_WHILE_SCANNING = 4; + */ + const TIMED_OUT_WHILE_SCANNING = 4; + /** + * Indicates that a scan encountered excessive redirects, either to + * authentication or some other page outside of the scan scope. + * + * Generated from protobuf enum TOO_MANY_REDIRECTS = 5; + */ + const TOO_MANY_REDIRECTS = 5; + /** + * Indicates that a scan encountered numerous errors from the web site + * pages. When available, most_common_http_error_code field indicates the + * most common HTTP error code encountered during the scan. + * + * Generated from protobuf enum TOO_MANY_HTTP_ERRORS = 6; + */ + const TOO_MANY_HTTP_ERRORS = 6; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::INTERNAL_ERROR => 'INTERNAL_ERROR', + self::SCAN_CONFIG_ISSUE => 'SCAN_CONFIG_ISSUE', + self::AUTHENTICATION_CONFIG_ISSUE => 'AUTHENTICATION_CONFIG_ISSUE', + self::TIMED_OUT_WHILE_SCANNING => 'TIMED_OUT_WHILE_SCANNING', + self::TOO_MANY_REDIRECTS => 'TOO_MANY_REDIRECTS', + self::TOO_MANY_HTTP_ERRORS => 'TOO_MANY_HTTP_ERRORS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunLog.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunLog.php new file mode 100644 index 00000000000..6b90901c995 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunLog.php @@ -0,0 +1,291 @@ +google.cloud.websecurityscanner.v1.ScanRunLog + */ +class ScanRunLog extends \Google\Protobuf\Internal\Message +{ + /** + * Human friendly message about the event. + * + * Generated from protobuf field string summary = 1; + */ + protected $summary = ''; + /** + * The resource name of the ScanRun being logged. + * + * Generated from protobuf field string name = 2; + */ + protected $name = ''; + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 3; + */ + protected $execution_state = 0; + /** + * The result state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 4; + */ + protected $result_state = 0; + /** + * Generated from protobuf field int64 urls_crawled_count = 5; + */ + protected $urls_crawled_count = 0; + /** + * Generated from protobuf field int64 urls_tested_count = 6; + */ + protected $urls_tested_count = 0; + /** + * Generated from protobuf field bool has_findings = 7; + */ + protected $has_findings = false; + /** + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 8; + */ + protected $error_trace = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $summary + * Human friendly message about the event. + * @type string $name + * The resource name of the ScanRun being logged. + * @type int $execution_state + * The execution state of the ScanRun. + * @type int $result_state + * The result state of the ScanRun. + * @type int|string $urls_crawled_count + * @type int|string $urls_tested_count + * @type bool $has_findings + * @type \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace $error_trace + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanRunLog::initOnce(); + parent::__construct($data); + } + + /** + * Human friendly message about the event. + * + * Generated from protobuf field string summary = 1; + * @return string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * Human friendly message about the event. + * + * Generated from protobuf field string summary = 1; + * @param string $var + * @return $this + */ + public function setSummary($var) + { + GPBUtil::checkString($var, True); + $this->summary = $var; + + return $this; + } + + /** + * The resource name of the ScanRun being logged. + * + * Generated from protobuf field string name = 2; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ScanRun being logged. + * + * Generated from protobuf field string name = 2; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 3; + * @return int + */ + public function getExecutionState() + { + return $this->execution_state; + } + + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ExecutionState execution_state = 3; + * @param int $var + * @return $this + */ + public function setExecutionState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRun\ExecutionState::class); + $this->execution_state = $var; + + return $this; + } + + /** + * The result state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 4; + * @return int + */ + public function getResultState() + { + return $this->result_state; + } + + /** + * The result state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRun.ResultState result_state = 4; + * @param int $var + * @return $this + */ + public function setResultState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRun\ResultState::class); + $this->result_state = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 urls_crawled_count = 5; + * @return int|string + */ + public function getUrlsCrawledCount() + { + return $this->urls_crawled_count; + } + + /** + * Generated from protobuf field int64 urls_crawled_count = 5; + * @param int|string $var + * @return $this + */ + public function setUrlsCrawledCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_crawled_count = $var; + + return $this; + } + + /** + * Generated from protobuf field int64 urls_tested_count = 6; + * @return int|string + */ + public function getUrlsTestedCount() + { + return $this->urls_tested_count; + } + + /** + * Generated from protobuf field int64 urls_tested_count = 6; + * @param int|string $var + * @return $this + */ + public function setUrlsTestedCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_tested_count = $var; + + return $this; + } + + /** + * Generated from protobuf field bool has_findings = 7; + * @return bool + */ + public function getHasFindings() + { + return $this->has_findings; + } + + /** + * Generated from protobuf field bool has_findings = 7; + * @param bool $var + * @return $this + */ + public function setHasFindings($var) + { + GPBUtil::checkBool($var); + $this->has_findings = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 8; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace|null + */ + public function getErrorTrace() + { + return $this->error_trace; + } + + public function hasErrorTrace() + { + return isset($this->error_trace); + } + + public function clearErrorTrace() + { + unset($this->error_trace); + } + + /** + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunErrorTrace error_trace = 8; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace $var + * @return $this + */ + public function setErrorTrace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanRunErrorTrace::class); + $this->error_trace = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace.php new file mode 100644 index 00000000000..88301882093 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace.php @@ -0,0 +1,69 @@ +google.cloud.websecurityscanner.v1.ScanRunWarningTrace + */ +class ScanRunWarningTrace extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunWarningTrace.Code code = 1; + */ + protected $code = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Output only. Indicates the warning code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\ScanRunWarningTrace::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunWarningTrace.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanRunWarningTrace.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\ScanRunWarningTrace\Code::class); + $this->code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace/Code.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace/Code.php new file mode 100644 index 00000000000..cd610f6f648 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ScanRunWarningTrace/Code.php @@ -0,0 +1,92 @@ +google.cloud.websecurityscanner.v1.ScanRunWarningTrace.Code + */ +class Code +{ + /** + * Default value is never used. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * Indicates that a scan discovered an unexpectedly low number of URLs. This + * is sometimes caused by complex navigation features or by using a single + * URL for numerous pages. + * + * Generated from protobuf enum INSUFFICIENT_CRAWL_RESULTS = 1; + */ + const INSUFFICIENT_CRAWL_RESULTS = 1; + /** + * Indicates that a scan discovered too many URLs to test, or excessive + * redundant URLs. + * + * Generated from protobuf enum TOO_MANY_CRAWL_RESULTS = 2; + */ + const TOO_MANY_CRAWL_RESULTS = 2; + /** + * Indicates that too many tests have been generated for the scan. Customer + * should try reducing the number of starting URLs, increasing the QPS rate, + * or narrowing down the scope of the scan using the excluded patterns. + * + * Generated from protobuf enum TOO_MANY_FUZZ_TASKS = 3; + */ + const TOO_MANY_FUZZ_TASKS = 3; + /** + * Indicates that a scan is blocked by IAP. + * + * Generated from protobuf enum BLOCKED_BY_IAP = 4; + */ + const BLOCKED_BY_IAP = 4; + /** + * Indicates that no seeds is found for a scan + * + * Generated from protobuf enum NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN = 5; + */ + const NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN = 5; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::INSUFFICIENT_CRAWL_RESULTS => 'INSUFFICIENT_CRAWL_RESULTS', + self::TOO_MANY_CRAWL_RESULTS => 'TOO_MANY_CRAWL_RESULTS', + self::TOO_MANY_FUZZ_TASKS => 'TOO_MANY_FUZZ_TASKS', + self::BLOCKED_BY_IAP => 'BLOCKED_BY_IAP', + self::NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN => 'NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1\ScanRunWarningTrace_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StartScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StartScanRunRequest.php new file mode 100644 index 00000000000..ac00aa43db7 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StartScanRunRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1.StartScanRunRequest + */ +class StartScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StopScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StopScanRunRequest.php new file mode 100644 index 00000000000..cb81353bba7 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/StopScanRunRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1.StopScanRunRequest + */ +class StopScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/UpdateScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/UpdateScanConfigRequest.php new file mode 100644 index 00000000000..3037cef7bbc --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/UpdateScanConfigRequest.php @@ -0,0 +1,137 @@ +google.cloud.websecurityscanner.v1.UpdateScanConfigRequest + */ +class UpdateScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + */ + protected $scan_config = null; + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + */ + protected $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebSecurityScanner\V1\ScanConfig $scan_config + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + * @return \Google\Cloud\WebSecurityScanner\V1\ScanConfig|null + */ + public function getScanConfig() + { + return $this->scan_config; + } + + public function hasScanConfig() + { + return isset($this->scan_config); + } + + public function clearScanConfig() + { + unset($this->scan_config); + } + + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.ScanConfig scan_config = 2; + * @param \Google\Cloud\WebSecurityScanner\V1\ScanConfig $var + * @return $this + */ + public function setScanConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1\ScanConfig::class); + $this->scan_config = $var; + + return $this; + } + + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ViolatingResource.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ViolatingResource.php new file mode 100644 index 00000000000..a04f097a8d6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/ViolatingResource.php @@ -0,0 +1,102 @@ +google.cloud.websecurityscanner.v1.ViolatingResource + */ +class ViolatingResource extends \Google\Protobuf\Internal\Message +{ + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + */ + protected $content_type = ''; + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + */ + protected $resource_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content_type + * The MIME type of this resource. + * @type string $resource_url + * URL of this violating resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + * @return string + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + * @param string $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkString($var, True); + $this->content_type = $var; + + return $this; + } + + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + * @return string + */ + public function getResourceUrl() + { + return $this->resource_url; + } + + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + * @param string $var + * @return $this + */ + public function setResourceUrl($var) + { + GPBUtil::checkString($var, True); + $this->resource_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders.php new file mode 100644 index 00000000000..2410d3d26d0 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders.php @@ -0,0 +1,101 @@ +google.cloud.websecurityscanner.v1.VulnerableHeaders + */ +class VulnerableHeaders extends \Google\Protobuf\Internal\Message +{ + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header headers = 1; + */ + private $headers; + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header missing_headers = 2; + */ + private $missing_headers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $headers + * List of vulnerable headers. + * @type array<\Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $missing_headers + * List of missing headers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header headers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header headers = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header::class); + $this->headers = $arr; + + return $this; + } + + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header missing_headers = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMissingHeaders() + { + return $this->missing_headers; + } + + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1.VulnerableHeaders.Header missing_headers = 2; + * @param array<\Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMissingHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders\Header::class); + $this->missing_headers = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders/Header.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders/Header.php new file mode 100644 index 00000000000..d50f7cefc51 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableHeaders/Header.php @@ -0,0 +1,104 @@ +google.cloud.websecurityscanner.v1.VulnerableHeaders.Header + */ +class Header extends \Google\Protobuf\Internal\Message +{ + /** + * Header name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Header value. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Header name. + * @type string $value + * Header value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * Header name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Header name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Header value. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Header value. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Header::class, \Google\Cloud\WebSecurityScanner\V1\VulnerableHeaders_Header::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableParameters.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableParameters.php new file mode 100644 index 00000000000..f6f79dc863a --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/VulnerableParameters.php @@ -0,0 +1,67 @@ +google.cloud.websecurityscanner.v1.VulnerableParameters + */ +class VulnerableParameters extends \Google\Protobuf\Internal\Message +{ + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + */ + private $parameter_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $parameter_names + * The vulnerable parameter names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameterNames() + { + return $this->parameter_names; + } + + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameterNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->parameter_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss.php new file mode 100644 index 00000000000..b3be341c0a1 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss.php @@ -0,0 +1,169 @@ +google.cloud.websecurityscanner.v1.Xss + */ +class Xss extends \Google\Protobuf\Internal\Message +{ + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + */ + private $stack_traces; + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + */ + protected $error_message = ''; + /** + * The attack vector of the payload triggering this XSS. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss.AttackVector attack_vector = 3; + */ + protected $attack_vector = 0; + /** + * The reproduction url for the seeding POST request of a Stored XSS. + * + * Generated from protobuf field string stored_xss_seeding_url = 4; + */ + protected $stored_xss_seeding_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $stack_traces + * Stack traces leading to the point where the XSS occurred. + * @type string $error_message + * An error message generated by a javascript breakage. + * @type int $attack_vector + * The attack vector of the payload triggering this XSS. + * @type string $stored_xss_seeding_url + * The reproduction url for the seeding POST request of a Stored XSS. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStackTraces() + { + return $this->stack_traces; + } + + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStackTraces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->stack_traces = $arr; + + return $this; + } + + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + + /** + * The attack vector of the payload triggering this XSS. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss.AttackVector attack_vector = 3; + * @return int + */ + public function getAttackVector() + { + return $this->attack_vector; + } + + /** + * The attack vector of the payload triggering this XSS. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xss.AttackVector attack_vector = 3; + * @param int $var + * @return $this + */ + public function setAttackVector($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\Xss\AttackVector::class); + $this->attack_vector = $var; + + return $this; + } + + /** + * The reproduction url for the seeding POST request of a Stored XSS. + * + * Generated from protobuf field string stored_xss_seeding_url = 4; + * @return string + */ + public function getStoredXssSeedingUrl() + { + return $this->stored_xss_seeding_url; + } + + /** + * The reproduction url for the seeding POST request of a Stored XSS. + * + * Generated from protobuf field string stored_xss_seeding_url = 4; + * @param string $var + * @return $this + */ + public function setStoredXssSeedingUrl($var) + { + GPBUtil::checkString($var, True); + $this->stored_xss_seeding_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss/AttackVector.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss/AttackVector.php new file mode 100644 index 00000000000..3f1a432eee4 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xss/AttackVector.php @@ -0,0 +1,156 @@ +google.cloud.websecurityscanner.v1.Xss.AttackVector + */ +class AttackVector +{ + /** + * Unknown attack vector. + * + * Generated from protobuf enum ATTACK_VECTOR_UNSPECIFIED = 0; + */ + const ATTACK_VECTOR_UNSPECIFIED = 0; + /** + * The attack comes from fuzzing the browser's localStorage. + * + * Generated from protobuf enum LOCAL_STORAGE = 1; + */ + const LOCAL_STORAGE = 1; + /** + * The attack comes from fuzzing the browser's sessionStorage. + * + * Generated from protobuf enum SESSION_STORAGE = 2; + */ + const SESSION_STORAGE = 2; + /** + * The attack comes from fuzzing the window's name property. + * + * Generated from protobuf enum WINDOW_NAME = 3; + */ + const WINDOW_NAME = 3; + /** + * The attack comes from fuzzing the referrer property. + * + * Generated from protobuf enum REFERRER = 4; + */ + const REFERRER = 4; + /** + * The attack comes from fuzzing an input element. + * + * Generated from protobuf enum FORM_INPUT = 5; + */ + const FORM_INPUT = 5; + /** + * The attack comes from fuzzing the browser's cookies. + * + * Generated from protobuf enum COOKIE = 6; + */ + const COOKIE = 6; + /** + * The attack comes from hijacking the post messaging mechanism. + * + * Generated from protobuf enum POST_MESSAGE = 7; + */ + const POST_MESSAGE = 7; + /** + * The attack comes from fuzzing parameters in the url. + * + * Generated from protobuf enum GET_PARAMETERS = 8; + */ + const GET_PARAMETERS = 8; + /** + * The attack comes from fuzzing the fragment in the url. + * + * Generated from protobuf enum URL_FRAGMENT = 9; + */ + const URL_FRAGMENT = 9; + /** + * The attack comes from fuzzing the HTML comments. + * + * Generated from protobuf enum HTML_COMMENT = 10; + */ + const HTML_COMMENT = 10; + /** + * The attack comes from fuzzing the POST parameters. + * + * Generated from protobuf enum POST_PARAMETERS = 11; + */ + const POST_PARAMETERS = 11; + /** + * The attack comes from fuzzing the protocol. + * + * Generated from protobuf enum PROTOCOL = 12; + */ + const PROTOCOL = 12; + /** + * The attack comes from the server side and is stored. + * + * Generated from protobuf enum STORED_XSS = 13; + */ + const STORED_XSS = 13; + /** + * The attack is a Same-Origin Method Execution attack via a GET parameter. + * + * Generated from protobuf enum SAME_ORIGIN = 14; + */ + const SAME_ORIGIN = 14; + /** + * The attack payload is received from a third-party host via a URL that is + * user-controllable + * + * Generated from protobuf enum USER_CONTROLLABLE_URL = 15; + */ + const USER_CONTROLLABLE_URL = 15; + + private static $valueToName = [ + self::ATTACK_VECTOR_UNSPECIFIED => 'ATTACK_VECTOR_UNSPECIFIED', + self::LOCAL_STORAGE => 'LOCAL_STORAGE', + self::SESSION_STORAGE => 'SESSION_STORAGE', + self::WINDOW_NAME => 'WINDOW_NAME', + self::REFERRER => 'REFERRER', + self::FORM_INPUT => 'FORM_INPUT', + self::COOKIE => 'COOKIE', + self::POST_MESSAGE => 'POST_MESSAGE', + self::GET_PARAMETERS => 'GET_PARAMETERS', + self::URL_FRAGMENT => 'URL_FRAGMENT', + self::HTML_COMMENT => 'HTML_COMMENT', + self::POST_PARAMETERS => 'POST_PARAMETERS', + self::PROTOCOL => 'PROTOCOL', + self::STORED_XSS => 'STORED_XSS', + self::SAME_ORIGIN => 'SAME_ORIGIN', + self::USER_CONTROLLABLE_URL => 'USER_CONTROLLABLE_URL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AttackVector::class, \Google\Cloud\WebSecurityScanner\V1\Xss_AttackVector::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe.php new file mode 100644 index 00000000000..55b9f3fd0de --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1.Xxe + */ +class Xxe extends \Google\Protobuf\Internal\Message +{ + /** + * The XML string that triggered the XXE vulnerability. Non-payload values + * might be redacted. + * + * Generated from protobuf field string payload_value = 1; + */ + protected $payload_value = ''; + /** + * Location within the request where the payload was placed. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe.Location payload_location = 2; + */ + protected $payload_location = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $payload_value + * The XML string that triggered the XXE vulnerability. Non-payload values + * might be redacted. + * @type int $payload_location + * Location within the request where the payload was placed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The XML string that triggered the XXE vulnerability. Non-payload values + * might be redacted. + * + * Generated from protobuf field string payload_value = 1; + * @return string + */ + public function getPayloadValue() + { + return $this->payload_value; + } + + /** + * The XML string that triggered the XXE vulnerability. Non-payload values + * might be redacted. + * + * Generated from protobuf field string payload_value = 1; + * @param string $var + * @return $this + */ + public function setPayloadValue($var) + { + GPBUtil::checkString($var, True); + $this->payload_value = $var; + + return $this; + } + + /** + * Location within the request where the payload was placed. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe.Location payload_location = 2; + * @return int + */ + public function getPayloadLocation() + { + return $this->payload_location; + } + + /** + * Location within the request where the payload was placed. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1.Xxe.Location payload_location = 2; + * @param int $var + * @return $this + */ + public function setPayloadLocation($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1\Xxe\Location::class); + $this->payload_location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe/Location.php b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe/Location.php new file mode 100644 index 00000000000..5ca1c459cb0 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/proto/src/Google/Cloud/WebSecurityScanner/V1/Xxe/Location.php @@ -0,0 +1,57 @@ +google.cloud.websecurityscanner.v1.Xxe.Location + */ +class Location +{ + /** + * Unknown Location. + * + * Generated from protobuf enum LOCATION_UNSPECIFIED = 0; + */ + const LOCATION_UNSPECIFIED = 0; + /** + * The XML payload replaced the complete request body. + * + * Generated from protobuf enum COMPLETE_REQUEST_BODY = 1; + */ + const COMPLETE_REQUEST_BODY = 1; + + private static $valueToName = [ + self::LOCATION_UNSPECIFIED => 'LOCATION_UNSPECIFIED', + self::COMPLETE_REQUEST_BODY => 'COMPLETE_REQUEST_BODY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Location::class, \Google\Cloud\WebSecurityScanner\V1\Xxe_Location::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/create_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/create_scan_config.php new file mode 100644 index 00000000000..fc5b92bdedb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/create_scan_config.php @@ -0,0 +1,57 @@ +createScanConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/delete_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/delete_scan_config.php new file mode 100644 index 00000000000..1c0dec624a7 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/delete_scan_config.php @@ -0,0 +1,55 @@ +deleteScanConfig($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_finding.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_finding.php new file mode 100644 index 00000000000..f763389cf78 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_finding.php @@ -0,0 +1,57 @@ +getFinding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_config.php new file mode 100644 index 00000000000..b91d8811b20 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_config.php @@ -0,0 +1,57 @@ +getScanConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_run.php new file mode 100644 index 00000000000..8dbab9dae85 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/get_scan_run.php @@ -0,0 +1,57 @@ +getScanRun($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_crawled_urls.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_crawled_urls.php new file mode 100644 index 00000000000..1001798f2b3 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_crawled_urls.php @@ -0,0 +1,62 @@ +listCrawledUrls($request); + + /** @var CrawledUrl $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_finding_type_stats.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_finding_type_stats.php new file mode 100644 index 00000000000..0f198ff4688 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_finding_type_stats.php @@ -0,0 +1,57 @@ +listFindingTypeStats($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_findings.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_findings.php new file mode 100644 index 00000000000..2b29210b636 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_findings.php @@ -0,0 +1,62 @@ +listFindings($request); + + /** @var Finding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_configs.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_configs.php new file mode 100644 index 00000000000..0aca9f899e8 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_configs.php @@ -0,0 +1,62 @@ +listScanConfigs($request); + + /** @var ScanConfig $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_runs.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_runs.php new file mode 100644 index 00000000000..ecad02311e2 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/list_scan_runs.php @@ -0,0 +1,63 @@ +listScanRuns($request); + + /** @var ScanRun $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/start_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/start_scan_run.php new file mode 100644 index 00000000000..565e9322aca --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/start_scan_run.php @@ -0,0 +1,57 @@ +startScanRun($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/stop_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/stop_scan_run.php new file mode 100644 index 00000000000..5e1aff7313c --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/stop_scan_run.php @@ -0,0 +1,57 @@ +stopScanRun($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/update_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/update_scan_config.php new file mode 100644 index 00000000000..15f30d98b88 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/samples/V1/WebSecurityScannerClient/update_scan_config.php @@ -0,0 +1,57 @@ +updateScanConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1/src/V1/Client/WebSecurityScannerClient.php b/owl-bot-staging/WebSecurityScanner/v1/src/V1/Client/WebSecurityScannerClient.php new file mode 100644 index 00000000000..b32f5b4bccb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/src/V1/Client/WebSecurityScannerClient.php @@ -0,0 +1,531 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/web_security_scanner_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/web_security_scanner_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/web_security_scanner_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/web_security_scanner_rest_client_config.php', + ], + ], + ]; + } + + /** + * 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 'websecurityscanner.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new ScanConfig. + * + * The async variant is {@see WebSecurityScannerClient::createScanConfigAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/create_scan_config.php + * + * @param CreateScanConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function createScanConfig(CreateScanConfigRequest $request, array $callOptions = []): ScanConfig + { + return $this->startApiCall('CreateScanConfig', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing ScanConfig and its child resources. + * + * The async variant is {@see WebSecurityScannerClient::deleteScanConfigAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/delete_scan_config.php + * + * @param DeleteScanConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteScanConfig(DeleteScanConfigRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteScanConfig', $request, $callOptions)->wait(); + } + + /** + * Gets a Finding. + * + * The async variant is {@see WebSecurityScannerClient::getFindingAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/get_finding.php + * + * @param GetFindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Finding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFinding(GetFindingRequest $request, array $callOptions = []): Finding + { + return $this->startApiCall('GetFinding', $request, $callOptions)->wait(); + } + + /** + * Gets a ScanConfig. + * + * The async variant is {@see WebSecurityScannerClient::getScanConfigAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/get_scan_config.php + * + * @param GetScanConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getScanConfig(GetScanConfigRequest $request, array $callOptions = []): ScanConfig + { + return $this->startApiCall('GetScanConfig', $request, $callOptions)->wait(); + } + + /** + * Gets a ScanRun. + * + * The async variant is {@see WebSecurityScannerClient::getScanRunAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/get_scan_run.php + * + * @param GetScanRunRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanRun + * + * @throws ApiException Thrown if the API call fails. + */ + public function getScanRun(GetScanRunRequest $request, array $callOptions = []): ScanRun + { + return $this->startApiCall('GetScanRun', $request, $callOptions)->wait(); + } + + /** + * List CrawledUrls under a given ScanRun. + * + * The async variant is {@see WebSecurityScannerClient::listCrawledUrlsAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/list_crawled_urls.php + * + * @param ListCrawledUrlsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listCrawledUrls(ListCrawledUrlsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCrawledUrls', $request, $callOptions); + } + + /** + * List all FindingTypeStats under a given ScanRun. + * + * The async variant is + * {@see WebSecurityScannerClient::listFindingTypeStatsAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/list_finding_type_stats.php + * + * @param ListFindingTypeStatsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ListFindingTypeStatsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFindingTypeStats(ListFindingTypeStatsRequest $request, array $callOptions = []): ListFindingTypeStatsResponse + { + return $this->startApiCall('ListFindingTypeStats', $request, $callOptions)->wait(); + } + + /** + * List Findings under a given ScanRun. + * + * The async variant is {@see WebSecurityScannerClient::listFindingsAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/list_findings.php + * + * @param ListFindingsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listFindings(ListFindingsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFindings', $request, $callOptions); + } + + /** + * Lists ScanConfigs under a given project. + * + * The async variant is {@see WebSecurityScannerClient::listScanConfigsAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/list_scan_configs.php + * + * @param ListScanConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listScanConfigs(ListScanConfigsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListScanConfigs', $request, $callOptions); + } + + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * The async variant is {@see WebSecurityScannerClient::listScanRunsAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/list_scan_runs.php + * + * @param ListScanRunsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listScanRuns(ListScanRunsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListScanRuns', $request, $callOptions); + } + + /** + * Start a ScanRun according to the given ScanConfig. + * + * The async variant is {@see WebSecurityScannerClient::startScanRunAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/start_scan_run.php + * + * @param StartScanRunRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanRun + * + * @throws ApiException Thrown if the API call fails. + */ + public function startScanRun(StartScanRunRequest $request, array $callOptions = []): ScanRun + { + return $this->startApiCall('StartScanRun', $request, $callOptions)->wait(); + } + + /** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * The async variant is {@see WebSecurityScannerClient::stopScanRunAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/stop_scan_run.php + * + * @param StopScanRunRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanRun + * + * @throws ApiException Thrown if the API call fails. + */ + public function stopScanRun(StopScanRunRequest $request, array $callOptions = []): ScanRun + { + return $this->startApiCall('StopScanRun', $request, $callOptions)->wait(); + } + + /** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * The async variant is {@see WebSecurityScannerClient::updateScanConfigAsync()} . + * + * @example samples/V1/WebSecurityScannerClient/update_scan_config.php + * + * @param UpdateScanConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 ScanConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateScanConfig(UpdateScanConfigRequest $request, array $callOptions = []): ScanConfig + { + return $this->startApiCall('UpdateScanConfig', $request, $callOptions)->wait(); + } +} diff --git a/owl-bot-staging/WebSecurityScanner/v1/src/V1/gapic_metadata.json b/owl-bot-staging/WebSecurityScanner/v1/src/V1/gapic_metadata.json new file mode 100644 index 00000000000..d8c19414ac9 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/src/V1/gapic_metadata.json @@ -0,0 +1,83 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.websecurityscanner.v1", + "libraryPackage": "Google\\Cloud\\WebSecurityScanner\\V1", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerGapicClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListFindings": { + "methods": [ + "listFindings" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_client_config.json b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_client_config.json new file mode 100644 index 00000000000..29d08ef04d1 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_client_config.json @@ -0,0 +1,110 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1.WebSecurityScanner": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [], + "retry_policy_1_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_descriptor_config.php b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_descriptor_config.php new file mode 100644 index 00000000000..d64b2e48f71 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_descriptor_config.php @@ -0,0 +1,197 @@ + [ + 'google.cloud.websecurityscanner.v1.WebSecurityScanner' => [ + 'CreateScanConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanConfig', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteScanConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetFinding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\Finding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetScanConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetScanRun' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanRun', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListCrawledUrls' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCrawledUrls', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ListCrawledUrlsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindingTypeStats' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ListFindingTypeStatsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFindings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ListFindingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListScanConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScanConfigs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ListScanConfigsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListScanRuns' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScanRuns', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ListScanRunsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'StartScanRun' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanRun', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'StopScanRun' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanRun', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateScanConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\WebSecurityScanner\V1\ScanConfig', + 'headerParams' => [ + [ + 'keyName' => 'scan_config.name', + 'fieldAccessors' => [ + 'getScanConfig', + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_rest_client_config.php b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_rest_client_config.php new file mode 100644 index 00000000000..c38e23bc436 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/src/V1/resources/web_security_scanner_rest_client_config.php @@ -0,0 +1,157 @@ + [ + 'google.cloud.websecurityscanner.v1.WebSecurityScanner' => [ + 'CreateScanConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/scanConfigs', + 'body' => 'scan_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteScanConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetFinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScanConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScanRun' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*/scanRuns/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListCrawledUrls' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindingTypeStats' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScanConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/scanConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScanRuns' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/scanConfigs/*}/scanRuns', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'StartScanRun' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*}:start', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StopScanRun' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateScanConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{scan_config.name=projects/*/scanConfigs/*}', + 'body' => 'scan_config', + 'placeholders' => [ + 'scan_config.name' => [ + 'getters' => [ + 'getScanConfig', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/WebSecurityScanner/v1/tests/Unit/V1/Client/WebSecurityScannerClientTest.php b/owl-bot-staging/WebSecurityScanner/v1/tests/Unit/V1/Client/WebSecurityScannerClientTest.php new file mode 100644 index 00000000000..8eb9a0a42ca --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1/tests/Unit/V1/Client/WebSecurityScannerClientTest.php @@ -0,0 +1,944 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WebSecurityScannerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WebSecurityScannerClient($options); + } + + /** @test */ + public function createScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $managedScan = false; + $staticIpScan = true; + $ignoreHttpStatusErrors = true; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $expectedResponse->setManagedScan($managedScan); + $expectedResponse->setStaticIpScan($staticIpScan); + $expectedResponse->setIgnoreHttpStatusErrors($ignoreHttpStatusErrors); + $transport->addResponse($expectedResponse); + $request = new CreateScanConfigRequest(); + $response = $gapicClient->createScanConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/CreateScanConfig', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createScanConfigExceptionTest() + { + $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); + $request = new CreateScanConfigRequest(); + try { + $gapicClient->createScanConfig($request); + // 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()); + } + + /** @test */ + public function deleteScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + $request = new DeleteScanConfigRequest(); + $gapicClient->deleteScanConfig($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/DeleteScanConfig', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteScanConfigExceptionTest() + { + $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); + $request = new DeleteScanConfigRequest(); + try { + $gapicClient->deleteScanConfig($request); + // 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()); + } + + /** @test */ + public function getFindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $findingType = 'findingType274496048'; + $httpMethod = 'httpMethod820747384'; + $fuzzedUrl = 'fuzzedUrl-2120677666'; + $body = 'body3029410'; + $description = 'description-1724546052'; + $reproductionUrl = 'reproductionUrl-244934180'; + $frameUrl = 'frameUrl545464221'; + $finalUrl = 'finalUrl355601190'; + $trackingId = 'trackingId1878901667'; + $expectedResponse = new Finding(); + $expectedResponse->setName($name2); + $expectedResponse->setFindingType($findingType); + $expectedResponse->setHttpMethod($httpMethod); + $expectedResponse->setFuzzedUrl($fuzzedUrl); + $expectedResponse->setBody($body); + $expectedResponse->setDescription($description); + $expectedResponse->setReproductionUrl($reproductionUrl); + $expectedResponse->setFrameUrl($frameUrl); + $expectedResponse->setFinalUrl($finalUrl); + $expectedResponse->setTrackingId($trackingId); + $transport->addResponse($expectedResponse); + $request = new GetFindingRequest(); + $response = $gapicClient->getFinding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/GetFinding', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFindingExceptionTest() + { + $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); + $request = new GetFindingRequest(); + try { + $gapicClient->getFinding($request); + // 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()); + } + + /** @test */ + public function getScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $managedScan = false; + $staticIpScan = true; + $ignoreHttpStatusErrors = true; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $expectedResponse->setManagedScan($managedScan); + $expectedResponse->setStaticIpScan($staticIpScan); + $expectedResponse->setIgnoreHttpStatusErrors($ignoreHttpStatusErrors); + $transport->addResponse($expectedResponse); + $request = new GetScanConfigRequest(); + $response = $gapicClient->getScanConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/GetScanConfig', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScanConfigExceptionTest() + { + $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); + $request = new GetScanConfigRequest(); + try { + $gapicClient->getScanConfig($request); + // 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()); + } + + /** @test */ + public function getScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + $request = new GetScanRunRequest(); + $response = $gapicClient->getScanRun($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/GetScanRun', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScanRunExceptionTest() + { + $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); + $request = new GetScanRunRequest(); + try { + $gapicClient->getScanRun($request); + // 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()); + } + + /** @test */ + public function listCrawledUrlsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $crawledUrlsElement = new CrawledUrl(); + $crawledUrls = [ + $crawledUrlsElement, + ]; + $expectedResponse = new ListCrawledUrlsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCrawledUrls($crawledUrls); + $transport->addResponse($expectedResponse); + $request = new ListCrawledUrlsRequest(); + $response = $gapicClient->listCrawledUrls($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCrawledUrls()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/ListCrawledUrls', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCrawledUrlsExceptionTest() + { + $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); + $request = new ListCrawledUrlsRequest(); + try { + $gapicClient->listCrawledUrls($request); + // 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()); + } + + /** @test */ + public function listFindingTypeStatsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListFindingTypeStatsResponse(); + $transport->addResponse($expectedResponse); + $request = new ListFindingTypeStatsRequest(); + $response = $gapicClient->listFindingTypeStats($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/ListFindingTypeStats', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFindingTypeStatsExceptionTest() + { + $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); + $request = new ListFindingTypeStatsRequest(); + try { + $gapicClient->listFindingTypeStats($request); + // 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()); + } + + /** @test */ + public function listFindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $findingsElement = new Finding(); + $findings = [ + $findingsElement, + ]; + $expectedResponse = new ListFindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFindings($findings); + $transport->addResponse($expectedResponse); + $request = new ListFindingsRequest(); + $response = $gapicClient->listFindings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/ListFindings', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFindingsExceptionTest() + { + $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); + $request = new ListFindingsRequest(); + try { + $gapicClient->listFindings($request); + // 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()); + } + + /** @test */ + public function listScanConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scanConfigsElement = new ScanConfig(); + $scanConfigs = [ + $scanConfigsElement, + ]; + $expectedResponse = new ListScanConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScanConfigs($scanConfigs); + $transport->addResponse($expectedResponse); + $request = new ListScanConfigsRequest(); + $response = $gapicClient->listScanConfigs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScanConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/ListScanConfigs', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScanConfigsExceptionTest() + { + $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); + $request = new ListScanConfigsRequest(); + try { + $gapicClient->listScanConfigs($request); + // 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()); + } + + /** @test */ + public function listScanRunsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scanRunsElement = new ScanRun(); + $scanRuns = [ + $scanRunsElement, + ]; + $expectedResponse = new ListScanRunsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScanRuns($scanRuns); + $transport->addResponse($expectedResponse); + $request = new ListScanRunsRequest(); + $response = $gapicClient->listScanRuns($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScanRuns()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/ListScanRuns', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScanRunsExceptionTest() + { + $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); + $request = new ListScanRunsRequest(); + try { + $gapicClient->listScanRuns($request); + // 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()); + } + + /** @test */ + public function startScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + $request = new StartScanRunRequest(); + $response = $gapicClient->startScanRun($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/StartScanRun', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function startScanRunExceptionTest() + { + $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); + $request = new StartScanRunRequest(); + try { + $gapicClient->startScanRun($request); + // 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()); + } + + /** @test */ + public function stopScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + $request = new StopScanRunRequest(); + $response = $gapicClient->stopScanRun($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/StopScanRun', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function stopScanRunExceptionTest() + { + $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); + $request = new StopScanRunRequest(); + try { + $gapicClient->stopScanRun($request); + // 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()); + } + + /** @test */ + public function updateScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $managedScan = false; + $staticIpScan = true; + $ignoreHttpStatusErrors = true; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $expectedResponse->setManagedScan($managedScan); + $expectedResponse->setStaticIpScan($staticIpScan); + $expectedResponse->setIgnoreHttpStatusErrors($ignoreHttpStatusErrors); + $transport->addResponse($expectedResponse); + $request = new UpdateScanConfigRequest(); + $response = $gapicClient->updateScanConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/UpdateScanConfig', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateScanConfigExceptionTest() + { + $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); + $request = new UpdateScanConfigRequest(); + try { + $gapicClient->updateScanConfig($request); + // 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()); + } + + /** @test */ + public function createScanConfigAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $managedScan = false; + $staticIpScan = true; + $ignoreHttpStatusErrors = true; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $expectedResponse->setManagedScan($managedScan); + $expectedResponse->setStaticIpScan($staticIpScan); + $expectedResponse->setIgnoreHttpStatusErrors($ignoreHttpStatusErrors); + $transport->addResponse($expectedResponse); + $request = new CreateScanConfigRequest(); + $response = $gapicClient->createScanConfigAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1.WebSecurityScanner/CreateScanConfig', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/CrawledUrl.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/CrawledUrl.php new file mode 100644 index 00000000000..f650ca23bfb --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/CrawledUrl.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' + +8google/cloud/websecurityscanner/v1beta/crawled_url.proto&google.cloud.websecurityscanner.v1beta"< + +CrawledUrl + http_method (  +url (  +body ( B +*com.google.cloud.websecurityscanner.v1betaBCrawledUrlProtoPZZcloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb&Google.Cloud.WebSecurityScanner.V1Beta&Google\\Cloud\\WebSecurityScanner\\V1beta)Google::Cloud::WebSecurityScanner::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/Finding.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/Finding.php new file mode 100644 index 00000000000..02abec885ac --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/Finding.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' + +4google/cloud/websecurityscanner/v1beta/finding.proto&google.cloud.websecurityscanner.v1beta:google/cloud/websecurityscanner/v1beta/finding_addon.proto" +Finding +name (  + finding_type (  + http_method (  + +fuzzed_url (  +body (  + description (  +reproduction_url (  + frame_url (  + final_url (  + tracking_id + ( : +form ( 2,.google.cloud.websecurityscanner.v1beta.FormQ +outdated_library ( 27.google.cloud.websecurityscanner.v1beta.OutdatedLibraryU +violating_resource ( 29.google.cloud.websecurityscanner.v1beta.ViolatingResourceU +vulnerable_headers ( 29.google.cloud.websecurityscanner.v1beta.VulnerableHeaders[ +vulnerable_parameters ( 2<.google.cloud.websecurityscanner.v1beta.VulnerableParameters8 +xss ( 2+.google.cloud.websecurityscanner.v1beta.Xss:A +)websecurityscanner.googleapis.com/FindingSprojects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}B +*com.google.cloud.websecurityscanner.v1betaB FindingProtoPZZcloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb&Google.Cloud.WebSecurityScanner.V1Beta&Google\\Cloud\\WebSecurityScanner\\V1beta)Google::Cloud::WebSecurityScanner::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingAddon.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingAddon.php new file mode 100644 index 00000000000..9ea7f4fed76 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingAddon.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' + +:google/cloud/websecurityscanner/v1beta/finding_addon.proto&google.cloud.websecurityscanner.v1beta"* +Form + +action_uri (  +fields ( "Q +OutdatedLibrary + library_name (  +version (  +learn_more_urls ( "? +ViolatingResource + content_type (  + resource_url ( "/ +VulnerableParameters +parameter_names ( " +VulnerableHeadersQ +headers ( 2@.google.cloud.websecurityscanner.v1beta.VulnerableHeaders.HeaderY +missing_headers ( 2@.google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header% +Header +name (  +value ( "2 +Xss + stack_traces (  + error_message ( B +*com.google.cloud.websecurityscanner.v1betaBFindingAddonProtoPZZcloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb&Google.Cloud.WebSecurityScanner.V1Beta&Google\\Cloud\\WebSecurityScanner\\V1beta)Google::Cloud::WebSecurityScanner::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingTypeStats.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingTypeStats.php new file mode 100644 index 00000000000..48755bc1545 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/FindingTypeStats.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +?google/cloud/websecurityscanner/v1beta/finding_type_stats.proto&google.cloud.websecurityscanner.v1beta"? +FindingTypeStats + finding_type (  + finding_count (B +*com.google.cloud.websecurityscanner.v1betaBFindingTypeStatsProtoPZZcloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb&Google.Cloud.WebSecurityScanner.V1Beta&Google\\Cloud\\WebSecurityScanner\\V1beta)Google::Cloud::WebSecurityScanner::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfig.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfig.php new file mode 100644 index 00000000000..af447db1fe5 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfig.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfigError.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfigError.php new file mode 100644 index 00000000000..62bd51f36c4 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanConfigError.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRun.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRun.php new file mode 100644 index 00000000000..55e5294cde0 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRun.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunErrorTrace.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunErrorTrace.php new file mode 100644 index 00000000000..451259ff534 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunErrorTrace.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunWarningTrace.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunWarningTrace.php new file mode 100644 index 00000000000..775ada9cd20 Binary files /dev/null and b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/ScanRunWarningTrace.php differ diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/WebSecurityScanner.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/WebSecurityScanner.php new file mode 100644 index 00000000000..96f15f133fa --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/GPBMetadata/Google/Cloud/Websecurityscanner/V1Beta/WebSecurityScanner.php @@ -0,0 +1,121 @@ +internalAddGeneratedFile( + ' +- +Agoogle/cloud/websecurityscanner/v1beta/web_security_scanner.proto&google.cloud.websecurityscanner.v1betagoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto8google/cloud/websecurityscanner/v1beta/crawled_url.proto4google/cloud/websecurityscanner/v1beta/finding.proto?google/cloud/websecurityscanner/v1beta/finding_type_stats.proto8google/cloud/websecurityscanner/v1beta/scan_config.proto5google/cloud/websecurityscanner/v1beta/scan_run.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto" +CreateScanConfigRequestC +parent ( B3AA- ++cloudresourcemanager.googleapis.com/ProjectL + scan_config ( 22.google.cloud.websecurityscanner.v1beta.ScanConfigBA"] +DeleteScanConfigRequestB +name ( B4AA. +,websecurityscanner.googleapis.com/ScanConfig"Z +GetScanConfigRequestB +name ( B4AA. +,websecurityscanner.googleapis.com/ScanConfig" +ListScanConfigsRequestC +parent ( B3AA- ++cloudresourcemanager.googleapis.com/Project + +page_token (  + page_size (" +UpdateScanConfigRequestL + scan_config ( 22.google.cloud.websecurityscanner.v1beta.ScanConfigBA4 + update_mask ( 2.google.protobuf.FieldMaskBA"| +ListScanConfigsResponseH + scan_configs ( 22.google.cloud.websecurityscanner.v1beta.ScanConfig +next_page_token ( "Y +StartScanRunRequestB +name ( B4AA. +,websecurityscanner.googleapis.com/ScanConfig"T +GetScanRunRequest? +name ( B1AA+ +)websecurityscanner.googleapis.com/ScanRun" +ListScanRunsRequestD +parent ( B4AA. +,websecurityscanner.googleapis.com/ScanConfig + +page_token (  + page_size ("s +ListScanRunsResponseB + scan_runs ( 2/.google.cloud.websecurityscanner.v1beta.ScanRun +next_page_token ( "U +StopScanRunRequest? +name ( B1AA+ +)websecurityscanner.googleapis.com/ScanRun" +ListCrawledUrlsRequestA +parent ( B1AA+ +)websecurityscanner.googleapis.com/ScanRun + +page_token (  + page_size ("| +ListCrawledUrlsResponseH + crawled_urls ( 22.google.cloud.websecurityscanner.v1beta.CrawledUrl +next_page_token ( "T +GetFindingRequest? +name ( B1AA+ +)websecurityscanner.googleapis.com/Finding" +ListFindingsRequestA +parent ( B1AA+ +)websecurityscanner.googleapis.com/ScanRun +filter ( BA + +page_token (  + page_size ("r +ListFindingsResponseA +findings ( 2/.google.cloud.websecurityscanner.v1beta.Finding +next_page_token ( "` +ListFindingTypeStatsRequestA +parent ( B1AA+ +)websecurityscanner.googleapis.com/ScanRun"t +ListFindingTypeStatsResponseT +finding_type_stats ( 28.google.cloud.websecurityscanner.v1beta.FindingTypeStats2 +WebSecurityScanner +CreateScanConfig?.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest2.google.cloud.websecurityscanner.v1beta.ScanConfig"QAparent,scan_config6"\'/v1beta/{parent=projects/*}/scanConfigs: scan_config +DeleteScanConfig?.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest.google.protobuf.Empty"6Aname)*\'/v1beta/{name=projects/*/scanConfigs/*} + GetScanConfig<.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest2.google.cloud.websecurityscanner.v1beta.ScanConfig"6Aname)\'/v1beta/{name=projects/*/scanConfigs/*} +ListScanConfigs>.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest?.google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse"8Aparent)\'/v1beta/{parent=projects/*}/scanConfigs +UpdateScanConfig?.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest2.google.cloud.websecurityscanner.v1beta.ScanConfig"bAscan_config,update_maskB23/v1beta/{scan_config.name=projects/*/scanConfigs/*}: scan_config + StartScanRun;.google.cloud.websecurityscanner.v1beta.StartScanRunRequest/.google.cloud.websecurityscanner.v1beta.ScanRun"?Aname2"-/v1beta/{name=projects/*/scanConfigs/*}:start:* + +GetScanRun9.google.cloud.websecurityscanner.v1beta.GetScanRunRequest/.google.cloud.websecurityscanner.v1beta.ScanRun"AAname42/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*} + ListScanRuns;.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest<.google.cloud.websecurityscanner.v1beta.ListScanRunsResponse"CAparent42/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns + StopScanRun:.google.cloud.websecurityscanner.v1beta.StopScanRunRequest/.google.cloud.websecurityscanner.v1beta.ScanRun"IAname<"7/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop:* +ListCrawledUrls>.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest?.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse"QAparentB@/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls + +GetFinding9.google.cloud.websecurityscanner.v1beta.GetFindingRequest/.google.cloud.websecurityscanner.v1beta.Finding"LAname?=/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*} + ListFindings;.google.cloud.websecurityscanner.v1beta.ListFindingsRequest<.google.cloud.websecurityscanner.v1beta.ListFindingsResponse"UA parent,filter?=/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings +ListFindingTypeStatsC.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequestD.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse"VAparentGE/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStatsUA!websecurityscanner.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +*com.google.cloud.websecurityscanner.v1betaBWebSecurityScannerProtoPZZcloud.google.com/go/websecurityscanner/apiv1beta/websecurityscannerpb;websecurityscannerpb&Google.Cloud.WebSecurityScanner.V1Beta&Google\\Cloud\\WebSecurityScanner\\V1beta)Google::Cloud::WebSecurityScanner::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CrawledUrl.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CrawledUrl.php new file mode 100644 index 00000000000..2e349723d4e --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CrawledUrl.php @@ -0,0 +1,141 @@ +google.cloud.websecurityscanner.v1beta.CrawledUrl + */ +class CrawledUrl extends \Google\Protobuf\Internal\Message +{ + /** + * The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + */ + protected $http_method = ''; + /** + * The URL that was crawled. + * + * Generated from protobuf field string url = 2; + */ + protected $url = ''; + /** + * The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + */ + protected $body = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $http_method + * The http method of the request that was used to visit the URL, in + * uppercase. + * @type string $url + * The URL that was crawled. + * @type string $body + * The body of the request that was used to visit the URL. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\CrawledUrl::initOnce(); + parent::__construct($data); + } + + /** + * The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + * @return string + */ + public function getHttpMethod() + { + return $this->http_method; + } + + /** + * The http method of the request that was used to visit the URL, in + * uppercase. + * + * Generated from protobuf field string http_method = 1; + * @param string $var + * @return $this + */ + public function setHttpMethod($var) + { + GPBUtil::checkString($var, True); + $this->http_method = $var; + + return $this; + } + + /** + * The URL that was crawled. + * + * Generated from protobuf field string url = 2; + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * The URL that was crawled. + * + * Generated from protobuf field string url = 2; + * @param string $var + * @return $this + */ + public function setUrl($var) + { + GPBUtil::checkString($var, True); + $this->url = $var; + + return $this; + } + + /** + * The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The body of the request that was used to visit the URL. + * + * Generated from protobuf field string body = 3; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CreateScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CreateScanConfigRequest.php new file mode 100644 index 00000000000..ead5d80e437 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/CreateScanConfigRequest.php @@ -0,0 +1,115 @@ +google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest + */ +class CreateScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scan_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig $scan_config + * Required. The ScanConfig to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig|null + */ + public function getScanConfig() + { + return $this->scan_config; + } + + public function hasScanConfig() + { + return isset($this->scan_config); + } + + public function clearScanConfig() + { + unset($this->scan_config); + } + + /** + * Required. The ScanConfig to be created. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig $var + * @return $this + */ + public function setScanConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig::class); + $this->scan_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/DeleteScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/DeleteScanConfigRequest.php new file mode 100644 index 00000000000..141b3ec43c8 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/DeleteScanConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest + */ +class DeleteScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Finding.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Finding.php new file mode 100644 index 00000000000..a2d13bd5154 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Finding.php @@ -0,0 +1,686 @@ +google.cloud.websecurityscanner.v1beta.Finding + */ +class Finding extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-scanner/docs/scan-result-details + * + * Generated from protobuf field string finding_type = 2; + */ + protected $finding_type = ''; + /** + * The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + */ + protected $http_method = ''; + /** + * The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + */ + protected $fuzzed_url = ''; + /** + * The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + */ + protected $body = ''; + /** + * The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + */ + protected $reproduction_url = ''; + /** + * If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + */ + protected $frame_url = ''; + /** + * The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + */ + protected $final_url = ''; + /** + * The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + */ + protected $tracking_id = ''; + /** + * An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Form form = 16; + */ + protected $form = null; + /** + * An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.OutdatedLibrary outdated_library = 11; + */ + protected $outdated_library = null; + /** + * An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ViolatingResource violating_resource = 12; + */ + protected $violating_resource = null; + /** + * An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableHeaders vulnerable_headers = 15; + */ + protected $vulnerable_headers = null; + /** + * An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableParameters vulnerable_parameters = 13; + */ + protected $vulnerable_parameters = null; + /** + * An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Xss xss = 14; + */ + protected $xss = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * @type string $finding_type + * The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-scanner/docs/scan-result-details + * @type string $http_method + * The http method of the request that triggered the vulnerability, in + * uppercase. + * @type string $fuzzed_url + * The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * @type string $body + * The body of the request that triggered the vulnerability. + * @type string $description + * The description of the vulnerability. + * @type string $reproduction_url + * The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * @type string $frame_url + * If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * @type string $final_url + * The URL where the browser lands when the vulnerability is detected. + * @type string $tracking_id + * The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * @type \Google\Cloud\WebSecurityScanner\V1beta\Form $form + * An addon containing information reported for a vulnerability with an HTML + * form, if any. + * @type \Google\Cloud\WebSecurityScanner\V1beta\OutdatedLibrary $outdated_library + * An addon containing information about outdated libraries. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ViolatingResource $violating_resource + * An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * @type \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders $vulnerable_headers + * An addon containing information about vulnerable or missing HTTP headers. + * @type \Google\Cloud\WebSecurityScanner\V1beta\VulnerableParameters $vulnerable_parameters + * An addon containing information about request parameters which were found + * to be vulnerable. + * @type \Google\Cloud\WebSecurityScanner\V1beta\Xss $xss + * An addon containing information reported for an XSS, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\Finding::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the Finding. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + * The finding IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-scanner/docs/scan-result-details + * + * Generated from protobuf field string finding_type = 2; + * @return string + */ + public function getFindingType() + { + return $this->finding_type; + } + + /** + * The type of the Finding. + * Detailed and up-to-date information on findings can be found here: + * https://cloud.google.com/security-scanner/docs/scan-result-details + * + * Generated from protobuf field string finding_type = 2; + * @param string $var + * @return $this + */ + public function setFindingType($var) + { + GPBUtil::checkString($var, True); + $this->finding_type = $var; + + return $this; + } + + /** + * The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + * @return string + */ + public function getHttpMethod() + { + return $this->http_method; + } + + /** + * The http method of the request that triggered the vulnerability, in + * uppercase. + * + * Generated from protobuf field string http_method = 3; + * @param string $var + * @return $this + */ + public function setHttpMethod($var) + { + GPBUtil::checkString($var, True); + $this->http_method = $var; + + return $this; + } + + /** + * The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + * @return string + */ + public function getFuzzedUrl() + { + return $this->fuzzed_url; + } + + /** + * The URL produced by the server-side fuzzer and used in the request that + * triggered the vulnerability. + * + * Generated from protobuf field string fuzzed_url = 4; + * @param string $var + * @return $this + */ + public function setFuzzedUrl($var) + { + GPBUtil::checkString($var, True); + $this->fuzzed_url = $var; + + return $this; + } + + /** + * The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + * @return string + */ + public function getBody() + { + return $this->body; + } + + /** + * The body of the request that triggered the vulnerability. + * + * Generated from protobuf field string body = 5; + * @param string $var + * @return $this + */ + public function setBody($var) + { + GPBUtil::checkString($var, True); + $this->body = $var; + + return $this; + } + + /** + * The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the vulnerability. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + * @return string + */ + public function getReproductionUrl() + { + return $this->reproduction_url; + } + + /** + * The URL containing human-readable payload that user can leverage to + * reproduce the vulnerability. + * + * Generated from protobuf field string reproduction_url = 7; + * @param string $var + * @return $this + */ + public function setReproductionUrl($var) + { + GPBUtil::checkString($var, True); + $this->reproduction_url = $var; + + return $this; + } + + /** + * If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + * @return string + */ + public function getFrameUrl() + { + return $this->frame_url; + } + + /** + * If the vulnerability was originated from nested IFrame, the immediate + * parent IFrame is reported. + * + * Generated from protobuf field string frame_url = 8; + * @param string $var + * @return $this + */ + public function setFrameUrl($var) + { + GPBUtil::checkString($var, True); + $this->frame_url = $var; + + return $this; + } + + /** + * The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + * @return string + */ + public function getFinalUrl() + { + return $this->final_url; + } + + /** + * The URL where the browser lands when the vulnerability is detected. + * + * Generated from protobuf field string final_url = 9; + * @param string $var + * @return $this + */ + public function setFinalUrl($var) + { + GPBUtil::checkString($var, True); + $this->final_url = $var; + + return $this; + } + + /** + * The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + * @return string + */ + public function getTrackingId() + { + return $this->tracking_id; + } + + /** + * The tracking ID uniquely identifies a vulnerability instance across + * multiple ScanRuns. + * + * Generated from protobuf field string tracking_id = 10; + * @param string $var + * @return $this + */ + public function setTrackingId($var) + { + GPBUtil::checkString($var, True); + $this->tracking_id = $var; + + return $this; + } + + /** + * An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Form form = 16; + * @return \Google\Cloud\WebSecurityScanner\V1beta\Form|null + */ + public function getForm() + { + return $this->form; + } + + public function hasForm() + { + return isset($this->form); + } + + public function clearForm() + { + unset($this->form); + } + + /** + * An addon containing information reported for a vulnerability with an HTML + * form, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Form form = 16; + * @param \Google\Cloud\WebSecurityScanner\V1beta\Form $var + * @return $this + */ + public function setForm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\Form::class); + $this->form = $var; + + return $this; + } + + /** + * An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.OutdatedLibrary outdated_library = 11; + * @return \Google\Cloud\WebSecurityScanner\V1beta\OutdatedLibrary|null + */ + public function getOutdatedLibrary() + { + return $this->outdated_library; + } + + public function hasOutdatedLibrary() + { + return isset($this->outdated_library); + } + + public function clearOutdatedLibrary() + { + unset($this->outdated_library); + } + + /** + * An addon containing information about outdated libraries. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.OutdatedLibrary outdated_library = 11; + * @param \Google\Cloud\WebSecurityScanner\V1beta\OutdatedLibrary $var + * @return $this + */ + public function setOutdatedLibrary($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\OutdatedLibrary::class); + $this->outdated_library = $var; + + return $this; + } + + /** + * An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ViolatingResource violating_resource = 12; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ViolatingResource|null + */ + public function getViolatingResource() + { + return $this->violating_resource; + } + + public function hasViolatingResource() + { + return isset($this->violating_resource); + } + + public function clearViolatingResource() + { + unset($this->violating_resource); + } + + /** + * An addon containing detailed information regarding any resource causing the + * vulnerability such as JavaScript sources, image, audio files, etc. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ViolatingResource violating_resource = 12; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ViolatingResource $var + * @return $this + */ + public function setViolatingResource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ViolatingResource::class); + $this->violating_resource = $var; + + return $this; + } + + /** + * An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableHeaders vulnerable_headers = 15; + * @return \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders|null + */ + public function getVulnerableHeaders() + { + return $this->vulnerable_headers; + } + + public function hasVulnerableHeaders() + { + return isset($this->vulnerable_headers); + } + + public function clearVulnerableHeaders() + { + unset($this->vulnerable_headers); + } + + /** + * An addon containing information about vulnerable or missing HTTP headers. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableHeaders vulnerable_headers = 15; + * @param \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders $var + * @return $this + */ + public function setVulnerableHeaders($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders::class); + $this->vulnerable_headers = $var; + + return $this; + } + + /** + * An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableParameters vulnerable_parameters = 13; + * @return \Google\Cloud\WebSecurityScanner\V1beta\VulnerableParameters|null + */ + public function getVulnerableParameters() + { + return $this->vulnerable_parameters; + } + + public function hasVulnerableParameters() + { + return isset($this->vulnerable_parameters); + } + + public function clearVulnerableParameters() + { + unset($this->vulnerable_parameters); + } + + /** + * An addon containing information about request parameters which were found + * to be vulnerable. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.VulnerableParameters vulnerable_parameters = 13; + * @param \Google\Cloud\WebSecurityScanner\V1beta\VulnerableParameters $var + * @return $this + */ + public function setVulnerableParameters($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\VulnerableParameters::class); + $this->vulnerable_parameters = $var; + + return $this; + } + + /** + * An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Xss xss = 14; + * @return \Google\Cloud\WebSecurityScanner\V1beta\Xss|null + */ + public function getXss() + { + return $this->xss; + } + + public function hasXss() + { + return isset($this->xss); + } + + public function clearXss() + { + unset($this->xss); + } + + /** + * An addon containing information reported for an XSS, if any. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.Xss xss = 14; + * @param \Google\Cloud\WebSecurityScanner\V1beta\Xss $var + * @return $this + */ + public function setXss($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\Xss::class); + $this->xss = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/FindingTypeStats.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/FindingTypeStats.php new file mode 100644 index 00000000000..7dcea1dd7c4 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/FindingTypeStats.php @@ -0,0 +1,102 @@ +google.cloud.websecurityscanner.v1beta.FindingTypeStats + */ +class FindingTypeStats extends \Google\Protobuf\Internal\Message +{ + /** + * The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + */ + protected $finding_type = ''; + /** + * The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + */ + protected $finding_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $finding_type + * The finding type associated with the stats. + * @type int $finding_count + * The count of findings belonging to this finding type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingTypeStats::initOnce(); + parent::__construct($data); + } + + /** + * The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + * @return string + */ + public function getFindingType() + { + return $this->finding_type; + } + + /** + * The finding type associated with the stats. + * + * Generated from protobuf field string finding_type = 1; + * @param string $var + * @return $this + */ + public function setFindingType($var) + { + GPBUtil::checkString($var, True); + $this->finding_type = $var; + + return $this; + } + + /** + * The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + * @return int + */ + public function getFindingCount() + { + return $this->finding_count; + } + + /** + * The count of findings belonging to this finding type. + * + * Generated from protobuf field int32 finding_count = 2; + * @param int $var + * @return $this + */ + public function setFindingCount($var) + { + GPBUtil::checkInt32($var); + $this->finding_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Form.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Form.php new file mode 100644 index 00000000000..14784f2922c --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Form.php @@ -0,0 +1,101 @@ +google.cloud.websecurityscanner.v1beta.Form + */ +class Form extends \Google\Protobuf\Internal\Message +{ + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + */ + protected $action_uri = ''; + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + */ + private $fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action_uri + * ! The URI where to send the form when it's submitted. + * @type array|\Google\Protobuf\Internal\RepeatedField $fields + * ! The names of form fields related to the vulnerability. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + * @return string + */ + public function getActionUri() + { + return $this->action_uri; + } + + /** + * ! The URI where to send the form when it's submitted. + * + * Generated from protobuf field string action_uri = 1; + * @param string $var + * @return $this + */ + public function setActionUri($var) + { + GPBUtil::checkString($var, True); + $this->action_uri = $var; + + return $this; + } + + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * ! The names of form fields related to the vulnerability. + * + * Generated from protobuf field repeated string fields = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->fields = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetFindingRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetFindingRequest.php new file mode 100644 index 00000000000..ed61d3a9a99 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetFindingRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1beta.GetFindingRequest + */ +class GetFindingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanConfigRequest.php new file mode 100644 index 00000000000..dac9b6f5446 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1beta.GetScanConfigRequest + */ +class GetScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanRunRequest.php new file mode 100644 index 00000000000..65ae02b47d2 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/GetScanRunRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1beta.GetScanRunRequest + */ +class GetScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsRequest.php new file mode 100644 index 00000000000..7f5942a653f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsRequest.php @@ -0,0 +1,159 @@ +google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest + */ +class ListCrawledUrlsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsResponse.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsResponse.php new file mode 100644 index 00000000000..bfa730976b3 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListCrawledUrlsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse + */ +class ListCrawledUrlsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.CrawledUrl crawled_urls = 1; + */ + private $crawled_urls; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\CrawledUrl>|\Google\Protobuf\Internal\RepeatedField $crawled_urls + * The list of CrawledUrls returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.CrawledUrl crawled_urls = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCrawledUrls() + { + return $this->crawled_urls; + } + + /** + * The list of CrawledUrls returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.CrawledUrl crawled_urls = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\CrawledUrl>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCrawledUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\CrawledUrl::class); + $this->crawled_urls = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsRequest.php new file mode 100644 index 00000000000..66ff86bbad7 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest + */ +class ListFindingTypeStatsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsResponse.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsResponse.php new file mode 100644 index 00000000000..ae47be432e3 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingTypeStatsResponse.php @@ -0,0 +1,67 @@ +google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse + */ +class ListFindingTypeStatsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.FindingTypeStats finding_type_stats = 1; + */ + private $finding_type_stats; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\FindingTypeStats>|\Google\Protobuf\Internal\RepeatedField $finding_type_stats + * The list of FindingTypeStats returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.FindingTypeStats finding_type_stats = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFindingTypeStats() + { + return $this->finding_type_stats; + } + + /** + * The list of FindingTypeStats returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.FindingTypeStats finding_type_stats = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\FindingTypeStats>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFindingTypeStats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\FindingTypeStats::class); + $this->finding_type_stats = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsRequest.php new file mode 100644 index 00000000000..12068b4439f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsRequest.php @@ -0,0 +1,205 @@ +google.cloud.websecurityscanner.v1beta.ListFindingsRequest + */ +class ListFindingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @type string $filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 4; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsResponse.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsResponse.php new file mode 100644 index 00000000000..890a376588d --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListFindingsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1beta.ListFindingsResponse + */ +class ListFindingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.Finding findings = 1; + */ + private $findings; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\Finding>|\Google\Protobuf\Internal\RepeatedField $findings + * The list of Findings returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.Finding findings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFindings() + { + return $this->findings; + } + + /** + * The list of Findings returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.Finding findings = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\Finding>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFindings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\Finding::class); + $this->findings = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsRequest.php new file mode 100644 index 00000000000..936da9a0f58 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsRequest.php @@ -0,0 +1,155 @@ +google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest + */ +class ListScanConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsResponse.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsResponse.php new file mode 100644 index 00000000000..1bc3d4de4e9 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanConfigsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse + */ +class ListScanConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig scan_configs = 1; + */ + private $scan_configs; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\ScanConfig>|\Google\Protobuf\Internal\RepeatedField $scan_configs + * The list of ScanConfigs returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig scan_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScanConfigs() + { + return $this->scan_configs; + } + + /** + * The list of ScanConfigs returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig scan_configs = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\ScanConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScanConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig::class); + $this->scan_configs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsRequest.php new file mode 100644 index 00000000000..feb7ff33964 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsRequest.php @@ -0,0 +1,155 @@ +google.cloud.websecurityscanner.v1beta.ListScanRunsRequest + */ +class ListScanRunsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + */ + protected $page_token = ''; + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @type string $page_token + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @type int $page_size + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * + * Generated from protobuf field string page_token = 2; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsResponse.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsResponse.php new file mode 100644 index 00000000000..dba8c5beef2 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ListScanRunsResponse.php @@ -0,0 +1,105 @@ +google.cloud.websecurityscanner.v1beta.ListScanRunsResponse + */ +class ListScanRunsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRun scan_runs = 1; + */ + private $scan_runs; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\ScanRun>|\Google\Protobuf\Internal\RepeatedField $scan_runs + * The list of ScanRuns returned. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRun scan_runs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScanRuns() + { + return $this->scan_runs; + } + + /** + * The list of ScanRuns returned. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRun scan_runs = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\ScanRun>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScanRuns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun::class); + $this->scan_runs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/OutdatedLibrary.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/OutdatedLibrary.php new file mode 100644 index 00000000000..bc116a0e533 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/OutdatedLibrary.php @@ -0,0 +1,135 @@ +google.cloud.websecurityscanner.v1beta.OutdatedLibrary + */ +class OutdatedLibrary extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + */ + protected $library_name = ''; + /** + * The version number. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + */ + private $learn_more_urls; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $library_name + * The name of the outdated library. + * @type string $version + * The version number. + * @type array|\Google\Protobuf\Internal\RepeatedField $learn_more_urls + * URLs to learn more information about the vulnerabilities in the library. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + * @return string + */ + public function getLibraryName() + { + return $this->library_name; + } + + /** + * The name of the outdated library. + * + * Generated from protobuf field string library_name = 1; + * @param string $var + * @return $this + */ + public function setLibraryName($var) + { + GPBUtil::checkString($var, True); + $this->library_name = $var; + + return $this; + } + + /** + * The version number. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version number. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLearnMoreUrls() + { + return $this->learn_more_urls; + } + + /** + * URLs to learn more information about the vulnerabilities in the library. + * + * Generated from protobuf field repeated string learn_more_urls = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLearnMoreUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->learn_more_urls = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig.php new file mode 100644 index 00000000000..1bbe2c13e6a --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig.php @@ -0,0 +1,507 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig + */ +class ScanConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + */ + protected $max_qps = 0; + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $starting_urls; + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication authentication = 5; + */ + protected $authentication = null; + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.UserAgent user_agent = 6; + */ + protected $user_agent = 0; + /** + * The blacklist URL patterns as described in + * https://cloud.google.com/security-scanner/docs/excluded-urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + */ + private $blacklist_patterns; + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Schedule schedule = 8; + */ + protected $schedule = null; + /** + * Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + * used as a default. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig.TargetPlatform target_platforms = 9; + */ + private $target_platforms; + /** + * Controls export of scan configurations and results to Cloud Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + */ + protected $export_to_security_command_center = 0; + /** + * Latest ScanRun if available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun latest_run = 11; + */ + protected $latest_run = null; + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.RiskLevel risk_level = 12; + */ + protected $risk_level = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * @type string $display_name + * Required. The user provided display name of the ScanConfig. + * @type int $max_qps + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * @type array|\Google\Protobuf\Internal\RepeatedField $starting_urls + * Required. The starting URLs from which the scanner finds site pages. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication $authentication + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * @type int $user_agent + * The user agent used during scanning. + * @type array|\Google\Protobuf\Internal\RepeatedField $blacklist_patterns + * The blacklist URL patterns as described in + * https://cloud.google.com/security-scanner/docs/excluded-urls + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Schedule $schedule + * The schedule of the ScanConfig. + * @type array|\Google\Protobuf\Internal\RepeatedField $target_platforms + * Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + * used as a default. + * @type int $export_to_security_command_center + * Controls export of scan configurations and results to Cloud Security + * Command Center. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanRun $latest_run + * Latest ScanRun if available. + * @type int $risk_level + * The risk level selected for the scan + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ScanConfig. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + * generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The user provided display name of the ScanConfig. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + * @return int + */ + public function getMaxQps() + { + return $this->max_qps; + } + + /** + * The maximum QPS during scanning. A valid value ranges from 5 to 20 + * inclusively. If the field is unspecified or its value is set 0, server will + * default to 15. Other values outside of [5, 20] range will be rejected with + * INVALID_ARGUMENT error. + * + * Generated from protobuf field int32 max_qps = 3; + * @param int $var + * @return $this + */ + public function setMaxQps($var) + { + GPBUtil::checkInt32($var); + $this->max_qps = $var; + + return $this; + } + + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartingUrls() + { + return $this->starting_urls; + } + + /** + * Required. The starting URLs from which the scanner finds site pages. + * + * Generated from protobuf field repeated string starting_urls = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartingUrls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->starting_urls = $arr; + + return $this; + } + + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication authentication = 5; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication|null + */ + public function getAuthentication() + { + return $this->authentication; + } + + public function hasAuthentication() + { + return isset($this->authentication); + } + + public function clearAuthentication() + { + unset($this->authentication); + } + + /** + * The authentication configuration. If specified, service will use the + * authentication configuration during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication authentication = 5; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication $var + * @return $this + */ + public function setAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication::class); + $this->authentication = $var; + + return $this; + } + + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.UserAgent user_agent = 6; + * @return int + */ + public function getUserAgent() + { + return $this->user_agent; + } + + /** + * The user agent used during scanning. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.UserAgent user_agent = 6; + * @param int $var + * @return $this + */ + public function setUserAgent($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\UserAgent::class); + $this->user_agent = $var; + + return $this; + } + + /** + * The blacklist URL patterns as described in + * https://cloud.google.com/security-scanner/docs/excluded-urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBlacklistPatterns() + { + return $this->blacklist_patterns; + } + + /** + * The blacklist URL patterns as described in + * https://cloud.google.com/security-scanner/docs/excluded-urls + * + * Generated from protobuf field repeated string blacklist_patterns = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBlacklistPatterns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->blacklist_patterns = $arr; + + return $this; + } + + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Schedule schedule = 8; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Schedule|null + */ + public function getSchedule() + { + return $this->schedule; + } + + public function hasSchedule() + { + return isset($this->schedule); + } + + public function clearSchedule() + { + unset($this->schedule); + } + + /** + * The schedule of the ScanConfig. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Schedule schedule = 8; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Schedule $var + * @return $this + */ + public function setSchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Schedule::class); + $this->schedule = $var; + + return $this; + } + + /** + * Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + * used as a default. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig.TargetPlatform target_platforms = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTargetPlatforms() + { + return $this->target_platforms; + } + + /** + * Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + * used as a default. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanConfig.TargetPlatform target_platforms = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTargetPlatforms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\TargetPlatform::class); + $this->target_platforms = $arr; + + return $this; + } + + /** + * Controls export of scan configurations and results to Cloud Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + * @return int + */ + public function getExportToSecurityCommandCenter() + { + return $this->export_to_security_command_center; + } + + /** + * Controls export of scan configurations and results to Cloud Security + * Command Center. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.ExportToSecurityCommandCenter export_to_security_command_center = 10; + * @param int $var + * @return $this + */ + public function setExportToSecurityCommandCenter($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\ExportToSecurityCommandCenter::class); + $this->export_to_security_command_center = $var; + + return $this; + } + + /** + * Latest ScanRun if available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun latest_run = 11; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanRun|null + */ + public function getLatestRun() + { + return $this->latest_run; + } + + public function hasLatestRun() + { + return isset($this->latest_run); + } + + public function clearLatestRun() + { + unset($this->latest_run); + } + + /** + * Latest ScanRun if available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun latest_run = 11; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanRun $var + * @return $this + */ + public function setLatestRun($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun::class); + $this->latest_run = $var; + + return $this; + } + + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.RiskLevel risk_level = 12; + * @return int + */ + public function getRiskLevel() + { + return $this->risk_level; + } + + /** + * The risk level selected for the scan + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.RiskLevel risk_level = 12; + * @param int $var + * @return $this + */ + public function setRiskLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\RiskLevel::class); + $this->risk_level = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication.php new file mode 100644 index 00000000000..03ff0126000 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication.php @@ -0,0 +1,111 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication + */ +class Authentication extends \Google\Protobuf\Internal\Message +{ + protected $authentication; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\GoogleAccount $google_account + * Authentication using a Google account. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\CustomAccount $custom_account + * Authentication using a custom account. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Authentication using a Google account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.GoogleAccount google_account = 1; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\GoogleAccount|null + */ + public function getGoogleAccount() + { + return $this->readOneof(1); + } + + public function hasGoogleAccount() + { + return $this->hasOneof(1); + } + + /** + * Authentication using a Google account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.GoogleAccount google_account = 1; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\GoogleAccount $var + * @return $this + */ + public function setGoogleAccount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\GoogleAccount::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Authentication using a custom account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.CustomAccount custom_account = 2; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\CustomAccount|null + */ + public function getCustomAccount() + { + return $this->readOneof(2); + } + + public function hasCustomAccount() + { + return $this->hasOneof(2); + } + + /** + * Authentication using a custom account. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.CustomAccount custom_account = 2; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\CustomAccount $var + * @return $this + */ + public function setCustomAccount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\Authentication\CustomAccount::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthentication() + { + return $this->whichOneof("authentication"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Authentication::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_Authentication::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/CustomAccount.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/CustomAccount.php new file mode 100644 index 00000000000..8230fd5942e --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/CustomAccount.php @@ -0,0 +1,142 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.CustomAccount + */ +class CustomAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $username = ''; + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $password = ''; + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $login_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The user name of the custom account. + * @type string $password + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * @type string $login_url + * Required. The login form URL of the website. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The user name of the custom account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Required. Input only. The password of the custom account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLoginUrl() + { + return $this->login_url; + } + + /** + * Required. The login form URL of the website. + * + * Generated from protobuf field string login_url = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLoginUrl($var) + { + GPBUtil::checkString($var, True); + $this->login_url = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CustomAccount::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_Authentication_CustomAccount::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/GoogleAccount.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/GoogleAccount.php new file mode 100644 index 00000000000..7f20c4a18b4 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Authentication/GoogleAccount.php @@ -0,0 +1,108 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.Authentication.GoogleAccount + */ +class GoogleAccount extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $username = ''; + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $username + * Required. The user name of the Google account. + * @type string $password + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Required. The user name of the Google account. + * + * Generated from protobuf field string username = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUsername($var) + { + GPBUtil::checkString($var, True); + $this->username = $var; + + return $this; + } + + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Required. Input only. The password of the Google account. The credential is stored encrypted + * and not returned in any response nor included in audit logs. + * + * Generated from protobuf field string password = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GoogleAccount::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_Authentication_GoogleAccount::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/ExportToSecurityCommandCenter.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/ExportToSecurityCommandCenter.php new file mode 100644 index 00000000000..40b463f0364 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/ExportToSecurityCommandCenter.php @@ -0,0 +1,65 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.ExportToSecurityCommandCenter + */ +class ExportToSecurityCommandCenter +{ + /** + * Use default, which is ENABLED. + * + * Generated from protobuf enum EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + */ + const EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + /** + * Export results of this scan to Cloud Security Command Center. + * + * Generated from protobuf enum ENABLED = 1; + */ + const ENABLED = 1; + /** + * Do not export results of this scan to Cloud Security Command Center. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + + private static $valueToName = [ + self::EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED => 'EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED', + self::ENABLED => 'ENABLED', + self::DISABLED => 'DISABLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExportToSecurityCommandCenter::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_ExportToSecurityCommandCenter::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/RiskLevel.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/RiskLevel.php new file mode 100644 index 00000000000..5c916d63b63 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/RiskLevel.php @@ -0,0 +1,66 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.RiskLevel + */ +class RiskLevel +{ + /** + * Use default, which is NORMAL. + * + * Generated from protobuf enum RISK_LEVEL_UNSPECIFIED = 0; + */ + const RISK_LEVEL_UNSPECIFIED = 0; + /** + * Normal scanning (Recommended) + * + * Generated from protobuf enum NORMAL = 1; + */ + const NORMAL = 1; + /** + * Lower impact scanning + * + * Generated from protobuf enum LOW = 2; + */ + const LOW = 2; + + private static $valueToName = [ + self::RISK_LEVEL_UNSPECIFIED => 'RISK_LEVEL_UNSPECIFIED', + self::NORMAL => 'NORMAL', + self::LOW => 'LOW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RiskLevel::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_RiskLevel::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Schedule.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Schedule.php new file mode 100644 index 00000000000..aaadac26c26 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/Schedule.php @@ -0,0 +1,126 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.Schedule + */ +class Schedule extends \Google\Protobuf\Internal\Message +{ + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + */ + protected $schedule_time = null; + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $interval_duration_days = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $schedule_time + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * @type int $interval_duration_days + * Required. The duration of time between executions in days. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfig::initOnce(); + parent::__construct($data); + } + + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getScheduleTime() + { + return $this->schedule_time; + } + + public function hasScheduleTime() + { + return isset($this->schedule_time); + } + + public function clearScheduleTime() + { + unset($this->schedule_time); + } + + /** + * A timestamp indicates when the next run will be scheduled. The value is + * refreshed by the server after each run. If unspecified, it will default + * to current server time, which means the scan will be scheduled to start + * immediately. + * + * Generated from protobuf field .google.protobuf.Timestamp schedule_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setScheduleTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->schedule_time = $var; + + return $this; + } + + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getIntervalDurationDays() + { + return $this->interval_duration_days; + } + + /** + * Required. The duration of time between executions in days. + * + * Generated from protobuf field int32 interval_duration_days = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setIntervalDurationDays($var) + { + GPBUtil::checkInt32($var); + $this->interval_duration_days = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Schedule::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_Schedule::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/TargetPlatform.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/TargetPlatform.php new file mode 100644 index 00000000000..30d0f1f2c73 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/TargetPlatform.php @@ -0,0 +1,65 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.TargetPlatform + */ +class TargetPlatform +{ + /** + * The target platform is unknown. Requests with this enum value will be + * rejected with INVALID_ARGUMENT error. + * + * Generated from protobuf enum TARGET_PLATFORM_UNSPECIFIED = 0; + */ + const TARGET_PLATFORM_UNSPECIFIED = 0; + /** + * Google App Engine service. + * + * Generated from protobuf enum APP_ENGINE = 1; + */ + const APP_ENGINE = 1; + /** + * Google Compute Engine service. + * + * Generated from protobuf enum COMPUTE = 2; + */ + const COMPUTE = 2; + + private static $valueToName = [ + self::TARGET_PLATFORM_UNSPECIFIED => 'TARGET_PLATFORM_UNSPECIFIED', + self::APP_ENGINE => 'APP_ENGINE', + self::COMPUTE => 'COMPUTE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TargetPlatform::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_TargetPlatform::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/UserAgent.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/UserAgent.php new file mode 100644 index 00000000000..9cd064a73ae --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfig/UserAgent.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1beta.ScanConfig.UserAgent + */ +class UserAgent +{ + /** + * The user agent is unknown. Service will default to CHROME_LINUX. + * + * Generated from protobuf enum USER_AGENT_UNSPECIFIED = 0; + */ + const USER_AGENT_UNSPECIFIED = 0; + /** + * Chrome on Linux. This is the service default if unspecified. + * + * Generated from protobuf enum CHROME_LINUX = 1; + */ + const CHROME_LINUX = 1; + /** + * Chrome on Android. + * + * Generated from protobuf enum CHROME_ANDROID = 2; + */ + const CHROME_ANDROID = 2; + /** + * Safari on IPhone. + * + * Generated from protobuf enum SAFARI_IPHONE = 3; + */ + const SAFARI_IPHONE = 3; + + private static $valueToName = [ + self::USER_AGENT_UNSPECIFIED => 'USER_AGENT_UNSPECIFIED', + self::CHROME_LINUX => 'CHROME_LINUX', + self::CHROME_ANDROID => 'CHROME_ANDROID', + self::SAFARI_IPHONE => 'SAFARI_IPHONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserAgent::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig_UserAgent::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError.php new file mode 100644 index 00000000000..7cfb778f8c6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError.php @@ -0,0 +1,116 @@ +google.cloud.websecurityscanner.v1beta.ScanConfigError + */ +class ScanConfigError extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError.Code code = 1; + */ + protected $code = 0; + /** + * Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + */ + protected $field_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Indicates the reason code for a configuration failure. + * @type string $field_name + * Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanConfigError::initOnce(); + parent::__construct($data); + } + + /** + * Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Indicates the reason code for a configuration failure. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError\Code::class); + $this->code = $var; + + return $this; + } + + /** + * Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + * @return string + */ + public function getFieldName() + { + return $this->field_name; + } + + /** + * Indicates the full name of the ScanConfig field that triggers this error, + * for example "scan_config.max_qps". This field is provided for + * troubleshooting purposes only and its actual value can change in the + * future. + * + * Generated from protobuf field string field_name = 2; + * @param string $var + * @return $this + */ + public function setFieldName($var) + { + GPBUtil::checkString($var, True); + $this->field_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError/Code.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError/Code.php new file mode 100644 index 00000000000..784be1b6cbc --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanConfigError/Code.php @@ -0,0 +1,355 @@ +google.cloud.websecurityscanner.v1beta.ScanConfigError.Code + */ +class Code +{ + /** + * There is no error. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * There is no error. + * + * Generated from protobuf enum OK = 0; + */ + const OK = 0; + /** + * Indicates an internal server error. + * Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + * + * Generated from protobuf enum INTERNAL_ERROR = 1; + */ + const INTERNAL_ERROR = 1; + /** + * One of the seed URLs is an App Engine URL but we cannot validate the scan + * settings due to an App Engine API backend error. + * + * Generated from protobuf enum APPENGINE_API_BACKEND_ERROR = 2; + */ + const APPENGINE_API_BACKEND_ERROR = 2; + /** + * One of the seed URLs is an App Engine URL but we cannot access the + * App Engine API to validate scan settings. + * + * Generated from protobuf enum APPENGINE_API_NOT_ACCESSIBLE = 3; + */ + const APPENGINE_API_NOT_ACCESSIBLE = 3; + /** + * One of the seed URLs is an App Engine URL but the Default Host of the + * App Engine is not set. + * + * Generated from protobuf enum APPENGINE_DEFAULT_HOST_MISSING = 4; + */ + const APPENGINE_DEFAULT_HOST_MISSING = 4; + /** + * Google corporate accounts can not be used for scanning. + * + * Generated from protobuf enum CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + */ + const CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + /** + * The account of the scan creator can not be used for scanning. + * + * Generated from protobuf enum CANNOT_USE_OWNER_ACCOUNT = 7; + */ + const CANNOT_USE_OWNER_ACCOUNT = 7; + /** + * This scan targets Compute Engine, but we cannot validate scan settings + * due to a Compute Engine API backend error. + * + * Generated from protobuf enum COMPUTE_API_BACKEND_ERROR = 8; + */ + const COMPUTE_API_BACKEND_ERROR = 8; + /** + * This scan targets Compute Engine, but we cannot access the Compute Engine + * API to validate the scan settings. + * + * Generated from protobuf enum COMPUTE_API_NOT_ACCESSIBLE = 9; + */ + const COMPUTE_API_NOT_ACCESSIBLE = 9; + /** + * The Custom Login URL does not belong to the current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + */ + const CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + /** + * The Custom Login URL is malformed (can not be parsed). + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MALFORMED = 11; + */ + const CUSTOM_LOGIN_URL_MALFORMED = 11; + /** + * The Custom Login URL is mapped to a non-routable IP address in DNS. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + */ + const CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + /** + * The Custom Login URL is mapped to an IP address which is not reserved for + * the current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + */ + const CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + /** + * The Custom Login URL has a non-routable IP address. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + */ + const CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + /** + * The Custom Login URL has an IP address which is not reserved for the + * current project. + * + * Generated from protobuf enum CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + */ + const CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + /** + * Another scan with the same name (case-sensitive) already exists. + * + * Generated from protobuf enum DUPLICATE_SCAN_NAME = 16; + */ + const DUPLICATE_SCAN_NAME = 16; + /** + * A field is set to an invalid value. + * + * Generated from protobuf enum INVALID_FIELD_VALUE = 18; + */ + const INVALID_FIELD_VALUE = 18; + /** + * There was an error trying to authenticate to the scan target. + * + * Generated from protobuf enum FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + */ + const FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + /** + * Finding type value is not specified in the list findings request. + * + * Generated from protobuf enum FINDING_TYPE_UNSPECIFIED = 20; + */ + const FINDING_TYPE_UNSPECIFIED = 20; + /** + * Scan targets Compute Engine, yet current project was not whitelisted for + * Google Compute Engine Scanning Alpha access. + * + * Generated from protobuf enum FORBIDDEN_TO_SCAN_COMPUTE = 21; + */ + const FORBIDDEN_TO_SCAN_COMPUTE = 21; + /** + * User tries to update managed scan + * + * Generated from protobuf enum FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + */ + const FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + /** + * The supplied filter is malformed. For example, it can not be parsed, does + * not have a filter type in expression, or the same filter type appears + * more than once. + * + * Generated from protobuf enum MALFORMED_FILTER = 22; + */ + const MALFORMED_FILTER = 22; + /** + * The supplied resource name is malformed (can not be parsed). + * + * Generated from protobuf enum MALFORMED_RESOURCE_NAME = 23; + */ + const MALFORMED_RESOURCE_NAME = 23; + /** + * The current project is not in an active state. + * + * Generated from protobuf enum PROJECT_INACTIVE = 24; + */ + const PROJECT_INACTIVE = 24; + /** + * A required field is not set. + * + * Generated from protobuf enum REQUIRED_FIELD = 25; + */ + const REQUIRED_FIELD = 25; + /** + * Project id, scanconfig id, scanrun id, or finding id are not consistent + * with each other in resource name. + * + * Generated from protobuf enum RESOURCE_NAME_INCONSISTENT = 26; + */ + const RESOURCE_NAME_INCONSISTENT = 26; + /** + * The scan being requested to start is already running. + * + * Generated from protobuf enum SCAN_ALREADY_RUNNING = 27; + */ + const SCAN_ALREADY_RUNNING = 27; + /** + * The scan that was requested to be stopped is not running. + * + * Generated from protobuf enum SCAN_NOT_RUNNING = 28; + */ + const SCAN_NOT_RUNNING = 28; + /** + * One of the seed URLs does not belong to the current project. + * + * Generated from protobuf enum SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + */ + const SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + /** + * One of the seed URLs is malformed (can not be parsed). + * + * Generated from protobuf enum SEED_URL_MALFORMED = 30; + */ + const SEED_URL_MALFORMED = 30; + /** + * One of the seed URLs is mapped to a non-routable IP address in DNS. + * + * Generated from protobuf enum SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + */ + const SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + /** + * One of the seed URLs is mapped to an IP address which is not reserved + * for the current project. + * + * Generated from protobuf enum SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + */ + const SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + /** + * One of the seed URLs has on-routable IP address. + * + * Generated from protobuf enum SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + */ + const SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + /** + * One of the seed URLs has an IP address that is not reserved + * for the current project. + * + * Generated from protobuf enum SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + */ + const SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + /** + * The Cloud Security Scanner service account is not configured under the + * project. + * + * Generated from protobuf enum SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + */ + const SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + /** + * A project has reached the maximum number of scans. + * + * Generated from protobuf enum TOO_MANY_SCANS = 37; + */ + const TOO_MANY_SCANS = 37; + /** + * Resolving the details of the current project fails. + * + * Generated from protobuf enum UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + */ + const UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + /** + * One or more blacklist patterns were in the wrong format. + * + * Generated from protobuf enum UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + */ + const UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + /** + * The supplied filter is not supported. + * + * Generated from protobuf enum UNSUPPORTED_FILTER = 40; + */ + const UNSUPPORTED_FILTER = 40; + /** + * The supplied finding type is not supported. For example, we do not + * provide findings of the given finding type. + * + * Generated from protobuf enum UNSUPPORTED_FINDING_TYPE = 41; + */ + const UNSUPPORTED_FINDING_TYPE = 41; + /** + * The URL scheme of one or more of the supplied URLs is not supported. + * + * Generated from protobuf enum UNSUPPORTED_URL_SCHEME = 42; + */ + const UNSUPPORTED_URL_SCHEME = 42; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::OK => 'OK', + self::INTERNAL_ERROR => 'INTERNAL_ERROR', + self::APPENGINE_API_BACKEND_ERROR => 'APPENGINE_API_BACKEND_ERROR', + self::APPENGINE_API_NOT_ACCESSIBLE => 'APPENGINE_API_NOT_ACCESSIBLE', + self::APPENGINE_DEFAULT_HOST_MISSING => 'APPENGINE_DEFAULT_HOST_MISSING', + self::CANNOT_USE_GOOGLE_COM_ACCOUNT => 'CANNOT_USE_GOOGLE_COM_ACCOUNT', + self::CANNOT_USE_OWNER_ACCOUNT => 'CANNOT_USE_OWNER_ACCOUNT', + self::COMPUTE_API_BACKEND_ERROR => 'COMPUTE_API_BACKEND_ERROR', + self::COMPUTE_API_NOT_ACCESSIBLE => 'COMPUTE_API_NOT_ACCESSIBLE', + self::CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT => 'CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT', + self::CUSTOM_LOGIN_URL_MALFORMED => 'CUSTOM_LOGIN_URL_MALFORMED', + self::CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS => 'CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS', + self::CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS => 'CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS', + self::CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS => 'CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS', + self::CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS => 'CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS', + self::DUPLICATE_SCAN_NAME => 'DUPLICATE_SCAN_NAME', + self::INVALID_FIELD_VALUE => 'INVALID_FIELD_VALUE', + self::FAILED_TO_AUTHENTICATE_TO_TARGET => 'FAILED_TO_AUTHENTICATE_TO_TARGET', + self::FINDING_TYPE_UNSPECIFIED => 'FINDING_TYPE_UNSPECIFIED', + self::FORBIDDEN_TO_SCAN_COMPUTE => 'FORBIDDEN_TO_SCAN_COMPUTE', + self::FORBIDDEN_UPDATE_TO_MANAGED_SCAN => 'FORBIDDEN_UPDATE_TO_MANAGED_SCAN', + self::MALFORMED_FILTER => 'MALFORMED_FILTER', + self::MALFORMED_RESOURCE_NAME => 'MALFORMED_RESOURCE_NAME', + self::PROJECT_INACTIVE => 'PROJECT_INACTIVE', + self::REQUIRED_FIELD => 'REQUIRED_FIELD', + self::RESOURCE_NAME_INCONSISTENT => 'RESOURCE_NAME_INCONSISTENT', + self::SCAN_ALREADY_RUNNING => 'SCAN_ALREADY_RUNNING', + self::SCAN_NOT_RUNNING => 'SCAN_NOT_RUNNING', + self::SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT => 'SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT', + self::SEED_URL_MALFORMED => 'SEED_URL_MALFORMED', + self::SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS => 'SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS', + self::SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS => 'SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS', + self::SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS => 'SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS', + self::SEED_URL_HAS_UNRESERVED_IP_ADDRESS => 'SEED_URL_HAS_UNRESERVED_IP_ADDRESS', + self::SERVICE_ACCOUNT_NOT_CONFIGURED => 'SERVICE_ACCOUNT_NOT_CONFIGURED', + self::TOO_MANY_SCANS => 'TOO_MANY_SCANS', + self::UNABLE_TO_RESOLVE_PROJECT_INFO => 'UNABLE_TO_RESOLVE_PROJECT_INFO', + self::UNSUPPORTED_BLACKLIST_PATTERN_FORMAT => 'UNSUPPORTED_BLACKLIST_PATTERN_FORMAT', + self::UNSUPPORTED_FILTER => 'UNSUPPORTED_FILTER', + self::UNSUPPORTED_FINDING_TYPE => 'UNSUPPORTED_FINDING_TYPE', + self::UNSUPPORTED_URL_SCHEME => 'UNSUPPORTED_URL_SCHEME', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun.php new file mode 100644 index 00000000000..9509062c159 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun.php @@ -0,0 +1,486 @@ +google.cloud.websecurityscanner.v1beta.ScanRun + */ +class ScanRun extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2; + */ + protected $execution_state = 0; + /** + * The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3; + */ + protected $result_state = 0; + /** + * The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + */ + protected $start_time = null; + /** + * The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + */ + protected $end_time = null; + /** + * The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + */ + protected $urls_crawled_count = 0; + /** + * The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + */ + protected $urls_tested_count = 0; + /** + * Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + */ + protected $has_vulnerabilities = false; + /** + * The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + */ + protected $progress_percent = 0; + /** + * If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10; + */ + protected $error_trace = null; + /** + * A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11; + */ + private $warning_traces; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * @type int $execution_state + * The execution state of the ScanRun. + * @type int $result_state + * The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * @type \Google\Protobuf\Timestamp $start_time + * The time at which the ScanRun started. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * @type int|string $urls_crawled_count + * The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * @type int|string $urls_tested_count + * The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * @type bool $has_vulnerabilities + * Whether the scan run has found any vulnerabilities. + * @type int $progress_percent + * The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace $error_trace + * If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace>|\Google\Protobuf\Internal\RepeatedField $warning_traces + * A list of warnings, if such are encountered during this scan run. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanRun::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ScanRun. The name follows the format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * The ScanRun IDs are generated by the system. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2; + * @return int + */ + public function getExecutionState() + { + return $this->execution_state; + } + + /** + * The execution state of the ScanRun. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2; + * @param int $var + * @return $this + */ + public function setExecutionState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun\ExecutionState::class); + $this->execution_state = $var; + + return $this; + } + + /** + * The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3; + * @return int + */ + public function getResultState() + { + return $this->result_state; + } + + /** + * The result state of the ScanRun. This field is only available after the + * execution state reaches "FINISHED". + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3; + * @param int $var + * @return $this + */ + public function setResultState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun\ResultState::class); + $this->result_state = $var; + + return $this; + } + + /** + * The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time at which the ScanRun started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time at which the ScanRun reached termination state - that the ScanRun + * is either finished or stopped by user. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + * @return int|string + */ + public function getUrlsCrawledCount() + { + return $this->urls_crawled_count; + } + + /** + * The number of URLs crawled during this ScanRun. If the scan is in progress, + * the value represents the number of URLs crawled up to now. + * + * Generated from protobuf field int64 urls_crawled_count = 6; + * @param int|string $var + * @return $this + */ + public function setUrlsCrawledCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_crawled_count = $var; + + return $this; + } + + /** + * The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + * @return int|string + */ + public function getUrlsTestedCount() + { + return $this->urls_tested_count; + } + + /** + * The number of URLs tested during this ScanRun. If the scan is in progress, + * the value represents the number of URLs tested up to now. The number of + * URLs tested is usually larger than the number URLS crawled because + * typically a crawled URL is tested with multiple test payloads. + * + * Generated from protobuf field int64 urls_tested_count = 7; + * @param int|string $var + * @return $this + */ + public function setUrlsTestedCount($var) + { + GPBUtil::checkInt64($var); + $this->urls_tested_count = $var; + + return $this; + } + + /** + * Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + * @return bool + */ + public function getHasVulnerabilities() + { + return $this->has_vulnerabilities; + } + + /** + * Whether the scan run has found any vulnerabilities. + * + * Generated from protobuf field bool has_vulnerabilities = 8; + * @param bool $var + * @return $this + */ + public function setHasVulnerabilities($var) + { + GPBUtil::checkBool($var); + $this->has_vulnerabilities = $var; + + return $this; + } + + /** + * The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * The percentage of total completion ranging from 0 to 100. + * If the scan is in queue, the value is 0. + * If the scan is running, the value ranges from 0 to 100. + * If the scan is finished, the value is 100. + * + * Generated from protobuf field int32 progress_percent = 9; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace|null + */ + public function getErrorTrace() + { + return $this->error_trace; + } + + public function hasErrorTrace() + { + return isset($this->error_trace); + } + + public function clearErrorTrace() + { + unset($this->error_trace); + } + + /** + * If result_state is an ERROR, this field provides the primary reason for + * scan's termination and more details, if such are available. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace $var + * @return $this + */ + public function setErrorTrace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace::class); + $this->error_trace = $var; + + return $this; + } + + /** + * A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWarningTraces() + { + return $this->warning_traces; + } + + /** + * A list of warnings, if such are encountered during this scan run. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWarningTraces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace::class); + $this->warning_traces = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ExecutionState.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ExecutionState.php new file mode 100644 index 00000000000..b2d9504fcff --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ExecutionState.php @@ -0,0 +1,72 @@ +google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState + */ +class ExecutionState +{ + /** + * Represents an invalid state caused by internal server error. This value + * should never be returned. + * + * Generated from protobuf enum EXECUTION_STATE_UNSPECIFIED = 0; + */ + const EXECUTION_STATE_UNSPECIFIED = 0; + /** + * The scan is waiting in the queue. + * + * Generated from protobuf enum QUEUED = 1; + */ + const QUEUED = 1; + /** + * The scan is in progress. + * + * Generated from protobuf enum SCANNING = 2; + */ + const SCANNING = 2; + /** + * The scan is either finished or stopped by user. + * + * Generated from protobuf enum FINISHED = 3; + */ + const FINISHED = 3; + + private static $valueToName = [ + self::EXECUTION_STATE_UNSPECIFIED => 'EXECUTION_STATE_UNSPECIFIED', + self::QUEUED => 'QUEUED', + self::SCANNING => 'SCANNING', + self::FINISHED => 'FINISHED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExecutionState::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun_ExecutionState::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ResultState.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ResultState.php new file mode 100644 index 00000000000..4b8395346de --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRun/ResultState.php @@ -0,0 +1,72 @@ +google.cloud.websecurityscanner.v1beta.ScanRun.ResultState + */ +class ResultState +{ + /** + * Default value. This value is returned when the ScanRun is not yet + * finished. + * + * Generated from protobuf enum RESULT_STATE_UNSPECIFIED = 0; + */ + const RESULT_STATE_UNSPECIFIED = 0; + /** + * The scan finished without errors. + * + * Generated from protobuf enum SUCCESS = 1; + */ + const SUCCESS = 1; + /** + * The scan finished with errors. + * + * Generated from protobuf enum ERROR = 2; + */ + const ERROR = 2; + /** + * The scan was terminated by user. + * + * Generated from protobuf enum KILLED = 3; + */ + const KILLED = 3; + + private static $valueToName = [ + self::RESULT_STATE_UNSPECIFIED => 'RESULT_STATE_UNSPECIFIED', + self::SUCCESS => 'SUCCESS', + self::ERROR => 'ERROR', + self::KILLED => 'KILLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResultState::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun_ResultState::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace.php new file mode 100644 index 00000000000..7d229134c53 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace.php @@ -0,0 +1,162 @@ +google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace + */ +class ScanRunErrorTrace extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace.Code code = 1; + */ + protected $code = 0; + /** + * If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError scan_config_error = 2; + */ + protected $scan_config_error = null; + /** + * If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + */ + protected $most_common_http_error_code = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Indicates the error reason code. + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError $scan_config_error + * If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * @type int $most_common_http_error_code + * If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanRunErrorTrace::initOnce(); + parent::__construct($data); + } + + /** + * Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Indicates the error reason code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace\Code::class); + $this->code = $var; + + return $this; + } + + /** + * If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError scan_config_error = 2; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError|null + */ + public function getScanConfigError() + { + return $this->scan_config_error; + } + + public function hasScanConfigError() + { + return isset($this->scan_config_error); + } + + public function clearScanConfigError() + { + unset($this->scan_config_error); + } + + /** + * If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + * message encountered during scan configuration validation that is performed + * before each scan run. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfigError scan_config_error = 2; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError $var + * @return $this + */ + public function setScanConfigError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfigError::class); + $this->scan_config_error = $var; + + return $this; + } + + /** + * If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + * @return int + */ + public function getMostCommonHttpErrorCode() + { + return $this->most_common_http_error_code; + } + + /** + * If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + * common HTTP error code, if such is available. For example, if this code is + * 404, the scan has encountered too many NOT_FOUND responses. + * + * Generated from protobuf field int32 most_common_http_error_code = 3; + * @param int $var + * @return $this + */ + public function setMostCommonHttpErrorCode($var) + { + GPBUtil::checkInt32($var); + $this->most_common_http_error_code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace/Code.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace/Code.php new file mode 100644 index 00000000000..f4290adb07b --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunErrorTrace/Code.php @@ -0,0 +1,99 @@ +google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace.Code + */ +class Code +{ + /** + * Default value is never used. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * Indicates that the scan run failed due to an internal server error. + * + * Generated from protobuf enum INTERNAL_ERROR = 1; + */ + const INTERNAL_ERROR = 1; + /** + * Indicates a scan configuration error, usually due to outdated ScanConfig + * settings, such as starting_urls or the DNS configuration. + * + * Generated from protobuf enum SCAN_CONFIG_ISSUE = 2; + */ + const SCAN_CONFIG_ISSUE = 2; + /** + * Indicates an authentication error, usually due to outdated ScanConfig + * authentication settings. + * + * Generated from protobuf enum AUTHENTICATION_CONFIG_ISSUE = 3; + */ + const AUTHENTICATION_CONFIG_ISSUE = 3; + /** + * Indicates a scan operation timeout, usually caused by a very large site. + * + * Generated from protobuf enum TIMED_OUT_WHILE_SCANNING = 4; + */ + const TIMED_OUT_WHILE_SCANNING = 4; + /** + * Indicates that a scan encountered excessive redirects, either to + * authentication or some other page outside of the scan scope. + * + * Generated from protobuf enum TOO_MANY_REDIRECTS = 5; + */ + const TOO_MANY_REDIRECTS = 5; + /** + * Indicates that a scan encountered numerous errors from the web site + * pages. When available, most_common_http_error_code field indicates the + * most common HTTP error code encountered during the scan. + * + * Generated from protobuf enum TOO_MANY_HTTP_ERRORS = 6; + */ + const TOO_MANY_HTTP_ERRORS = 6; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::INTERNAL_ERROR => 'INTERNAL_ERROR', + self::SCAN_CONFIG_ISSUE => 'SCAN_CONFIG_ISSUE', + self::AUTHENTICATION_CONFIG_ISSUE => 'AUTHENTICATION_CONFIG_ISSUE', + self::TIMED_OUT_WHILE_SCANNING => 'TIMED_OUT_WHILE_SCANNING', + self::TOO_MANY_REDIRECTS => 'TOO_MANY_REDIRECTS', + self::TOO_MANY_HTTP_ERRORS => 'TOO_MANY_HTTP_ERRORS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace.php new file mode 100644 index 00000000000..35402b245a0 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace.php @@ -0,0 +1,69 @@ +google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace + */ +class ScanRunWarningTrace extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace.Code code = 1; + */ + protected $code = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Indicates the warning code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanRunWarningTrace::initOnce(); + parent::__construct($data); + } + + /** + * Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace.Code code = 1; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Indicates the warning code. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace.Code code = 1; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace\Code::class); + $this->code = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace/Code.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace/Code.php new file mode 100644 index 00000000000..91ec840d317 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ScanRunWarningTrace/Code.php @@ -0,0 +1,85 @@ +google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace.Code + */ +class Code +{ + /** + * Default value is never used. + * + * Generated from protobuf enum CODE_UNSPECIFIED = 0; + */ + const CODE_UNSPECIFIED = 0; + /** + * Indicates that a scan discovered an unexpectedly low number of URLs. This + * is sometimes caused by complex navigation features or by using a single + * URL for numerous pages. + * + * Generated from protobuf enum INSUFFICIENT_CRAWL_RESULTS = 1; + */ + const INSUFFICIENT_CRAWL_RESULTS = 1; + /** + * Indicates that a scan discovered too many URLs to test, or excessive + * redundant URLs. + * + * Generated from protobuf enum TOO_MANY_CRAWL_RESULTS = 2; + */ + const TOO_MANY_CRAWL_RESULTS = 2; + /** + * Indicates that too many tests have been generated for the scan. Customer + * should try reducing the number of starting URLs, increasing the QPS rate, + * or narrowing down the scope of the scan using the excluded patterns. + * + * Generated from protobuf enum TOO_MANY_FUZZ_TASKS = 3; + */ + const TOO_MANY_FUZZ_TASKS = 3; + /** + * Indicates that a scan is blocked by IAP. + * + * Generated from protobuf enum BLOCKED_BY_IAP = 4; + */ + const BLOCKED_BY_IAP = 4; + + private static $valueToName = [ + self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED', + self::INSUFFICIENT_CRAWL_RESULTS => 'INSUFFICIENT_CRAWL_RESULTS', + self::TOO_MANY_CRAWL_RESULTS => 'TOO_MANY_CRAWL_RESULTS', + self::TOO_MANY_FUZZ_TASKS => 'TOO_MANY_FUZZ_TASKS', + self::BLOCKED_BY_IAP => 'BLOCKED_BY_IAP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Code::class, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace_Code::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StartScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StartScanRunRequest.php new file mode 100644 index 00000000000..ba7617eae7c --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StartScanRunRequest.php @@ -0,0 +1,71 @@ +google.cloud.websecurityscanner.v1beta.StartScanRunRequest + */ +class StartScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StopScanRunRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StopScanRunRequest.php new file mode 100644 index 00000000000..04ad4e12c5f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/StopScanRunRequest.php @@ -0,0 +1,75 @@ +google.cloud.websecurityscanner.v1beta.StopScanRunRequest + */ +class StopScanRunRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/UpdateScanConfigRequest.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/UpdateScanConfigRequest.php new file mode 100644 index 00000000000..6446f709c20 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/UpdateScanConfigRequest.php @@ -0,0 +1,137 @@ +google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest + */ +class UpdateScanConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $scan_config = null; + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig $scan_config + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\WebSecurityScanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig|null + */ + public function getScanConfig() + { + return $this->scan_config; + } + + public function hasScanConfig() + { + return isset($this->scan_config); + } + + public function clearScanConfig() + { + unset($this->scan_config); + } + + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * + * Generated from protobuf field .google.cloud.websecurityscanner.v1beta.ScanConfig scan_config = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig $var + * @return $this + */ + public function setScanConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanConfig::class); + $this->scan_config = $var; + + return $this; + } + + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ViolatingResource.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ViolatingResource.php new file mode 100644 index 00000000000..e1e3a3cd0c1 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/ViolatingResource.php @@ -0,0 +1,102 @@ +google.cloud.websecurityscanner.v1beta.ViolatingResource + */ +class ViolatingResource extends \Google\Protobuf\Internal\Message +{ + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + */ + protected $content_type = ''; + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + */ + protected $resource_url = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content_type + * The MIME type of this resource. + * @type string $resource_url + * URL of this violating resource. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + * @return string + */ + public function getContentType() + { + return $this->content_type; + } + + /** + * The MIME type of this resource. + * + * Generated from protobuf field string content_type = 1; + * @param string $var + * @return $this + */ + public function setContentType($var) + { + GPBUtil::checkString($var, True); + $this->content_type = $var; + + return $this; + } + + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + * @return string + */ + public function getResourceUrl() + { + return $this->resource_url; + } + + /** + * URL of this violating resource. + * + * Generated from protobuf field string resource_url = 2; + * @param string $var + * @return $this + */ + public function setResourceUrl($var) + { + GPBUtil::checkString($var, True); + $this->resource_url = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders.php new file mode 100644 index 00000000000..9f1a8f04053 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders.php @@ -0,0 +1,101 @@ +google.cloud.websecurityscanner.v1beta.VulnerableHeaders + */ +class VulnerableHeaders extends \Google\Protobuf\Internal\Message +{ + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header headers = 1; + */ + private $headers; + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header missing_headers = 2; + */ + private $missing_headers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $headers + * List of vulnerable headers. + * @type array<\Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $missing_headers + * List of missing headers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header headers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * List of vulnerable headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header headers = 1; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header::class); + $this->headers = $arr; + + return $this; + } + + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header missing_headers = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMissingHeaders() + { + return $this->missing_headers; + } + + /** + * List of missing headers. + * + * Generated from protobuf field repeated .google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header missing_headers = 2; + * @param array<\Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMissingHeaders($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders\Header::class); + $this->missing_headers = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders/Header.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders/Header.php new file mode 100644 index 00000000000..5a1aa140705 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableHeaders/Header.php @@ -0,0 +1,104 @@ +google.cloud.websecurityscanner.v1beta.VulnerableHeaders.Header + */ +class Header extends \Google\Protobuf\Internal\Message +{ + /** + * Header name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Header value. + * + * Generated from protobuf field string value = 2; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Header name. + * @type string $value + * Header value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * Header name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Header name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Header value. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Header value. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Header::class, \Google\Cloud\WebSecurityScanner\V1beta\VulnerableHeaders_Header::class); + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableParameters.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableParameters.php new file mode 100644 index 00000000000..97f40daec8e --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/VulnerableParameters.php @@ -0,0 +1,67 @@ +google.cloud.websecurityscanner.v1beta.VulnerableParameters + */ +class VulnerableParameters extends \Google\Protobuf\Internal\Message +{ + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + */ + private $parameter_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $parameter_names + * The vulnerable parameter names. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameterNames() + { + return $this->parameter_names; + } + + /** + * The vulnerable parameter names. + * + * Generated from protobuf field repeated string parameter_names = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameterNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->parameter_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Xss.php b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Xss.php new file mode 100644 index 00000000000..c3a460821df --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/proto/src/Google/Cloud/WebSecurityScanner/V1beta/Xss.php @@ -0,0 +1,101 @@ +google.cloud.websecurityscanner.v1beta.Xss + */ +class Xss extends \Google\Protobuf\Internal\Message +{ + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + */ + private $stack_traces; + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + */ + protected $error_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $stack_traces + * Stack traces leading to the point where the XSS occurred. + * @type string $error_message + * An error message generated by a javascript breakage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\FindingAddon::initOnce(); + parent::__construct($data); + } + + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStackTraces() + { + return $this->stack_traces; + } + + /** + * Stack traces leading to the point where the XSS occurred. + * + * Generated from protobuf field repeated string stack_traces = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStackTraces($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->stack_traces = $arr; + + return $this; + } + + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + * @return string + */ + public function getErrorMessage() + { + return $this->error_message; + } + + /** + * An error message generated by a javascript breakage. + * + * Generated from protobuf field string error_message = 2; + * @param string $var + * @return $this + */ + public function setErrorMessage($var) + { + GPBUtil::checkString($var, True); + $this->error_message = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/create_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/create_scan_config.php new file mode 100644 index 00000000000..3a55721e622 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/create_scan_config.php @@ -0,0 +1,80 @@ +setDisplayName($scanConfigDisplayName) + ->setStartingUrls($scanConfigStartingUrls); + + // Call the API and handle any network failures. + try { + /** @var ScanConfig $response */ + $response = $webSecurityScannerClient->createScanConfig($formattedParent, $scanConfig); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::projectName('[PROJECT]'); + $scanConfigDisplayName = '[DISPLAY_NAME]'; + $scanConfigStartingUrlsElement = '[STARTING_URLS]'; + + create_scan_config_sample($formattedParent, $scanConfigDisplayName, $scanConfigStartingUrlsElement); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/delete_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/delete_scan_config.php new file mode 100644 index 00000000000..ba97c137fd4 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/delete_scan_config.php @@ -0,0 +1,65 @@ +deleteScanConfig($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + + delete_scan_config_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_finding.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_finding.php new file mode 100644 index 00000000000..6ef3cfb1da6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_finding.php @@ -0,0 +1,73 @@ +getFinding($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::findingName( + '[PROJECT]', + '[SCAN_CONFIG]', + '[SCAN_RUN]', + '[FINDING]' + ); + + get_finding_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_config.php new file mode 100644 index 00000000000..3c554c2dc96 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_config.php @@ -0,0 +1,67 @@ +getScanConfig($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + + get_scan_config_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_run.php new file mode 100644 index 00000000000..633fbe6cf4d --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/get_scan_run.php @@ -0,0 +1,68 @@ +getScanRun($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + + get_scan_run_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_crawled_urls.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_crawled_urls.php new file mode 100644 index 00000000000..ad58a2b382f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_crawled_urls.php @@ -0,0 +1,77 @@ +listCrawledUrls($formattedParent); + + /** @var CrawledUrl $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::scanRunName( + '[PROJECT]', + '[SCAN_CONFIG]', + '[SCAN_RUN]' + ); + + list_crawled_urls_sample($formattedParent); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_finding_type_stats.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_finding_type_stats.php new file mode 100644 index 00000000000..43bd3c4702c --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_finding_type_stats.php @@ -0,0 +1,72 @@ +listFindingTypeStats($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::scanRunName( + '[PROJECT]', + '[SCAN_CONFIG]', + '[SCAN_RUN]' + ); + + list_finding_type_stats_sample($formattedParent); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_findings.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_findings.php new file mode 100644 index 00000000000..2047fcca867 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_findings.php @@ -0,0 +1,82 @@ + + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ +function list_findings_sample(string $formattedParent, string $filter): void +{ + // Create a client. + $webSecurityScannerClient = new WebSecurityScannerClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $webSecurityScannerClient->listFindings($formattedParent, $filter); + + /** @var Finding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::scanRunName( + '[PROJECT]', + '[SCAN_CONFIG]', + '[SCAN_RUN]' + ); + $filter = '[FILTER]'; + + list_findings_sample($formattedParent, $filter); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_configs.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_configs.php new file mode 100644 index 00000000000..584ed6bae00 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_configs.php @@ -0,0 +1,72 @@ +listScanConfigs($formattedParent); + + /** @var ScanConfig $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::projectName('[PROJECT]'); + + list_scan_configs_sample($formattedParent); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_runs.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_runs.php new file mode 100644 index 00000000000..086b76fa3b6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/list_scan_runs.php @@ -0,0 +1,73 @@ +listScanRuns($formattedParent); + + /** @var ScanRun $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebSecurityScannerClient::scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + + list_scan_runs_sample($formattedParent); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/start_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/start_scan_run.php new file mode 100644 index 00000000000..071762269e6 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/start_scan_run.php @@ -0,0 +1,67 @@ +startScanRun($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + + start_scan_run_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/stop_scan_run.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/stop_scan_run.php new file mode 100644 index 00000000000..4905c181ddd --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/stop_scan_run.php @@ -0,0 +1,68 @@ +stopScanRun($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebSecurityScannerClient::scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + + stop_scan_run_sample($formattedName); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/update_scan_config.php b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/update_scan_config.php new file mode 100644 index 00000000000..0f6700aad85 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/samples/V1beta/WebSecurityScannerClient/update_scan_config.php @@ -0,0 +1,77 @@ +setDisplayName($scanConfigDisplayName) + ->setStartingUrls($scanConfigStartingUrls); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var ScanConfig $response */ + $response = $webSecurityScannerClient->updateScanConfig($scanConfig, $updateMask); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $scanConfigDisplayName = '[DISPLAY_NAME]'; + $scanConfigStartingUrlsElement = '[STARTING_URLS]'; + + update_scan_config_sample($scanConfigDisplayName, $scanConfigStartingUrlsElement); +} +// [END websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_sync] diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/Gapic/WebSecurityScannerGapicClient.php b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/Gapic/WebSecurityScannerGapicClient.php new file mode 100644 index 00000000000..4fb18a08a12 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/Gapic/WebSecurityScannerGapicClient.php @@ -0,0 +1,1066 @@ +projectName('[PROJECT]'); + * $scanConfig = new ScanConfig(); + * $response = $webSecurityScannerClient->createScanConfig($formattedParent, $scanConfig); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + * + * @deprecated This class will be removed in the next major version update. + */ +class WebSecurityScannerGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'websecurityscanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'websecurityscanner.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 static $findingNameTemplate; + + private static $projectNameTemplate; + + private static $scanConfigNameTemplate; + + private static $scanRunNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/web_security_scanner_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/web_security_scanner_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/web_security_scanner_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/web_security_scanner_rest_client_config.php', + ], + ], + ]; + } + + private static function getFindingNameTemplate() + { + if (self::$findingNameTemplate == null) { + self::$findingNameTemplate = new PathTemplate('projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}'); + } + + return self::$findingNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getScanConfigNameTemplate() + { + if (self::$scanConfigNameTemplate == null) { + self::$scanConfigNameTemplate = new PathTemplate('projects/{project}/scanConfigs/{scan_config}'); + } + + return self::$scanConfigNameTemplate; + } + + private static function getScanRunNameTemplate() + { + if (self::$scanRunNameTemplate == null) { + self::$scanRunNameTemplate = new PathTemplate('projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}'); + } + + return self::$scanRunNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'finding' => self::getFindingNameTemplate(), + 'project' => self::getProjectNameTemplate(), + 'scanConfig' => self::getScanConfigNameTemplate(), + 'scanRun' => self::getScanRunNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a finding + * resource. + * + * @param string $project + * @param string $scanConfig + * @param string $scanRun + * @param string $finding + * + * @return string The formatted finding resource. + * + * @experimental + */ + public static function findingName($project, $scanConfig, $scanRun, $finding) + { + return self::getFindingNameTemplate()->render([ + 'project' => $project, + 'scan_config' => $scanConfig, + 'scan_run' => $scanRun, + 'finding' => $finding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a scan_config + * resource. + * + * @param string $project + * @param string $scanConfig + * + * @return string The formatted scan_config resource. + * + * @experimental + */ + public static function scanConfigName($project, $scanConfig) + { + return self::getScanConfigNameTemplate()->render([ + 'project' => $project, + 'scan_config' => $scanConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a scan_run + * resource. + * + * @param string $project + * @param string $scanConfig + * @param string $scanRun + * + * @return string The formatted scan_run resource. + * + * @experimental + */ + public static function scanRunName($project, $scanConfig, $scanRun) + { + return self::getScanRunNameTemplate()->render([ + 'project' => $project, + 'scan_config' => $scanConfig, + 'scan_run' => $scanRun, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - finding: projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding} + * - project: projects/{project} + * - scanConfig: projects/{project}/scanConfigs/{scan_config} + * - scanRun: projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'websecurityscanner.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a new ScanConfig. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->projectName('[PROJECT]'); + * $scanConfig = new ScanConfig(); + * $response = $webSecurityScannerClient->createScanConfig($formattedParent, $scanConfig); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param ScanConfig $scanConfig Required. The ScanConfig to be created. + * @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\Cloud\WebSecurityScanner\V1beta\ScanConfig + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createScanConfig($parent, $scanConfig, array $optionalArgs = []) + { + $request = new CreateScanConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setScanConfig($scanConfig); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateScanConfig', ScanConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an existing ScanConfig and its child resources. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + * $webSecurityScannerClient->deleteScanConfig($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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. + * } + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteScanConfig($name, array $optionalArgs = []) + { + $request = new DeleteScanConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteScanConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a Finding. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->findingName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]', '[FINDING]'); + * $response = $webSecurityScannerClient->getFinding($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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\Cloud\WebSecurityScanner\V1beta\Finding + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getFinding($name, array $optionalArgs = []) + { + $request = new GetFindingRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFinding', Finding::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a ScanConfig. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + * $response = $webSecurityScannerClient->getScanConfig($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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\Cloud\WebSecurityScanner\V1beta\ScanConfig + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getScanConfig($name, array $optionalArgs = []) + { + $request = new GetScanConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetScanConfig', ScanConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a ScanRun. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + * $response = $webSecurityScannerClient->getScanRun($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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\Cloud\WebSecurityScanner\V1beta\ScanRun + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getScanRun($name, array $optionalArgs = []) + { + $request = new GetScanRunRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetScanRun', ScanRun::class, $optionalArgs, $request)->wait(); + } + + /** + * List CrawledUrls under a given ScanRun. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + * // Iterate over pages of elements + * $pagedResponse = $webSecurityScannerClient->listCrawledUrls($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webSecurityScannerClient->listCrawledUrls($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listCrawledUrls($parent, array $optionalArgs = []) + { + $request = new ListCrawledUrlsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListCrawledUrls', $optionalArgs, ListCrawledUrlsResponse::class, $request); + } + + /** + * List all FindingTypeStats under a given ScanRun. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + * $response = $webSecurityScannerClient->listFindingTypeStats($formattedParent); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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\Cloud\WebSecurityScanner\V1beta\ListFindingTypeStatsResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listFindingTypeStats($parent, array $optionalArgs = []) + { + $request = new ListFindingTypeStatsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ListFindingTypeStats', ListFindingTypeStatsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * List Findings under a given ScanRun. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + * $filter = 'filter'; + * // Iterate over pages of elements + * $pagedResponse = $webSecurityScannerClient->listFindings($formattedParent, $filter); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webSecurityScannerClient->listFindings($formattedParent, $filter); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param string $filter Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listFindings($parent, $filter, array $optionalArgs = []) + { + $request = new ListFindingsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFilter($filter); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListFindings', $optionalArgs, ListFindingsResponse::class, $request); + } + + /** + * Lists ScanConfigs under a given project. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $webSecurityScannerClient->listScanConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webSecurityScannerClient->listScanConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listScanConfigs($parent, array $optionalArgs = []) + { + $request = new ListScanConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListScanConfigs', $optionalArgs, ListScanConfigsResponse::class, $request); + } + + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedParent = $webSecurityScannerClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + * // Iterate over pages of elements + * $pagedResponse = $webSecurityScannerClient->listScanRuns($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webSecurityScannerClient->listScanRuns($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param array $optionalArgs { + * Optional. + * + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listScanRuns($parent, array $optionalArgs = []) + { + $request = new ListScanRunsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListScanRuns', $optionalArgs, ListScanRunsResponse::class, $request); + } + + /** + * Start a ScanRun according to the given ScanConfig. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + * $response = $webSecurityScannerClient->startScanRun($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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\Cloud\WebSecurityScanner\V1beta\ScanRun + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function startScanRun($name, array $optionalArgs = []) + { + $request = new StartScanRunRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StartScanRun', ScanRun::class, $optionalArgs, $request)->wait(); + } + + /** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $formattedName = $webSecurityScannerClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + * $response = $webSecurityScannerClient->stopScanRun($formattedName); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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\Cloud\WebSecurityScanner\V1beta\ScanRun + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function stopScanRun($name, array $optionalArgs = []) + { + $request = new StopScanRunRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StopScanRun', ScanRun::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * Sample code: + * ``` + * $webSecurityScannerClient = new WebSecurityScannerClient(); + * try { + * $scanConfig = new ScanConfig(); + * $updateMask = new FieldMask(); + * $response = $webSecurityScannerClient->updateScanConfig($scanConfig, $updateMask); + * } finally { + * $webSecurityScannerClient->close(); + * } + * ``` + * + * @param ScanConfig $scanConfig Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param FieldMask $updateMask Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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\Cloud\WebSecurityScanner\V1beta\ScanConfig + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function updateScanConfig($scanConfig, $updateMask, array $optionalArgs = []) + { + $request = new UpdateScanConfigRequest(); + $requestParamHeaders = []; + $request->setScanConfig($scanConfig); + $request->setUpdateMask($updateMask); + $requestParamHeaders['scan_config.name'] = $scanConfig->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateScanConfig', ScanConfig::class, $optionalArgs, $request)->wait(); + } +} diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/WebSecurityScannerClient.php b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/WebSecurityScannerClient.php new file mode 100644 index 00000000000..7e0c87f845c --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/WebSecurityScannerClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner' => [ + 'ListCrawledUrls' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCrawledUrls', + ], + ], + 'ListFindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFindings', + ], + ], + 'ListScanConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScanConfigs', + ], + ], + 'ListScanRuns' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScanRuns', + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/resources/web_security_scanner_rest_client_config.php b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/resources/web_security_scanner_rest_client_config.php new file mode 100644 index 00000000000..e3cc5c7648f --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/src/V1beta/resources/web_security_scanner_rest_client_config.php @@ -0,0 +1,163 @@ + [ + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner' => [ + 'CreateScanConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*}/scanConfigs', + 'body' => 'scan_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteScanConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetFinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScanConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScanRun' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListCrawledUrls' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindingTypeStats' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListFindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'filter', + ], + ], + 'ListScanConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*}/scanConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScanRuns' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'StartScanRun' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*}:start', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'StopScanRun' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateScanConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{scan_config.name=projects/*/scanConfigs/*}', + 'body' => 'scan_config', + 'placeholders' => [ + 'scan_config.name' => [ + 'getters' => [ + 'getScanConfig', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/WebSecurityScanner/v1beta/tests/Unit/V1beta/WebSecurityScannerClientTest.php b/owl-bot-staging/WebSecurityScanner/v1beta/tests/Unit/V1beta/WebSecurityScannerClientTest.php new file mode 100644 index 00000000000..b5fbdb81d48 --- /dev/null +++ b/owl-bot-staging/WebSecurityScanner/v1beta/tests/Unit/V1beta/WebSecurityScannerClientTest.php @@ -0,0 +1,960 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WebSecurityScannerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WebSecurityScannerClient($options); + } + + /** @test */ + public function createScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $scanConfig = new ScanConfig(); + $scanConfigDisplayName = 'scanConfigDisplayName-609132338'; + $scanConfig->setDisplayName($scanConfigDisplayName); + $scanConfigStartingUrls = []; + $scanConfig->setStartingUrls($scanConfigStartingUrls); + $response = $gapicClient->createScanConfig($formattedParent, $scanConfig); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/CreateScanConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getScanConfig(); + $this->assertProtobufEquals($scanConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createScanConfigExceptionTest() + { + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $scanConfig = new ScanConfig(); + $scanConfigDisplayName = 'scanConfigDisplayName-609132338'; + $scanConfig->setDisplayName($scanConfigDisplayName); + $scanConfigStartingUrls = []; + $scanConfig->setStartingUrls($scanConfigStartingUrls); + try { + $gapicClient->createScanConfig($formattedParent, $scanConfig); + // 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()); + } + + /** @test */ + public function deleteScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + $gapicClient->deleteScanConfig($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/DeleteScanConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteScanConfigExceptionTest() + { + $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 + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + try { + $gapicClient->deleteScanConfig($formattedName); + // 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()); + } + + /** @test */ + public function getFindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $findingType = 'findingType274496048'; + $httpMethod = 'httpMethod820747384'; + $fuzzedUrl = 'fuzzedUrl-2120677666'; + $body = 'body3029410'; + $description = 'description-1724546052'; + $reproductionUrl = 'reproductionUrl-244934180'; + $frameUrl = 'frameUrl545464221'; + $finalUrl = 'finalUrl355601190'; + $trackingId = 'trackingId1878901667'; + $expectedResponse = new Finding(); + $expectedResponse->setName($name2); + $expectedResponse->setFindingType($findingType); + $expectedResponse->setHttpMethod($httpMethod); + $expectedResponse->setFuzzedUrl($fuzzedUrl); + $expectedResponse->setBody($body); + $expectedResponse->setDescription($description); + $expectedResponse->setReproductionUrl($reproductionUrl); + $expectedResponse->setFrameUrl($frameUrl); + $expectedResponse->setFinalUrl($finalUrl); + $expectedResponse->setTrackingId($trackingId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->findingName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]', '[FINDING]'); + $response = $gapicClient->getFinding($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/GetFinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFindingExceptionTest() + { + $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 + $formattedName = $gapicClient->findingName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]', '[FINDING]'); + try { + $gapicClient->getFinding($formattedName); + // 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()); + } + + /** @test */ + public function getScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + $response = $gapicClient->getScanConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/GetScanConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScanConfigExceptionTest() + { + $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 + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + try { + $gapicClient->getScanConfig($formattedName); + // 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()); + } + + /** @test */ + public function getScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $response = $gapicClient->getScanRun($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/GetScanRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScanRunExceptionTest() + { + $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 + $formattedName = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + try { + $gapicClient->getScanRun($formattedName); + // 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()); + } + + /** @test */ + public function listCrawledUrlsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $crawledUrlsElement = new CrawledUrl(); + $crawledUrls = [ + $crawledUrlsElement, + ]; + $expectedResponse = new ListCrawledUrlsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCrawledUrls($crawledUrls); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $response = $gapicClient->listCrawledUrls($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCrawledUrls()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/ListCrawledUrls', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCrawledUrlsExceptionTest() + { + $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 + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + try { + $gapicClient->listCrawledUrls($formattedParent); + // 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()); + } + + /** @test */ + public function listFindingTypeStatsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListFindingTypeStatsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $response = $gapicClient->listFindingTypeStats($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/ListFindingTypeStats', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFindingTypeStatsExceptionTest() + { + $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 + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + try { + $gapicClient->listFindingTypeStats($formattedParent); + // 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()); + } + + /** @test */ + public function listFindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $findingsElement = new Finding(); + $findings = [ + $findingsElement, + ]; + $expectedResponse = new ListFindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFindings($findings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $filter = 'filter-1274492040'; + $response = $gapicClient->listFindings($formattedParent, $filter); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/ListFindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getFilter(); + $this->assertProtobufEquals($filter, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFindingsExceptionTest() + { + $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 + $formattedParent = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $filter = 'filter-1274492040'; + try { + $gapicClient->listFindings($formattedParent, $filter); + // 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()); + } + + /** @test */ + public function listScanConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scanConfigsElement = new ScanConfig(); + $scanConfigs = [ + $scanConfigsElement, + ]; + $expectedResponse = new ListScanConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScanConfigs($scanConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listScanConfigs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScanConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/ListScanConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScanConfigsExceptionTest() + { + $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 + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listScanConfigs($formattedParent); + // 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()); + } + + /** @test */ + public function listScanRunsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scanRunsElement = new ScanRun(); + $scanRuns = [ + $scanRunsElement, + ]; + $expectedResponse = new ListScanRunsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScanRuns($scanRuns); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + $response = $gapicClient->listScanRuns($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScanRuns()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/ListScanRuns', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScanRunsExceptionTest() + { + $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 + $formattedParent = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + try { + $gapicClient->listScanRuns($formattedParent); + // 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()); + } + + /** @test */ + public function startScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + $response = $gapicClient->startScanRun($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/StartScanRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function startScanRunExceptionTest() + { + $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 + $formattedName = $gapicClient->scanConfigName('[PROJECT]', '[SCAN_CONFIG]'); + try { + $gapicClient->startScanRun($formattedName); + // 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()); + } + + /** @test */ + public function stopScanRunTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $urlsCrawledCount = 1749797253; + $urlsTestedCount = 1498664068; + $hasVulnerabilities = false; + $progressPercent = 2137894861; + $expectedResponse = new ScanRun(); + $expectedResponse->setName($name2); + $expectedResponse->setUrlsCrawledCount($urlsCrawledCount); + $expectedResponse->setUrlsTestedCount($urlsTestedCount); + $expectedResponse->setHasVulnerabilities($hasVulnerabilities); + $expectedResponse->setProgressPercent($progressPercent); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + $response = $gapicClient->stopScanRun($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/StopScanRun', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function stopScanRunExceptionTest() + { + $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 + $formattedName = $gapicClient->scanRunName('[PROJECT]', '[SCAN_CONFIG]', '[SCAN_RUN]'); + try { + $gapicClient->stopScanRun($formattedName); + // 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()); + } + + /** @test */ + public function updateScanConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $maxQps = 844445913; + $expectedResponse = new ScanConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMaxQps($maxQps); + $transport->addResponse($expectedResponse); + // Mock request + $scanConfig = new ScanConfig(); + $scanConfigDisplayName = 'scanConfigDisplayName-609132338'; + $scanConfig->setDisplayName($scanConfigDisplayName); + $scanConfigStartingUrls = []; + $scanConfig->setStartingUrls($scanConfigStartingUrls); + $updateMask = new FieldMask(); + $response = $gapicClient->updateScanConfig($scanConfig, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.websecurityscanner.v1beta.WebSecurityScanner/UpdateScanConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getScanConfig(); + $this->assertProtobufEquals($scanConfig, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateScanConfigExceptionTest() + { + $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 + $scanConfig = new ScanConfig(); + $scanConfigDisplayName = 'scanConfigDisplayName-609132338'; + $scanConfig->setDisplayName($scanConfigDisplayName); + $scanConfigStartingUrls = []; + $scanConfig->setStartingUrls($scanConfigStartingUrls); + $updateMask = new FieldMask(); + try { + $gapicClient->updateScanConfig($scanConfig, $updateMask); + // 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()); + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1/Executions.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1/Executions.php new file mode 100644 index 00000000000..7fd7a564413 Binary files /dev/null and b/owl-bot-staging/Workflows/Executions/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1/Executions.php differ diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CancelExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CancelExecutionRequest.php new file mode 100644 index 00000000000..2db4641d945 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CancelExecutionRequest.php @@ -0,0 +1,93 @@ +google.cloud.workflows.executions.v1.CancelExecutionRequest + */ +class CancelExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * Please see {@see ExecutionsClient::executionName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\Executions\V1\CancelExecutionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CreateExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CreateExecutionRequest.php new file mode 100644 index 00000000000..01da8af0af3 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/CreateExecutionRequest.php @@ -0,0 +1,139 @@ +google.cloud.workflows.executions.v1.CreateExecutionRequest + */ +class CreateExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $execution = null; + + /** + * @param string $parent Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. Please see + * {@see ExecutionsClient::workflowName()} for help formatting this field. + * @param \Google\Cloud\Workflows\Executions\V1\Execution $execution Required. Execution to be created. + * + * @return \Google\Cloud\Workflows\Executions\V1\CreateExecutionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Workflows\Executions\V1\Execution $execution): self + { + return (new self()) + ->setParent($parent) + ->setExecution($execution); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @type \Google\Cloud\Workflows\Executions\V1\Execution $execution + * Required. Execution to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\Executions\V1\Execution|null + */ + public function getExecution() + { + return $this->execution; + } + + public function hasExecution() + { + return isset($this->execution); + } + + public function clearExecution() + { + unset($this->execution); + } + + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\Executions\V1\Execution $var + * @return $this + */ + public function setExecution($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution::class); + $this->execution = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution.php new file mode 100644 index 00000000000..cd76e9a60ca --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution.php @@ -0,0 +1,608 @@ +google.cloud.workflows.executions.v1.Execution + */ +class Execution extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Measures the duration of the execution. + * + * Generated from protobuf field .google.protobuf.Duration duration = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $duration = null; + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * *Note*: If you are using the REST API directly to run your workflow, you + * must escape any JSON string value of `argument`. Example: + * `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + * + * Generated from protobuf field string argument = 5; + */ + protected $argument = ''; + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $result = ''; + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workflow_revision_id = ''; + /** + * The call logging level associated to this execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.CallLogLevel call_log_level = 9; + */ + protected $call_log_level = 0; + /** + * Output only. Status tracks the current steps and progress data of this + * execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Status status = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status = null; + /** + * Labels associated with this execution. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * By default, labels are inherited from the workflow but are overridden by + * any labels associated with the execution. + * + * Generated from protobuf field map labels = 11; + */ + private $labels; + /** + * Output only. Error regarding the state of the Execution resource. For + * example, this field will have error details if the execution data is + * unavailable due to revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError state_error = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @type \Google\Protobuf\Timestamp $start_time + * Output only. Marks the beginning of execution. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. Marks the end of execution, successful or not. + * @type \Google\Protobuf\Duration $duration + * Output only. Measures the duration of the execution. + * @type int $state + * Output only. Current state of the execution. + * @type string $argument + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * *Note*: If you are using the REST API directly to run your workflow, you + * must escape any JSON string value of `argument`. Example: + * `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + * @type string $result + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * @type \Google\Cloud\Workflows\Executions\V1\Execution\Error $error + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * @type string $workflow_revision_id + * Output only. Revision of the workflow this execution is using. + * @type int $call_log_level + * The call logging level associated to this execution. + * @type \Google\Cloud\Workflows\Executions\V1\Execution\Status $status + * Output only. Status tracks the current steps and progress data of this + * execution. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this execution. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * By default, labels are inherited from the workflow but are overridden by + * any labels associated with the execution. + * @type \Google\Cloud\Workflows\Executions\V1\Execution\StateError $state_error + * Output only. Error regarding the state of the Execution resource. For + * example, this field will have error details if the execution data is + * unavailable due to revoked KMS key permissions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Measures the duration of the execution. + * + * Generated from protobuf field .google.protobuf.Duration duration = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Duration|null + */ + public function getDuration() + { + return $this->duration; + } + + public function hasDuration() + { + return isset($this->duration); + } + + public function clearDuration() + { + unset($this->duration); + } + + /** + * Output only. Measures the duration of the execution. + * + * Generated from protobuf field .google.protobuf.Duration duration = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->duration = $var; + + return $this; + } + + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1\Execution\State::class); + $this->state = $var; + + return $this; + } + + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * *Note*: If you are using the REST API directly to run your workflow, you + * must escape any JSON string value of `argument`. Example: + * `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + * + * Generated from protobuf field string argument = 5; + * @return string + */ + public function getArgument() + { + return $this->argument; + } + + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * *Note*: If you are using the REST API directly to run your workflow, you + * must escape any JSON string value of `argument`. Example: + * `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'` + * + * Generated from protobuf field string argument = 5; + * @param string $var + * @return $this + */ + public function setArgument($var) + { + GPBUtil::checkString($var, True); + $this->argument = $var; + + return $this; + } + + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkString($var, True); + $this->result = $var; + + return $this; + } + + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Workflows\Executions\V1\Execution\Error|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Workflows\Executions\V1\Execution\Error $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution\Error::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getWorkflowRevisionId() + { + return $this->workflow_revision_id; + } + + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setWorkflowRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->workflow_revision_id = $var; + + return $this; + } + + /** + * The call logging level associated to this execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.CallLogLevel call_log_level = 9; + * @return int + */ + public function getCallLogLevel() + { + return $this->call_log_level; + } + + /** + * The call logging level associated to this execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.CallLogLevel call_log_level = 9; + * @param int $var + * @return $this + */ + public function setCallLogLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1\Execution\CallLogLevel::class); + $this->call_log_level = $var; + + return $this; + } + + /** + * Output only. Status tracks the current steps and progress data of this + * execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Status status = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Workflows\Executions\V1\Execution\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * Output only. Status tracks the current steps and progress data of this + * execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.Status status = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Workflows\Executions\V1\Execution\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution\Status::class); + $this->status = $var; + + return $this; + } + + /** + * Labels associated with this execution. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * By default, labels are inherited from the workflow but are overridden by + * any labels associated with the execution. + * + * Generated from protobuf field map labels = 11; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this execution. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * By default, labels are inherited from the workflow but are overridden by + * any labels associated with the execution. + * + * Generated from protobuf field map labels = 11; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. Error regarding the state of the Execution resource. For + * example, this field will have error details if the execution data is + * unavailable due to revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError state_error = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Workflows\Executions\V1\Execution\StateError|null + */ + public function getStateError() + { + return $this->state_error; + } + + public function hasStateError() + { + return isset($this->state_error); + } + + public function clearStateError() + { + unset($this->state_error); + } + + /** + * Output only. Error regarding the state of the Execution resource. For + * example, this field will have error details if the execution data is + * unavailable due to revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError state_error = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Workflows\Executions\V1\Execution\StateError $var + * @return $this + */ + public function setStateError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution\StateError::class); + $this->state_error = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/CallLogLevel.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/CallLogLevel.php new file mode 100644 index 00000000000..ff6b5532dbf --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/CallLogLevel.php @@ -0,0 +1,73 @@ +google.cloud.workflows.executions.v1.Execution.CallLogLevel + */ +class CallLogLevel +{ + /** + * No call logging level specified. + * + * Generated from protobuf enum CALL_LOG_LEVEL_UNSPECIFIED = 0; + */ + const CALL_LOG_LEVEL_UNSPECIFIED = 0; + /** + * Log all call steps within workflows, all call returns, and all exceptions + * raised. + * + * Generated from protobuf enum LOG_ALL_CALLS = 1; + */ + const LOG_ALL_CALLS = 1; + /** + * Log only exceptions that are raised from call steps within workflows. + * + * Generated from protobuf enum LOG_ERRORS_ONLY = 2; + */ + const LOG_ERRORS_ONLY = 2; + /** + * Explicitly log nothing. + * + * Generated from protobuf enum LOG_NONE = 3; + */ + const LOG_NONE = 3; + + private static $valueToName = [ + self::CALL_LOG_LEVEL_UNSPECIFIED => 'CALL_LOG_LEVEL_UNSPECIFIED', + self::LOG_ALL_CALLS => 'LOG_ALL_CALLS', + self::LOG_ERRORS_ONLY => 'LOG_ERRORS_ONLY', + self::LOG_NONE => 'LOG_NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CallLogLevel::class, \Google\Cloud\Workflows\Executions\V1\Execution_CallLogLevel::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Error.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Error.php new file mode 100644 index 00000000000..33cfcd89b58 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Error.php @@ -0,0 +1,148 @@ +google.cloud.workflows.executions.v1.Execution.Error + */ +class Error extends \Google\Protobuf\Internal\Message +{ + /** + * Error message and data returned represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + */ + protected $payload = ''; + /** + * Human-readable stack trace string. + * + * Generated from protobuf field string context = 2; + */ + protected $context = ''; + /** + * Stack trace with detailed information of where error was generated. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTrace stack_trace = 3; + */ + protected $stack_trace = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $payload + * Error message and data returned represented as a JSON string. + * @type string $context + * Human-readable stack trace string. + * @type \Google\Cloud\Workflows\Executions\V1\Execution\StackTrace $stack_trace + * Stack trace with detailed information of where error was generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Error message and data returned represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + * @return string + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Error message and data returned represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + * @param string $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkString($var, True); + $this->payload = $var; + + return $this; + } + + /** + * Human-readable stack trace string. + * + * Generated from protobuf field string context = 2; + * @return string + */ + public function getContext() + { + return $this->context; + } + + /** + * Human-readable stack trace string. + * + * Generated from protobuf field string context = 2; + * @param string $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkString($var, True); + $this->context = $var; + + return $this; + } + + /** + * Stack trace with detailed information of where error was generated. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTrace stack_trace = 3; + * @return \Google\Cloud\Workflows\Executions\V1\Execution\StackTrace|null + */ + public function getStackTrace() + { + return $this->stack_trace; + } + + public function hasStackTrace() + { + return isset($this->stack_trace); + } + + public function clearStackTrace() + { + unset($this->stack_trace); + } + + /** + * Stack trace with detailed information of where error was generated. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTrace stack_trace = 3; + * @param \Google\Cloud\Workflows\Executions\V1\Execution\StackTrace $var + * @return $this + */ + public function setStackTrace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution\StackTrace::class); + $this->stack_trace = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Error::class, \Google\Cloud\Workflows\Executions\V1\Execution_Error::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTrace.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTrace.php new file mode 100644 index 00000000000..ba74ffea90a --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTrace.php @@ -0,0 +1,70 @@ +google.cloud.workflows.executions.v1.Execution.StackTrace + */ +class StackTrace extends \Google\Protobuf\Internal\Message +{ + /** + * An array of stack elements. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.StackTraceElement elements = 1; + */ + private $elements; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement>|\Google\Protobuf\Internal\RepeatedField $elements + * An array of stack elements. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * An array of stack elements. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.StackTraceElement elements = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getElements() + { + return $this->elements; + } + + /** + * An array of stack elements. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.StackTraceElement elements = 1; + * @param array<\Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setElements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement::class); + $this->elements = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StackTrace::class, \Google\Cloud\Workflows\Executions\V1\Execution_StackTrace::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement.php new file mode 100644 index 00000000000..54ffcdb61d1 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement.php @@ -0,0 +1,148 @@ +google.cloud.workflows.executions.v1.Execution.StackTraceElement + */ +class StackTraceElement extends \Google\Protobuf\Internal\Message +{ + /** + * The step the error occurred at. + * + * Generated from protobuf field string step = 1; + */ + protected $step = ''; + /** + * The routine where the error occurred. + * + * Generated from protobuf field string routine = 2; + */ + protected $routine = ''; + /** + * The source position information of the stack trace element. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position position = 3; + */ + protected $position = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $step + * The step the error occurred at. + * @type string $routine + * The routine where the error occurred. + * @type \Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement\Position $position + * The source position information of the stack trace element. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * The step the error occurred at. + * + * Generated from protobuf field string step = 1; + * @return string + */ + public function getStep() + { + return $this->step; + } + + /** + * The step the error occurred at. + * + * Generated from protobuf field string step = 1; + * @param string $var + * @return $this + */ + public function setStep($var) + { + GPBUtil::checkString($var, True); + $this->step = $var; + + return $this; + } + + /** + * The routine where the error occurred. + * + * Generated from protobuf field string routine = 2; + * @return string + */ + public function getRoutine() + { + return $this->routine; + } + + /** + * The routine where the error occurred. + * + * Generated from protobuf field string routine = 2; + * @param string $var + * @return $this + */ + public function setRoutine($var) + { + GPBUtil::checkString($var, True); + $this->routine = $var; + + return $this; + } + + /** + * The source position information of the stack trace element. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position position = 3; + * @return \Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement\Position|null + */ + public function getPosition() + { + return $this->position; + } + + public function hasPosition() + { + return isset($this->position); + } + + public function clearPosition() + { + unset($this->position); + } + + /** + * The source position information of the stack trace element. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position position = 3; + * @param \Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement\Position $var + * @return $this + */ + public function setPosition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1\Execution\StackTraceElement\Position::class); + $this->position = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StackTraceElement::class, \Google\Cloud\Workflows\Executions\V1\Execution_StackTraceElement::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement/Position.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement/Position.php new file mode 100644 index 00000000000..61107a12709 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StackTraceElement/Position.php @@ -0,0 +1,144 @@ +google.cloud.workflows.executions.v1.Execution.StackTraceElement.Position + */ +class Position extends \Google\Protobuf\Internal\Message +{ + /** + * The source code line number the current instruction was generated from. + * + * Generated from protobuf field int64 line = 1; + */ + protected $line = 0; + /** + * The source code column position (of the line) the current instruction + * was generated from. + * + * Generated from protobuf field int64 column = 2; + */ + protected $column = 0; + /** + * The number of bytes of source code making up this stack trace element. + * + * Generated from protobuf field int64 length = 3; + */ + protected $length = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $line + * The source code line number the current instruction was generated from. + * @type int|string $column + * The source code column position (of the line) the current instruction + * was generated from. + * @type int|string $length + * The number of bytes of source code making up this stack trace element. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * The source code line number the current instruction was generated from. + * + * Generated from protobuf field int64 line = 1; + * @return int|string + */ + public function getLine() + { + return $this->line; + } + + /** + * The source code line number the current instruction was generated from. + * + * Generated from protobuf field int64 line = 1; + * @param int|string $var + * @return $this + */ + public function setLine($var) + { + GPBUtil::checkInt64($var); + $this->line = $var; + + return $this; + } + + /** + * The source code column position (of the line) the current instruction + * was generated from. + * + * Generated from protobuf field int64 column = 2; + * @return int|string + */ + public function getColumn() + { + return $this->column; + } + + /** + * The source code column position (of the line) the current instruction + * was generated from. + * + * Generated from protobuf field int64 column = 2; + * @param int|string $var + * @return $this + */ + public function setColumn($var) + { + GPBUtil::checkInt64($var); + $this->column = $var; + + return $this; + } + + /** + * The number of bytes of source code making up this stack trace element. + * + * Generated from protobuf field int64 length = 3; + * @return int|string + */ + public function getLength() + { + return $this->length; + } + + /** + * The number of bytes of source code making up this stack trace element. + * + * Generated from protobuf field int64 length = 3; + * @param int|string $var + * @return $this + */ + public function setLength($var) + { + GPBUtil::checkInt64($var); + $this->length = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Position::class, \Google\Cloud\Workflows\Executions\V1\Execution_StackTraceElement_Position::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/State.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/State.php new file mode 100644 index 00000000000..79500707a95 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/State.php @@ -0,0 +1,93 @@ +google.cloud.workflows.executions.v1.Execution.State + */ +class State +{ + /** + * Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The execution is in progress. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The execution finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The execution failed with an error. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The execution was stopped intentionally. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + /** + * Execution data is unavailable. See the `state_error` field. + * + * Generated from protobuf enum UNAVAILABLE = 5; + */ + const UNAVAILABLE = 5; + /** + * Request has been placed in the backlog for processing at a later time. + * + * Generated from protobuf enum QUEUED = 6; + */ + const QUEUED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + self::UNAVAILABLE => 'UNAVAILABLE', + self::QUEUED => 'QUEUED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Workflows\Executions\V1\Execution_State::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError.php new file mode 100644 index 00000000000..86fe3c37a52 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError.php @@ -0,0 +1,104 @@ +google.cloud.workflows.executions.v1.Execution.StateError + */ +class StateError extends \Google\Protobuf\Internal\Message +{ + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + */ + protected $details = ''; + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError.Type type = 2; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $details + * Provides specifics about the error. + * @type int $type + * The type of this state error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.Execution.StateError.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1\Execution\StateError\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StateError::class, \Google\Cloud\Workflows\Executions\V1\Execution_StateError::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError/Type.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError/Type.php new file mode 100644 index 00000000000..82ea0cbcf58 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/StateError/Type.php @@ -0,0 +1,57 @@ +google.cloud.workflows.executions.v1.Execution.StateError.Type + */ +class Type +{ + /** + * No type specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Caused by an issue with KMS. + * + * Generated from protobuf enum KMS_ERROR = 1; + */ + const KMS_ERROR = 1; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::KMS_ERROR => 'KMS_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Workflows\Executions\V1\Execution_StateError_Type::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status.php new file mode 100644 index 00000000000..e561ba56953 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status.php @@ -0,0 +1,94 @@ +google.cloud.workflows.executions.v1.Execution.Status + */ +class Status extends \Google\Protobuf\Internal\Message +{ + /** + * A list of currently executing or last executed step names for the + * workflow execution currently running. If the workflow has succeeded or + * failed, this is the last attempted or executed step. Presently, if the + * current step is inside a subworkflow, the list only includes that step. + * In the future, the list will contain items for each step in the call + * stack, starting with the outermost step in the `main` subworkflow, and + * ending with the most deeply nested step. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.Status.Step current_steps = 1; + */ + private $current_steps; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\Executions\V1\Execution\Status\Step>|\Google\Protobuf\Internal\RepeatedField $current_steps + * A list of currently executing or last executed step names for the + * workflow execution currently running. If the workflow has succeeded or + * failed, this is the last attempted or executed step. Presently, if the + * current step is inside a subworkflow, the list only includes that step. + * In the future, the list will contain items for each step in the call + * stack, starting with the outermost step in the `main` subworkflow, and + * ending with the most deeply nested step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * A list of currently executing or last executed step names for the + * workflow execution currently running. If the workflow has succeeded or + * failed, this is the last attempted or executed step. Presently, if the + * current step is inside a subworkflow, the list only includes that step. + * In the future, the list will contain items for each step in the call + * stack, starting with the outermost step in the `main` subworkflow, and + * ending with the most deeply nested step. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.Status.Step current_steps = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCurrentSteps() + { + return $this->current_steps; + } + + /** + * A list of currently executing or last executed step names for the + * workflow execution currently running. If the workflow has succeeded or + * failed, this is the last attempted or executed step. Presently, if the + * current step is inside a subworkflow, the list only includes that step. + * In the future, the list will contain items for each step in the call + * stack, starting with the outermost step in the `main` subworkflow, and + * ending with the most deeply nested step. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution.Status.Step current_steps = 1; + * @param array<\Google\Cloud\Workflows\Executions\V1\Execution\Status\Step>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCurrentSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\Executions\V1\Execution\Status\Step::class); + $this->current_steps = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Status::class, \Google\Cloud\Workflows\Executions\V1\Execution_Status::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status/Step.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status/Step.php new file mode 100644 index 00000000000..2a480952379 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/Execution/Status/Step.php @@ -0,0 +1,104 @@ +google.cloud.workflows.executions.v1.Execution.Status.Step + */ +class Step extends \Google\Protobuf\Internal\Message +{ + /** + * Name of a routine within the workflow. + * + * Generated from protobuf field string routine = 1; + */ + protected $routine = ''; + /** + * Name of a step within the routine. + * + * Generated from protobuf field string step = 2; + */ + protected $step = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $routine + * Name of a routine within the workflow. + * @type string $step + * Name of a step within the routine. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Name of a routine within the workflow. + * + * Generated from protobuf field string routine = 1; + * @return string + */ + public function getRoutine() + { + return $this->routine; + } + + /** + * Name of a routine within the workflow. + * + * Generated from protobuf field string routine = 1; + * @param string $var + * @return $this + */ + public function setRoutine($var) + { + GPBUtil::checkString($var, True); + $this->routine = $var; + + return $this; + } + + /** + * Name of a step within the routine. + * + * Generated from protobuf field string step = 2; + * @return string + */ + public function getStep() + { + return $this->step; + } + + /** + * Name of a step within the routine. + * + * Generated from protobuf field string step = 2; + * @param string $var + * @return $this + */ + public function setStep($var) + { + GPBUtil::checkString($var, True); + $this->step = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Step::class, \Google\Cloud\Workflows\Executions\V1\Execution_Status_Step::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ExecutionView.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ExecutionView.php new file mode 100644 index 00000000000..3cf62b86152 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ExecutionView.php @@ -0,0 +1,63 @@ +google.cloud.workflows.executions.v1.ExecutionView + */ +class ExecutionView +{ + /** + * The default / unset value. + * + * Generated from protobuf enum EXECUTION_VIEW_UNSPECIFIED = 0; + */ + const EXECUTION_VIEW_UNSPECIFIED = 0; + /** + * Includes only basic metadata about the execution. + * The following fields are returned: name, start_time, end_time, duration, + * state, and workflow_revision_id. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Includes all data. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::EXECUTION_VIEW_UNSPECIFIED => 'EXECUTION_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/GetExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/GetExecutionRequest.php new file mode 100644 index 00000000000..50cf0dfb16b --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/GetExecutionRequest.php @@ -0,0 +1,131 @@ +google.cloud.workflows.executions.v1.GetExecutionRequest + */ +class GetExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * @param string $name Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * Please see {@see ExecutionsClient::executionName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\Executions\V1\GetExecutionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @type int $view + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1\ExecutionView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsRequest.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsRequest.php new file mode 100644 index 00000000000..22bdd8f45dc --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsRequest.php @@ -0,0 +1,322 @@ +google.cloud.workflows.executions.v1.ListExecutionsRequest + */ +class ListExecutionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + /** + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * Please see {@see ExecutionsClient::workflowName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\Executions\V1\ListExecutionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @type int $page_size + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @type string $page_token + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @type int $view + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @type string $filter + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @type string $order_by + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1\ExecutionView::class); + $this->view = $var; + + return $this; + } + + /** + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * + * Generated from protobuf field string order_by = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsResponse.php b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsResponse.php new file mode 100644 index 00000000000..6f950c9185b --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/proto/src/Google/Cloud/Workflows/Executions/V1/ListExecutionsResponse.php @@ -0,0 +1,107 @@ +google.cloud.workflows.executions.v1.ListExecutionsResponse + */ +class ListExecutionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution executions = 1; + */ + private $executions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\Executions\V1\Execution>|\Google\Protobuf\Internal\RepeatedField $executions + * The executions which match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1\Executions::initOnce(); + parent::__construct($data); + } + + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution executions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExecutions() + { + return $this->executions; + } + + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1.Execution executions = 1; + * @param array<\Google\Cloud\Workflows\Executions\V1\Execution>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExecutions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\Executions\V1\Execution::class); + $this->executions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/cancel_execution.php b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/cancel_execution.php new file mode 100644 index 00000000000..01f84af16ec --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/cancel_execution.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Execution $response */ + $response = $executionsClient->cancelExecution($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExecutionsClient::executionName( + '[PROJECT]', + '[LOCATION]', + '[WORKFLOW]', + '[EXECUTION]' + ); + + cancel_execution_sample($formattedName); +} +// [END workflowexecutions_v1_generated_Executions_CancelExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/create_execution.php b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/create_execution.php new file mode 100644 index 00000000000..a437f96d298 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/create_execution.php @@ -0,0 +1,75 @@ +setParent($formattedParent) + ->setExecution($execution); + + // Call the API and handle any network failures. + try { + /** @var Execution $response */ + $response = $executionsClient->createExecution($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExecutionsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + create_execution_sample($formattedParent); +} +// [END workflowexecutions_v1_generated_Executions_CreateExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/get_execution.php b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/get_execution.php new file mode 100644 index 00000000000..1f0227edadd --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/get_execution.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Execution $response */ + $response = $executionsClient->getExecution($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExecutionsClient::executionName( + '[PROJECT]', + '[LOCATION]', + '[WORKFLOW]', + '[EXECUTION]' + ); + + get_execution_sample($formattedName); +} +// [END workflowexecutions_v1_generated_Executions_GetExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/list_executions.php b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/list_executions.php new file mode 100644 index 00000000000..a806cd635ec --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/samples/V1/ExecutionsClient/list_executions.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $executionsClient->listExecutions($request); + + /** @var Execution $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExecutionsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + list_executions_sample($formattedParent); +} +// [END workflowexecutions_v1_generated_Executions_ListExecutions_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1/src/V1/Client/ExecutionsClient.php b/owl-bot-staging/Workflows/Executions/v1/src/V1/Client/ExecutionsClient.php new file mode 100644 index 00000000000..4986f4827c6 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/src/V1/Client/ExecutionsClient.php @@ -0,0 +1,350 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/executions_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/executions_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/executions_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/executions_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a execution + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * @param string $execution + * + * @return string The formatted execution resource. + */ + public static function executionName(string $project, string $location, string $workflow, string $execution): string + { + return self::getPathTemplate('execution')->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + 'execution' => $execution, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workflow + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * + * @return string The formatted workflow resource. + */ + public static function workflowName(string $project, string $location, string $workflow): string + { + return self::getPathTemplate('workflow')->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - execution: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * - workflow: projects/{project}/locations/{location}/workflows/{workflow} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'workflowexecutions.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Cancels an execution of the given name. + * + * The async variant is {@see ExecutionsClient::cancelExecutionAsync()} . + * + * @example samples/V1/ExecutionsClient/cancel_execution.php + * + * @param CancelExecutionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Execution + * + * @throws ApiException Thrown if the API call fails. + */ + public function cancelExecution(CancelExecutionRequest $request, array $callOptions = []): Execution + { + return $this->startApiCall('CancelExecution', $request, $callOptions)->wait(); + } + + /** + * Creates a new execution using the latest revision of the given workflow. + * + * The async variant is {@see ExecutionsClient::createExecutionAsync()} . + * + * @example samples/V1/ExecutionsClient/create_execution.php + * + * @param CreateExecutionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Execution + * + * @throws ApiException Thrown if the API call fails. + */ + public function createExecution(CreateExecutionRequest $request, array $callOptions = []): Execution + { + return $this->startApiCall('CreateExecution', $request, $callOptions)->wait(); + } + + /** + * Returns an execution of the given name. + * + * The async variant is {@see ExecutionsClient::getExecutionAsync()} . + * + * @example samples/V1/ExecutionsClient/get_execution.php + * + * @param GetExecutionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Execution + * + * @throws ApiException Thrown if the API call fails. + */ + public function getExecution(GetExecutionRequest $request, array $callOptions = []): Execution + { + return $this->startApiCall('GetExecution', $request, $callOptions)->wait(); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * The async variant is {@see ExecutionsClient::listExecutionsAsync()} . + * + * @example samples/V1/ExecutionsClient/list_executions.php + * + * @param ListExecutionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listExecutions(ListExecutionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListExecutions', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Workflows/Executions/v1/src/V1/gapic_metadata.json new file mode 100644 index 00000000000..a5772cb9316 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/src/V1/gapic_metadata.json @@ -0,0 +1,38 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.workflows.executions.v1", + "libraryPackage": "Google\\Cloud\\Workflows\\Executions\\V1", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "ExecutionsGapicClient", + "rpcs": { + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_client_config.json b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_client_config.json new file mode 100644 index 00000000000..e2a69a44b87 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1.Executions": { + "retry_codes": { + "no_retry_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + } + }, + "methods": { + "CancelExecution": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "CreateExecution": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetExecution": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListExecutions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_descriptor_config.php b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_descriptor_config.php new file mode 100644 index 00000000000..719d003ebf9 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_descriptor_config.php @@ -0,0 +1,68 @@ + [ + 'google.cloud.workflows.executions.v1.Executions' => [ + 'CancelExecution' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Workflows\Executions\V1\Execution', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateExecution' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Workflows\Executions\V1\Execution', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetExecution' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Workflows\Executions\V1\Execution', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListExecutions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExecutions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Workflows\Executions\V1\ListExecutionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'execution' => 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}', + 'workflow' => 'projects/{project}/locations/{location}/workflows/{workflow}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_rest_client_config.php b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_rest_client_config.php new file mode 100644 index 00000000000..09d749a4004 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/src/V1/resources/executions_rest_client_config.php @@ -0,0 +1,54 @@ + [ + 'google.cloud.workflows.executions.v1.Executions' => [ + 'CancelExecution' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/workflows/*/executions/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateExecution' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/workflows/*}/executions', + 'body' => 'execution', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetExecution' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/workflows/*/executions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListExecutions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/workflows/*}/executions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/Executions/v1/tests/Unit/V1/Client/ExecutionsClientTest.php b/owl-bot-staging/Workflows/Executions/v1/tests/Unit/V1/Client/ExecutionsClientTest.php new file mode 100644 index 00000000000..373e5f43077 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1/tests/Unit/V1/Client/ExecutionsClientTest.php @@ -0,0 +1,389 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ExecutionsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ExecutionsClient($options); + } + + /** @test */ + public function cancelExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name2); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $request = (new CancelExecutionRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelExecution($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1.Executions/CancelExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelExecutionExceptionTest() + { + $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 + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $request = (new CancelExecutionRequest()) + ->setName($formattedName); + try { + $gapicClient->cancelExecution($request); + // 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()); + } + + /** @test */ + public function createExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $execution = new Execution(); + $request = (new CreateExecutionRequest()) + ->setParent($formattedParent) + ->setExecution($execution); + $response = $gapicClient->createExecution($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1.Executions/CreateExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getExecution(); + $this->assertProtobufEquals($execution, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createExecutionExceptionTest() + { + $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 + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $execution = new Execution(); + $request = (new CreateExecutionRequest()) + ->setParent($formattedParent) + ->setExecution($execution); + try { + $gapicClient->createExecution($request); + // 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()); + } + + /** @test */ + public function getExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name2); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $request = (new GetExecutionRequest()) + ->setName($formattedName); + $response = $gapicClient->getExecution($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1.Executions/GetExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExecutionExceptionTest() + { + $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 + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $request = (new GetExecutionRequest()) + ->setName($formattedName); + try { + $gapicClient->getExecution($request); + // 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()); + } + + /** @test */ + public function listExecutionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $executionsElement = new Execution(); + $executions = [ + $executionsElement, + ]; + $expectedResponse = new ListExecutionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExecutions($executions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new ListExecutionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listExecutions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExecutions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1.Executions/ListExecutions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExecutionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new ListExecutionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listExecutions($request); + // 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()); + } + + /** @test */ + public function cancelExecutionAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name2); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $request = (new CancelExecutionRequest()) + ->setName($formattedName); + $response = $gapicClient->cancelExecutionAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1.Executions/CancelExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1Beta/Executions.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1Beta/Executions.php new file mode 100644 index 00000000000..8b5c8dcf824 Binary files /dev/null and b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/Executions/V1Beta/Executions.php differ diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CancelExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CancelExecutionRequest.php new file mode 100644 index 00000000000..28c9ab2611d --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CancelExecutionRequest.php @@ -0,0 +1,77 @@ +google.cloud.workflows.executions.v1beta.CancelExecutionRequest + */ +class CancelExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CreateExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CreateExecutionRequest.php new file mode 100644 index 00000000000..0ce4e08aa9b --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/CreateExecutionRequest.php @@ -0,0 +1,121 @@ +google.cloud.workflows.executions.v1beta.CreateExecutionRequest + */ +class CreateExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $execution = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @type \Google\Cloud\Workflows\Executions\V1beta\Execution $execution + * Required. Execution to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\Executions\V1beta\Execution|null + */ + public function getExecution() + { + return $this->execution; + } + + public function hasExecution() + { + return isset($this->execution); + } + + public function clearExecution() + { + unset($this->execution); + } + + /** + * Required. Execution to be created. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\Executions\V1beta\Execution $var + * @return $this + */ + public function setExecution($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1beta\Execution::class); + $this->execution = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution.php new file mode 100644 index 00000000000..a7c7ff75338 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution.php @@ -0,0 +1,359 @@ +google.cloud.workflows.executions.v1beta.Execution + */ +class Execution extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * + * Generated from protobuf field string argument = 5; + */ + protected $argument = ''; + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $result = ''; + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $error = null; + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $workflow_revision_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @type \Google\Protobuf\Timestamp $start_time + * Output only. Marks the beginning of execution. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. Marks the end of execution, successful or not. + * @type int $state + * Output only. Current state of the execution. + * @type string $argument + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * @type string $result + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * @type \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $error + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * @type string $workflow_revision_id + * Output only. Revision of the workflow this execution is using. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the execution. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. Marks the beginning of execution. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. Marks the end of execution, successful or not. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. Current state of the execution. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\State::class); + $this->state = $var; + + return $this; + } + + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * + * Generated from protobuf field string argument = 5; + * @return string + */ + public function getArgument() + { + return $this->argument; + } + + /** + * Input parameters of the execution represented as a JSON string. + * The size limit is 32KB. + * + * Generated from protobuf field string argument = 5; + * @param string $var + * @return $this + */ + public function setArgument($var) + { + GPBUtil::checkString($var, True); + $this->argument = $var; + + return $this; + } + + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getResult() + { + return $this->result; + } + + /** + * Output only. Output of the execution represented as a JSON string. The + * value can only be present if the execution's state is `SUCCEEDED`. + * + * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkString($var, True); + $this->result = $var; + + return $this; + } + + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Workflows\Executions\V1beta\Execution\Error|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Output only. The error which caused the execution to finish prematurely. + * The value is only present if the execution's state is `FAILED` + * or `CANCELLED`. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\Error::class); + $this->error = $var; + + return $this; + } + + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getWorkflowRevisionId() + { + return $this->workflow_revision_id; + } + + /** + * Output only. Revision of the workflow this execution is using. + * + * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setWorkflowRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->workflow_revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/Error.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/Error.php new file mode 100644 index 00000000000..c8f9da2bfc7 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/Error.php @@ -0,0 +1,104 @@ +google.cloud.workflows.executions.v1beta.Execution.Error + */ +class Error extends \Google\Protobuf\Internal\Message +{ + /** + * Error payload returned by the execution, represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + */ + protected $payload = ''; + /** + * Human readable error context, helpful for debugging purposes. + * + * Generated from protobuf field string context = 2; + */ + protected $context = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $payload + * Error payload returned by the execution, represented as a JSON string. + * @type string $context + * Human readable error context, helpful for debugging purposes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Error payload returned by the execution, represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + * @return string + */ + public function getPayload() + { + return $this->payload; + } + + /** + * Error payload returned by the execution, represented as a JSON string. + * + * Generated from protobuf field string payload = 1; + * @param string $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkString($var, True); + $this->payload = $var; + + return $this; + } + + /** + * Human readable error context, helpful for debugging purposes. + * + * Generated from protobuf field string context = 2; + * @return string + */ + public function getContext() + { + return $this->context; + } + + /** + * Human readable error context, helpful for debugging purposes. + * + * Generated from protobuf field string context = 2; + * @param string $var + * @return $this + */ + public function setContext($var) + { + GPBUtil::checkString($var, True); + $this->context = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Error::class, \Google\Cloud\Workflows\Executions\V1beta\Execution_Error::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/State.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/State.php new file mode 100644 index 00000000000..cb9bfc9bd8b --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/Execution/State.php @@ -0,0 +1,79 @@ +google.cloud.workflows.executions.v1beta.Execution.State + */ +class State +{ + /** + * Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The execution is in progress. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * The execution finished successfully. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The execution failed with an error. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The execution was stopped intentionally. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Workflows\Executions\V1beta\Execution_State::class); + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ExecutionView.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ExecutionView.php new file mode 100644 index 00000000000..22912dec599 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ExecutionView.php @@ -0,0 +1,63 @@ +google.cloud.workflows.executions.v1beta.ExecutionView + */ +class ExecutionView +{ + /** + * The default / unset value. + * + * Generated from protobuf enum EXECUTION_VIEW_UNSPECIFIED = 0; + */ + const EXECUTION_VIEW_UNSPECIFIED = 0; + /** + * Includes only basic metadata about the execution. + * Following fields are returned: name, start_time, end_time, state + * and workflow_revision_id. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Includes all data. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::EXECUTION_VIEW_UNSPECIFIED => 'EXECUTION_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/GetExecutionRequest.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/GetExecutionRequest.php new file mode 100644 index 00000000000..7f1b36d86bb --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/GetExecutionRequest.php @@ -0,0 +1,115 @@ +google.cloud.workflows.executions.v1beta.GetExecutionRequest + */ +class GetExecutionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @type int $view + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\ExecutionView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsRequest.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsRequest.php new file mode 100644 index 00000000000..077109024a4 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsRequest.php @@ -0,0 +1,207 @@ +google.cloud.workflows.executions.v1beta.ListExecutionsRequest + */ +class ListExecutionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @type int $page_size + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @type string $page_token + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @type int $view + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * + * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\ExecutionView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsResponse.php b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsResponse.php new file mode 100644 index 00000000000..9858451191f --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/proto/src/Google/Cloud/Workflows/Executions/V1beta/ListExecutionsResponse.php @@ -0,0 +1,107 @@ +google.cloud.workflows.executions.v1beta.ListExecutionsResponse + */ +class ListExecutionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; + */ + private $executions; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\Executions\V1beta\Execution>|\Google\Protobuf\Internal\RepeatedField $executions + * The executions which match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); + parent::__construct($data); + } + + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExecutions() + { + return $this->executions; + } + + /** + * The executions which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; + * @param array<\Google\Cloud\Workflows\Executions\V1beta\Execution>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExecutions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\Executions\V1beta\Execution::class); + $this->executions = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/cancel_execution.php b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/cancel_execution.php new file mode 100644 index 00000000000..e192511745c --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/cancel_execution.php @@ -0,0 +1,73 @@ +cancelExecution($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExecutionsClient::executionName( + '[PROJECT]', + '[LOCATION]', + '[WORKFLOW]', + '[EXECUTION]' + ); + + cancel_execution_sample($formattedName); +} +// [END workflowexecutions_v1beta_generated_Executions_CancelExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/create_execution.php b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/create_execution.php new file mode 100644 index 00000000000..65ad0026a13 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/create_execution.php @@ -0,0 +1,71 @@ +createExecution($formattedParent, $execution); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExecutionsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + create_execution_sample($formattedParent); +} +// [END workflowexecutions_v1beta_generated_Executions_CreateExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/get_execution.php b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/get_execution.php new file mode 100644 index 00000000000..619a750a564 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/get_execution.php @@ -0,0 +1,73 @@ +getExecution($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExecutionsClient::executionName( + '[PROJECT]', + '[LOCATION]', + '[WORKFLOW]', + '[EXECUTION]' + ); + + get_execution_sample($formattedName); +} +// [END workflowexecutions_v1beta_generated_Executions_GetExecution_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/list_executions.php b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/list_executions.php new file mode 100644 index 00000000000..4b25c3d5b5a --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/samples/V1beta/ExecutionsClient/list_executions.php @@ -0,0 +1,75 @@ +listExecutions($formattedParent); + + /** @var Execution $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExecutionsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + list_executions_sample($formattedParent); +} +// [END workflowexecutions_v1beta_generated_Executions_ListExecutions_sync] diff --git a/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/ExecutionsClient.php b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/ExecutionsClient.php new file mode 100644 index 00000000000..a68a0572ff6 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/ExecutionsClient.php @@ -0,0 +1,36 @@ +executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + * $response = $executionsClient->cancelExecution($formattedName); + * } finally { + * $executionsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + * + * @deprecated This class will be removed in the next major version update. + */ +class ExecutionsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.workflows.executions.v1beta.Executions'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'workflowexecutions.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'workflowexecutions.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 static $executionNameTemplate; + + private static $workflowNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/executions_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/executions_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/executions_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/executions_rest_client_config.php', + ], + ], + ]; + } + + private static function getExecutionNameTemplate() + { + if (self::$executionNameTemplate == null) { + self::$executionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}'); + } + + return self::$executionNameTemplate; + } + + private static function getWorkflowNameTemplate() + { + if (self::$workflowNameTemplate == null) { + self::$workflowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}'); + } + + return self::$workflowNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'execution' => self::getExecutionNameTemplate(), + 'workflow' => self::getWorkflowNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a execution + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * @param string $execution + * + * @return string The formatted execution resource. + * + * @experimental + */ + public static function executionName($project, $location, $workflow, $execution) + { + return self::getExecutionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + 'execution' => $execution, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workflow + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * + * @return string The formatted workflow resource. + * + * @experimental + */ + public static function workflowName($project, $location, $workflow) + { + return self::getWorkflowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - execution: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * - workflow: projects/{project}/locations/{location}/workflows/{workflow} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * 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 'workflowexecutions.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Cancels an execution of the given name. + * + * Sample code: + * ``` + * $executionsClient = new ExecutionsClient(); + * try { + * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + * $response = $executionsClient->cancelExecution($formattedName); + * } finally { + * $executionsClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @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\Cloud\Workflows\Executions\V1beta\Execution + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function cancelExecution($name, array $optionalArgs = []) + { + $request = new CancelExecutionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CancelExecution', Execution::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new execution using the latest revision of the given workflow. + * + * Sample code: + * ``` + * $executionsClient = new ExecutionsClient(); + * try { + * $formattedParent = $executionsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + * $execution = new Execution(); + * $response = $executionsClient->createExecution($formattedParent, $execution); + * } finally { + * $executionsClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param Execution $execution Required. Execution to be created. + * @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\Cloud\Workflows\Executions\V1beta\Execution + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createExecution($parent, $execution, array $optionalArgs = []) + { + $request = new CreateExecutionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setExecution($execution); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateExecution', Execution::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns an execution of the given name. + * + * Sample code: + * ``` + * $executionsClient = new ExecutionsClient(); + * try { + * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + * $response = $executionsClient->getExecution($formattedName); + * } finally { + * $executionsClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * For allowed values, use constants defined on {@see \Google\Cloud\Workflows\Executions\V1beta\ExecutionView} + * @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\Workflows\Executions\V1beta\Execution + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getExecution($name, array $optionalArgs = []) + { + $request = new GetExecutionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetExecution', Execution::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * Sample code: + * ``` + * $executionsClient = new ExecutionsClient(); + * try { + * $formattedParent = $executionsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + * // Iterate over pages of elements + * $pagedResponse = $executionsClient->listExecutions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $executionsClient->listExecutions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $executionsClient->close(); + * } + * ``` + * + * @param string $parent Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $view + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * For allowed values, use constants defined on {@see \Google\Cloud\Workflows\Executions\V1beta\ExecutionView} + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listExecutions($parent, array $optionalArgs = []) + { + $request = new ListExecutionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListExecutions', $optionalArgs, ListExecutionsResponse::class, $request); + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/gapic_metadata.json b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/gapic_metadata.json new file mode 100644 index 00000000000..81c96730692 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/gapic_metadata.json @@ -0,0 +1,38 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.workflows.executions.v1beta", + "libraryPackage": "Google\\Cloud\\Workflows\\Executions\\V1beta", + "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "ExecutionsGapicClient", + "rpcs": { + "CancelExecution": { + "methods": [ + "cancelExecution" + ] + }, + "CreateExecution": { + "methods": [ + "createExecution" + ] + }, + "GetExecution": { + "methods": [ + "getExecution" + ] + }, + "ListExecutions": { + "methods": [ + "listExecutions" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_client_config.json b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_client_config.json new file mode 100644 index 00000000000..a3c456bd223 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.workflows.executions.v1beta.Executions": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CancelExecution": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateExecution": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetExecution": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListExecutions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_descriptor_config.php b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_descriptor_config.php new file mode 100644 index 00000000000..0836e4ff2d4 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_descriptor_config.php @@ -0,0 +1,18 @@ + [ + 'google.cloud.workflows.executions.v1beta.Executions' => [ + 'ListExecutions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExecutions', + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_rest_client_config.php b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_rest_client_config.php new file mode 100644 index 00000000000..1a24fec7f00 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/src/V1beta/resources/executions_rest_client_config.php @@ -0,0 +1,54 @@ + [ + 'google.cloud.workflows.executions.v1beta.Executions' => [ + 'CancelExecution' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateExecution' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/workflows/*}/executions', + 'body' => 'execution', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetExecution' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListExecutions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/workflows/*}/executions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/Executions/v1beta/tests/Unit/V1beta/ExecutionsClientTest.php b/owl-bot-staging/Workflows/Executions/v1beta/tests/Unit/V1beta/ExecutionsClientTest.php new file mode 100644 index 00000000000..9e5ec754c77 --- /dev/null +++ b/owl-bot-staging/Workflows/Executions/v1beta/tests/Unit/V1beta/ExecutionsClientTest.php @@ -0,0 +1,332 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return ExecutionsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ExecutionsClient($options); + } + + /** @test */ + public function cancelExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name2); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $response = $gapicClient->cancelExecution($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/CancelExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function cancelExecutionExceptionTest() + { + $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 + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + try { + $gapicClient->cancelExecution($formattedName); + // 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()); + } + + /** @test */ + public function createExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $execution = new Execution(); + $response = $gapicClient->createExecution($formattedParent, $execution); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/CreateExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getExecution(); + $this->assertProtobufEquals($execution, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createExecutionExceptionTest() + { + $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 + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $execution = new Execution(); + try { + $gapicClient->createExecution($formattedParent, $execution); + // 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()); + } + + /** @test */ + public function getExecutionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $argument = 'argument-1589682499'; + $result = 'result-934426595'; + $workflowRevisionId = 'workflowRevisionId-1453295745'; + $expectedResponse = new Execution(); + $expectedResponse->setName($name2); + $expectedResponse->setArgument($argument); + $expectedResponse->setResult($result); + $expectedResponse->setWorkflowRevisionId($workflowRevisionId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + $response = $gapicClient->getExecution($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/GetExecution', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExecutionExceptionTest() + { + $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 + $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); + try { + $gapicClient->getExecution($formattedName); + // 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()); + } + + /** @test */ + public function listExecutionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $executionsElement = new Execution(); + $executions = [ + $executionsElement, + ]; + $expectedResponse = new ListExecutionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExecutions($executions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $response = $gapicClient->listExecutions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExecutions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/ListExecutions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExecutionsExceptionTest() + { + $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 + $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + try { + $gapicClient->listExecutions($formattedParent); + // 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()); + } +} diff --git a/owl-bot-staging/Workflows/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/V1/Workflows.php b/owl-bot-staging/Workflows/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/V1/Workflows.php new file mode 100644 index 00000000000..f6de3eceb79 Binary files /dev/null and b/owl-bot-staging/Workflows/v1/proto/src/GPBMetadata/Google/Cloud/Workflows/V1/Workflows.php differ diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/CreateWorkflowRequest.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/CreateWorkflowRequest.php new file mode 100644 index 00000000000..6a782e25355 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/CreateWorkflowRequest.php @@ -0,0 +1,201 @@ +google.cloud.workflows.v1.CreateWorkflowRequest + */ +class CreateWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow = null; + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow_id = ''; + + /** + * @param string $parent Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * Please see {@see WorkflowsClient::locationName()} for help formatting this field. + * @param \Google\Cloud\Workflows\V1\Workflow $workflow Required. Workflow to be created. + * @param string $workflowId Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * @return \Google\Cloud\Workflows\V1\CreateWorkflowRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Workflows\V1\Workflow $workflow, string $workflowId): self + { + return (new self()) + ->setParent($parent) + ->setWorkflow($workflow) + ->setWorkflowId($workflowId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @type \Google\Cloud\Workflows\V1\Workflow $workflow + * Required. Workflow to be created. + * @type string $workflow_id + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\V1\Workflow|null + */ + public function getWorkflow() + { + return $this->workflow; + } + + public function hasWorkflow() + { + return isset($this->workflow); + } + + public function clearWorkflow() + { + unset($this->workflow); + } + + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\V1\Workflow $var + * @return $this + */ + public function setWorkflow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1\Workflow::class); + $this->workflow = $var; + + return $this; + } + + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getWorkflowId() + { + return $this->workflow_id; + } + + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setWorkflowId($var) + { + GPBUtil::checkString($var, True); + $this->workflow_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/DeleteWorkflowRequest.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/DeleteWorkflowRequest.php new file mode 100644 index 00000000000..ded08ff65dc --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/DeleteWorkflowRequest.php @@ -0,0 +1,88 @@ +google.cloud.workflows.v1.DeleteWorkflowRequest + */ +class DeleteWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * Please see {@see WorkflowsClient::workflowName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\V1\DeleteWorkflowRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/GetWorkflowRequest.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/GetWorkflowRequest.php new file mode 100644 index 00000000000..8bffc47fd01 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/GetWorkflowRequest.php @@ -0,0 +1,137 @@ +google.cloud.workflows.v1.GetWorkflowRequest + */ +class GetWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $revision_id = ''; + + /** + * @param string $name Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * Please see {@see WorkflowsClient::workflowName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\V1\GetWorkflowRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @type string $revision_id + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + * + * Generated from protobuf field string revision_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsRequest.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsRequest.php new file mode 100644 index 00000000000..536f26ddfc4 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsRequest.php @@ -0,0 +1,260 @@ +google.cloud.workflows.v1.ListWorkflowsRequest + */ +class ListWorkflowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * Please see {@see WorkflowsClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\Workflows\V1\ListWorkflowsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @type int $page_size + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @type string $page_token + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @type string $filter + * Filter to restrict results to specific workflows. + * @type string $order_by + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsResponse.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsResponse.php new file mode 100644 index 00000000000..34d3acf2bb9 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/ListWorkflowsResponse.php @@ -0,0 +1,141 @@ +google.cloud.workflows.v1.ListWorkflowsResponse + */ +class ListWorkflowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The workflows that match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1.Workflow workflows = 1; + */ + private $workflows; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\V1\Workflow>|\Google\Protobuf\Internal\RepeatedField $workflows + * The workflows that match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unreachable resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The workflows that match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1.Workflow workflows = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkflows() + { + return $this->workflows; + } + + /** + * The workflows that match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1.Workflow workflows = 1; + * @param array<\Google\Cloud\Workflows\V1\Workflow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkflows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\V1\Workflow::class); + $this->workflows = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/OperationMetadata.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/OperationMetadata.php new file mode 100644 index 00000000000..498dac12a82 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/OperationMetadata.php @@ -0,0 +1,223 @@ +google.cloud.workflows.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * @type string $api_version + * API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/UpdateWorkflowRequest.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/UpdateWorkflowRequest.php new file mode 100644 index 00000000000..6a77b5a19df --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/UpdateWorkflowRequest.php @@ -0,0 +1,143 @@ +google.cloud.workflows.v1.UpdateWorkflowRequest + */ +class UpdateWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow = null; + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Workflows\V1\Workflow $workflow Required. Workflow to be updated. + * @param \Google\Protobuf\FieldMask $updateMask List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * @return \Google\Cloud\Workflows\V1\UpdateWorkflowRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Workflows\V1\Workflow $workflow, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setWorkflow($workflow) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Workflows\V1\Workflow $workflow + * Required. Workflow to be updated. + * @type \Google\Protobuf\FieldMask $update_mask + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\V1\Workflow|null + */ + public function getWorkflow() + { + return $this->workflow; + } + + public function hasWorkflow() + { + return isset($this->workflow); + } + + public function clearWorkflow() + { + unset($this->workflow); + } + + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\V1\Workflow $var + * @return $this + */ + public function setWorkflow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1\Workflow::class); + $this->workflow = $var; + + return $this; + } + + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow.php new file mode 100644 index 00000000000..c57333d720c --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow.php @@ -0,0 +1,713 @@ +google.cloud.workflows.v1.Workflow + */ +class Workflow extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following properties of a workflow: + * - [Service account][google.cloud.workflows.v1.Workflow.service_account] + * - [Workflow code to be + * executed][google.cloud.workflows.v1.Workflow.source_contents] + * The format is "000001-a4d", where the first six characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * three hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_id = ''; + /** + * Output only. The timestamp for when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp for when the workflow was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The timestamp for the latest revision of the workflow's + * creation. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_create_time = null; + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * The service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} or {account} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. The `{account}` value can be the + * `email` address or the `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + */ + protected $service_account = ''; + /** + * Optional. The resource name of a KMS crypto key used to encrypt or decrypt + * the data associated with the workflow. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. + * If not provided, data associated with the workflow will not be + * CMEK-encrypted. + * + * Generated from protobuf field string crypto_key_name = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $crypto_key_name = ''; + /** + * Output only. Error regarding the state of the workflow. For example, this + * field will have error details if the execution data is unavailable due to + * revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError state_error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_error = null; + /** + * Optional. Describes the level of platform logging to apply to calls and + * call responses during executions of this workflow. If both the workflow and + * the execution specify a logging level, the execution level takes + * precedence. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.CallLogLevel call_log_level = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $call_log_level = 0; + /** + * Optional. User-defined environment variables associated with this workflow + * revision. This map has a maximum length of 20. Each string can take up to + * 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or + * “WORKFLOWS". + * + * Generated from protobuf field map user_env_vars = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $user_env_vars; + protected $source_code; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @type string $description + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * @type int $state + * Output only. State of the workflow deployment. + * @type string $revision_id + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following properties of a workflow: + * - [Service account][google.cloud.workflows.v1.Workflow.service_account] + * - [Workflow code to be + * executed][google.cloud.workflows.v1.Workflow.source_contents] + * The format is "000001-a4d", where the first six characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * three hexadecimal random characters. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp for when the workflow was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp for when the workflow was last updated. + * @type \Google\Protobuf\Timestamp $revision_create_time + * Output only. The timestamp for the latest revision of the workflow's + * creation. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * @type string $service_account + * The service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} or {account} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. The `{account}` value can be the + * `email` address or the `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * @type string $source_contents + * Workflow code to be executed. The size limit is 128KB. + * @type string $crypto_key_name + * Optional. The resource name of a KMS crypto key used to encrypt or decrypt + * the data associated with the workflow. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. + * If not provided, data associated with the workflow will not be + * CMEK-encrypted. + * @type \Google\Cloud\Workflows\V1\Workflow\StateError $state_error + * Output only. Error regarding the state of the workflow. For example, this + * field will have error details if the execution data is unavailable due to + * revoked KMS key permissions. + * @type int $call_log_level + * Optional. Describes the level of platform logging to apply to calls and + * call responses during executions of this workflow. If both the workflow and + * the execution specify a logging level, the execution level takes + * precedence. + * @type array|\Google\Protobuf\Internal\MapField $user_env_vars + * Optional. User-defined environment variables associated with this workflow + * revision. This map has a maximum length of 20. Each string can take up to + * 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or + * “WORKFLOWS". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\V1\Workflow\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following properties of a workflow: + * - [Service account][google.cloud.workflows.v1.Workflow.service_account] + * - [Workflow code to be + * executed][google.cloud.workflows.v1.Workflow.source_contents] + * The format is "000001-a4d", where the first six characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * three hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following properties of a workflow: + * - [Service account][google.cloud.workflows.v1.Workflow.service_account] + * - [Workflow code to be + * executed][google.cloud.workflows.v1.Workflow.source_contents] + * The format is "000001-a4d", where the first six characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * three hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + + /** + * Output only. The timestamp for when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp for when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp for when the workflow was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp for when the workflow was last updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The timestamp for the latest revision of the workflow's + * creation. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRevisionCreateTime() + { + return $this->revision_create_time; + } + + public function hasRevisionCreateTime() + { + return isset($this->revision_create_time); + } + + public function clearRevisionCreateTime() + { + unset($this->revision_create_time); + } + + /** + * Output only. The timestamp for the latest revision of the workflow's + * creation. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRevisionCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->revision_create_time = $var; + + return $this; + } + + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores, and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} or {account} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. The `{account}` value can be the + * `email` address or the `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * The service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} or {account} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. The `{account}` value can be the + * `email` address or the `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Workflow code to be executed. The size limit is 128KB. + * + * Generated from protobuf field string source_contents = 10; + * @return string + */ + public function getSourceContents() + { + return $this->readOneof(10); + } + + public function hasSourceContents() + { + return $this->hasOneof(10); + } + + /** + * Workflow code to be executed. The size limit is 128KB. + * + * Generated from protobuf field string source_contents = 10; + * @param string $var + * @return $this + */ + public function setSourceContents($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Optional. The resource name of a KMS crypto key used to encrypt or decrypt + * the data associated with the workflow. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. + * If not provided, data associated with the workflow will not be + * CMEK-encrypted. + * + * Generated from protobuf field string crypto_key_name = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getCryptoKeyName() + { + return $this->crypto_key_name; + } + + /** + * Optional. The resource name of a KMS crypto key used to encrypt or decrypt + * the data associated with the workflow. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + * Using `-` as a wildcard for the `{project}` or not providing one at all + * will infer the project from the account. + * If not provided, data associated with the workflow will not be + * CMEK-encrypted. + * + * Generated from protobuf field string crypto_key_name = 11 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCryptoKeyName($var) + { + GPBUtil::checkString($var, True); + $this->crypto_key_name = $var; + + return $this; + } + + /** + * Output only. Error regarding the state of the workflow. For example, this + * field will have error details if the execution data is unavailable due to + * revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError state_error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Workflows\V1\Workflow\StateError|null + */ + public function getStateError() + { + return $this->state_error; + } + + public function hasStateError() + { + return isset($this->state_error); + } + + public function clearStateError() + { + unset($this->state_error); + } + + /** + * Output only. Error regarding the state of the workflow. For example, this + * field will have error details if the execution data is unavailable due to + * revoked KMS key permissions. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError state_error = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Workflows\V1\Workflow\StateError $var + * @return $this + */ + public function setStateError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1\Workflow\StateError::class); + $this->state_error = $var; + + return $this; + } + + /** + * Optional. Describes the level of platform logging to apply to calls and + * call responses during executions of this workflow. If both the workflow and + * the execution specify a logging level, the execution level takes + * precedence. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.CallLogLevel call_log_level = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCallLogLevel() + { + return $this->call_log_level; + } + + /** + * Optional. Describes the level of platform logging to apply to calls and + * call responses during executions of this workflow. If both the workflow and + * the execution specify a logging level, the execution level takes + * precedence. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.CallLogLevel call_log_level = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCallLogLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\V1\Workflow\CallLogLevel::class); + $this->call_log_level = $var; + + return $this; + } + + /** + * Optional. User-defined environment variables associated with this workflow + * revision. This map has a maximum length of 20. Each string can take up to + * 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or + * “WORKFLOWS". + * + * Generated from protobuf field map user_env_vars = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserEnvVars() + { + return $this->user_env_vars; + } + + /** + * Optional. User-defined environment variables associated with this workflow + * revision. This map has a maximum length of 20. Each string can take up to + * 40KiB. Keys cannot be empty strings and cannot start with “GOOGLE” or + * “WORKFLOWS". + * + * Generated from protobuf field map user_env_vars = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserEnvVars($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_env_vars = $arr; + + return $this; + } + + /** + * @return string + */ + public function getSourceCode() + { + return $this->whichOneof("source_code"); + } + +} + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/CallLogLevel.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/CallLogLevel.php new file mode 100644 index 00000000000..fd7dbbc0dac --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/CallLogLevel.php @@ -0,0 +1,73 @@ +google.cloud.workflows.v1.Workflow.CallLogLevel + */ +class CallLogLevel +{ + /** + * No call logging level specified. + * + * Generated from protobuf enum CALL_LOG_LEVEL_UNSPECIFIED = 0; + */ + const CALL_LOG_LEVEL_UNSPECIFIED = 0; + /** + * Log all call steps within workflows, all call returns, and all exceptions + * raised. + * + * Generated from protobuf enum LOG_ALL_CALLS = 1; + */ + const LOG_ALL_CALLS = 1; + /** + * Log only exceptions that are raised from call steps within workflows. + * + * Generated from protobuf enum LOG_ERRORS_ONLY = 2; + */ + const LOG_ERRORS_ONLY = 2; + /** + * Explicitly log nothing. + * + * Generated from protobuf enum LOG_NONE = 3; + */ + const LOG_NONE = 3; + + private static $valueToName = [ + self::CALL_LOG_LEVEL_UNSPECIFIED => 'CALL_LOG_LEVEL_UNSPECIFIED', + self::LOG_ALL_CALLS => 'LOG_ALL_CALLS', + self::LOG_ERRORS_ONLY => 'LOG_ERRORS_ONLY', + self::LOG_NONE => 'LOG_NONE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CallLogLevel::class, \Google\Cloud\Workflows\V1\Workflow_CallLogLevel::class); + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/State.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/State.php new file mode 100644 index 00000000000..675b0444e92 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/State.php @@ -0,0 +1,64 @@ +google.cloud.workflows.v1.Workflow.State + */ +class State +{ + /** + * Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The workflow has been deployed successfully and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + /** + * Workflow data is unavailable. See the `state_error` field. + * + * Generated from protobuf enum UNAVAILABLE = 2; + */ + const UNAVAILABLE = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + self::UNAVAILABLE => 'UNAVAILABLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Workflows\V1\Workflow_State::class); + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError.php new file mode 100644 index 00000000000..eb9d406a37d --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError.php @@ -0,0 +1,104 @@ +google.cloud.workflows.v1.Workflow.StateError + */ +class StateError extends \Google\Protobuf\Internal\Message +{ + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + */ + protected $details = ''; + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError.Type type = 2; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $details + * Provides specifics about the error. + * @type int $type + * The type of this state error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + * @return string + */ + public function getDetails() + { + return $this->details; + } + + /** + * Provides specifics about the error. + * + * Generated from protobuf field string details = 1; + * @param string $var + * @return $this + */ + public function setDetails($var) + { + GPBUtil::checkString($var, True); + $this->details = $var; + + return $this; + } + + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of this state error. + * + * Generated from protobuf field .google.cloud.workflows.v1.Workflow.StateError.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\V1\Workflow\StateError\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StateError::class, \Google\Cloud\Workflows\V1\Workflow_StateError::class); + diff --git a/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError/Type.php b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError/Type.php new file mode 100644 index 00000000000..3a3520248b2 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/proto/src/Google/Cloud/Workflows/V1/Workflow/StateError/Type.php @@ -0,0 +1,57 @@ +google.cloud.workflows.v1.Workflow.StateError.Type + */ +class Type +{ + /** + * No type specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Caused by an issue with KMS. + * + * Generated from protobuf enum KMS_ERROR = 1; + */ + const KMS_ERROR = 1; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::KMS_ERROR => 'KMS_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Workflows\V1\Workflow_StateError_Type::class); + diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/create_workflow.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/create_workflow.php new file mode 100644 index 00000000000..638eb45727a --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/create_workflow.php @@ -0,0 +1,98 @@ +setParent($formattedParent) + ->setWorkflow($workflow) + ->setWorkflowId($workflowId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $workflowsClient->createWorkflow($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Workflow $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); + $workflowId = '[WORKFLOW_ID]'; + + create_workflow_sample($formattedParent, $workflowId); +} +// [END workflows_v1_generated_Workflows_CreateWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/delete_workflow.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/delete_workflow.php new file mode 100644 index 00000000000..edc2ce8f71e --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/delete_workflow.php @@ -0,0 +1,83 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $workflowsClient->deleteWorkflow($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + delete_workflow_sample($formattedName); +} +// [END workflows_v1_generated_Workflows_DeleteWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_location.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_location.php new file mode 100644 index 00000000000..79c1ad34c47 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END workflows_v1_generated_Workflows_GetLocation_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_workflow.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_workflow.php new file mode 100644 index 00000000000..63f4be24591 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/get_workflow.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Workflow $response */ + $response = $workflowsClient->getWorkflow($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + get_workflow_sample($formattedName); +} +// [END workflows_v1_generated_Workflows_GetWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_locations.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_locations.php new file mode 100644 index 00000000000..1e682ff7694 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END workflows_v1_generated_Workflows_ListLocations_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_workflows.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_workflows.php new file mode 100644 index 00000000000..6b7e11596d6 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/list_workflows.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $workflowsClient->listWorkflows($request); + + /** @var Workflow $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); + + list_workflows_sample($formattedParent); +} +// [END workflows_v1_generated_Workflows_ListWorkflows_sync] diff --git a/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/update_workflow.php b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/update_workflow.php new file mode 100644 index 00000000000..ca57313b951 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/samples/V1/WorkflowsClient/update_workflow.php @@ -0,0 +1,75 @@ +setWorkflow($workflow); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $workflowsClient->updateWorkflow($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Workflow $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END workflows_v1_generated_Workflows_UpdateWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1/src/V1/Client/WorkflowsClient.php b/owl-bot-staging/Workflows/v1/src/V1/Client/WorkflowsClient.php new file mode 100644 index 00000000000..e69de0bd8e8 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/src/V1/Client/WorkflowsClient.php @@ -0,0 +1,495 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/workflows_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/workflows_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/workflows_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/workflows_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; + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('cryptoKey')->render([ + 'project' => $project, + 'location' => $location, + 'keyRing' => $keyRing, + 'cryptoKey' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workflow + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * + * @return string The formatted workflow resource. + */ + public static function workflowName(string $project, string $location, string $workflow): string + { + return self::getPathTemplate('workflow')->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} + * - location: projects/{project}/locations/{location} + * - workflow: projects/{project}/locations/{location}/workflows/{workflow} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * 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 'workflows.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); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + * + * The async variant is {@see WorkflowsClient::createWorkflowAsync()} . + * + * @example samples/V1/WorkflowsClient/create_workflow.php + * + * @param CreateWorkflowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createWorkflow(CreateWorkflowRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateWorkflow', $request, $callOptions)->wait(); + } + + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * The async variant is {@see WorkflowsClient::deleteWorkflowAsync()} . + * + * @example samples/V1/WorkflowsClient/delete_workflow.php + * + * @param DeleteWorkflowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteWorkflow(DeleteWorkflowRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteWorkflow', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single workflow. + * + * The async variant is {@see WorkflowsClient::getWorkflowAsync()} . + * + * @example samples/V1/WorkflowsClient/get_workflow.php + * + * @param GetWorkflowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Workflow + * + * @throws ApiException Thrown if the API call fails. + */ + public function getWorkflow(GetWorkflowRequest $request, array $callOptions = []): Workflow + { + return $this->startApiCall('GetWorkflow', $request, $callOptions)->wait(); + } + + /** + * Lists workflows in a given project and location. + * The default order is not specified. + * + * The async variant is {@see WorkflowsClient::listWorkflowsAsync()} . + * + * @example samples/V1/WorkflowsClient/list_workflows.php + * + * @param ListWorkflowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listWorkflows(ListWorkflowsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListWorkflows', $request, $callOptions); + } + + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow might be created as a result of a + * successful update operation. In that case, the new revision is used + * in new workflow executions. + * + * The async variant is {@see WorkflowsClient::updateWorkflowAsync()} . + * + * @example samples/V1/WorkflowsClient/update_workflow.php + * + * @param UpdateWorkflowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateWorkflow(UpdateWorkflowRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateWorkflow', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see WorkflowsClient::getLocationAsync()} . + * + * @example samples/V1/WorkflowsClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see WorkflowsClient::listLocationsAsync()} . + * + * @example samples/V1/WorkflowsClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * 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 PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/Workflows/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Workflows/v1/src/V1/gapic_metadata.json new file mode 100644 index 00000000000..01b0ddf71a1 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/src/V1/gapic_metadata.json @@ -0,0 +1,53 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.workflows.v1", + "libraryPackage": "Google\\Cloud\\Workflows\\V1", + "services": { + "Workflows": { + "clients": { + "grpc": { + "libraryClient": "WorkflowsGapicClient", + "rpcs": { + "CreateWorkflow": { + "methods": [ + "createWorkflow" + ] + }, + "DeleteWorkflow": { + "methods": [ + "deleteWorkflow" + ] + }, + "GetWorkflow": { + "methods": [ + "getWorkflow" + ] + }, + "ListWorkflows": { + "methods": [ + "listWorkflows" + ] + }, + "UpdateWorkflow": { + "methods": [ + "updateWorkflow" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_client_config.json b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_client_config.json new file mode 100644 index 00000000000..cceb3762833 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_client_config.json @@ -0,0 +1,57 @@ +{ + "interfaces": { + "google.cloud.workflows.v1.Workflows": { + "retry_codes": { + "no_retry_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + } + }, + "methods": { + "CreateWorkflow": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteWorkflow": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetWorkflow": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListWorkflows": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UpdateWorkflow": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_descriptor_config.php b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_descriptor_config.php new file mode 100644 index 00000000000..c4b42c20751 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_descriptor_config.php @@ -0,0 +1,137 @@ + [ + 'google.cloud.workflows.v1.Workflows' => [ + 'CreateWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Workflows\V1\Workflow', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Workflows\V1\Workflow', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'workflow.name', + 'fieldAccessors' => [ + 'getWorkflow', + 'getName', + ], + ], + ], + ], + 'GetWorkflow' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Workflows\V1\Workflow', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListWorkflows' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getWorkflows', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Workflows\V1\ListWorkflowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}', + 'location' => 'projects/{project}/locations/{location}', + 'workflow' => 'projects/{project}/locations/{location}/workflows/{workflow}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_rest_client_config.php b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_rest_client_config.php new file mode 100644 index 00000000000..0ce03d0f8a9 --- /dev/null +++ b/owl-bot-staging/Workflows/v1/src/V1/resources/workflows_rest_client_config.php @@ -0,0 +1,129 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.workflows.v1.Workflows' => [ + 'CreateWorkflow' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/workflows', + 'body' => 'workflow', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'workflow_id', + ], + ], + 'DeleteWorkflow' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/workflows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkflow' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/workflows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListWorkflows' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/workflows', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateWorkflow' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{workflow.name=projects/*/locations/*/workflows/*}', + 'body' => 'workflow', + 'placeholders' => [ + 'workflow.name' => [ + 'getters' => [ + 'getWorkflow', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Workflows/v1/tests/Unit/V1/Client/WorkflowsClientTest.php b/owl-bot-staging/Workflows/v1/tests/Unit/V1/Client/WorkflowsClientTest.php new file mode 100644 index 00000000000..ebc6ac2d7fd --- /dev/null +++ b/owl-bot-staging/Workflows/v1/tests/Unit/V1/Client/WorkflowsClientTest.php @@ -0,0 +1,829 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WorkflowsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WorkflowsClient($options); + } + + /** @test */ + public function createWorkflowTest() + { + $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/createWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $cryptoKeyName = 'cryptoKeyName-184663511'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $expectedResponse->setCryptoKeyName($cryptoKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $workflow = new Workflow(); + $workflowId = 'workflowId1712917915'; + $request = (new CreateWorkflowRequest()) + ->setParent($formattedParent) + ->setWorkflow($workflow) + ->setWorkflowId($workflowId); + $response = $gapicClient->createWorkflow($request); + $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.workflows.v1.Workflows/CreateWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflow(); + $this->assertProtobufEquals($workflow, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflowId(); + $this->assertProtobufEquals($workflowId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); + $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 createWorkflowExceptionTest() + { + $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/createWorkflowTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $workflow = new Workflow(); + $workflowId = 'workflowId1712917915'; + $request = (new CreateWorkflowRequest()) + ->setParent($formattedParent) + ->setWorkflow($workflow) + ->setWorkflowId($workflowId); + $response = $gapicClient->createWorkflow($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); + 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 deleteWorkflowTest() + { + $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/deleteWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new DeleteWorkflowRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteWorkflow($request); + $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.workflows.v1.Workflows/DeleteWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); + $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 deleteWorkflowExceptionTest() + { + $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/deleteWorkflowTest'); + $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 + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new DeleteWorkflowRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteWorkflow($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); + 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 getWorkflowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $revisionId2 = 'revisionId2-100208654'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $cryptoKeyName = 'cryptoKeyName-184663511'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId2); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $expectedResponse->setCryptoKeyName($cryptoKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new GetWorkflowRequest()) + ->setName($formattedName); + $response = $gapicClient->getWorkflow($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.v1.Workflows/GetWorkflow', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkflowExceptionTest() + { + $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 + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $request = (new GetWorkflowRequest()) + ->setName($formattedName); + try { + $gapicClient->getWorkflow($request); + // 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()); + } + + /** @test */ + public function listWorkflowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowsElement = new Workflow(); + $workflows = [ + $workflowsElement, + ]; + $expectedResponse = new ListWorkflowsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflows($workflows); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListWorkflowsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listWorkflows($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflows()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.v1.Workflows/ListWorkflows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkflowsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListWorkflowsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listWorkflows($request); + // 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()); + } + + /** @test */ + public function updateWorkflowTest() + { + $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/updateWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $cryptoKeyName = 'cryptoKeyName-184663511'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $expectedResponse->setCryptoKeyName($cryptoKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $workflow = new Workflow(); + $request = (new UpdateWorkflowRequest()) + ->setWorkflow($workflow); + $response = $gapicClient->updateWorkflow($request); + $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.workflows.v1.Workflows/UpdateWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getWorkflow(); + $this->assertProtobufEquals($workflow, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); + $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 updateWorkflowExceptionTest() + { + $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/updateWorkflowTest'); + $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 + $workflow = new Workflow(); + $request = (new UpdateWorkflowRequest()) + ->setWorkflow($workflow); + $response = $gapicClient->updateWorkflow($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); + 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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $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); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // 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()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $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); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // 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()); + } + + /** @test */ + public function createWorkflowAsyncTest() + { + $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/createWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $cryptoKeyName = 'cryptoKeyName-184663511'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $expectedResponse->setCryptoKeyName($cryptoKeyName); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $workflow = new Workflow(); + $workflowId = 'workflowId1712917915'; + $request = (new CreateWorkflowRequest()) + ->setParent($formattedParent) + ->setWorkflow($workflow) + ->setWorkflowId($workflowId); + $response = $gapicClient->createWorkflowAsync($request)->wait(); + $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.workflows.v1.Workflows/CreateWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflow(); + $this->assertProtobufEquals($workflow, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflowId(); + $this->assertProtobufEquals($workflowId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); + $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()); + } +} diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/V1Beta/Workflows.php b/owl-bot-staging/Workflows/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/V1Beta/Workflows.php new file mode 100644 index 00000000000..15098a62f95 Binary files /dev/null and b/owl-bot-staging/Workflows/v1beta/proto/src/GPBMetadata/Google/Cloud/Workflows/V1Beta/Workflows.php differ diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/CreateWorkflowRequest.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/CreateWorkflowRequest.php new file mode 100644 index 00000000000..1e24d43bf70 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/CreateWorkflowRequest.php @@ -0,0 +1,175 @@ +google.cloud.workflows.v1beta.CreateWorkflowRequest + */ +class CreateWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow = null; + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @type \Google\Cloud\Workflows\V1beta\Workflow $workflow + * Required. Workflow to be created. + * @type string $workflow_id + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\V1beta\Workflow|null + */ + public function getWorkflow() + { + return $this->workflow; + } + + public function hasWorkflow() + { + return isset($this->workflow); + } + + public function clearWorkflow() + { + unset($this->workflow); + } + + /** + * Required. Workflow to be created. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\V1beta\Workflow $var + * @return $this + */ + public function setWorkflow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1beta\Workflow::class); + $this->workflow = $var; + + return $this; + } + + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getWorkflowId() + { + return $this->workflow_id; + } + + /** + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * + * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setWorkflowId($var) + { + GPBUtil::checkString($var, True); + $this->workflow_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/DeleteWorkflowRequest.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/DeleteWorkflowRequest.php new file mode 100644 index 00000000000..8eed6f4b51e --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/DeleteWorkflowRequest.php @@ -0,0 +1,73 @@ +google.cloud.workflows.v1beta.DeleteWorkflowRequest + */ +class DeleteWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/GetWorkflowRequest.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/GetWorkflowRequest.php new file mode 100644 index 00000000000..aa97008d302 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/GetWorkflowRequest.php @@ -0,0 +1,72 @@ +google.cloud.workflows.v1beta.GetWorkflowRequest + */ +class GetWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsRequest.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsRequest.php new file mode 100644 index 00000000000..a7864f89afd --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsRequest.php @@ -0,0 +1,245 @@ +google.cloud.workflows.v1beta.ListWorkflowsRequest + */ +class ListWorkflowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @type int $page_size + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @type string $page_token + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @type string $filter + * Filter to restrict results to specific workflows. + * @type string $order_by + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filter to restrict results to specific workflows. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsResponse.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsResponse.php new file mode 100644 index 00000000000..50f2cadd032 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/ListWorkflowsResponse.php @@ -0,0 +1,141 @@ +google.cloud.workflows.v1beta.ListWorkflowsResponse + */ +class ListWorkflowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The workflows which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; + */ + private $workflows; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Workflows\V1beta\Workflow>|\Google\Protobuf\Internal\RepeatedField $workflows + * The workflows which match the request. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Unreachable resources. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The workflows which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWorkflows() + { + return $this->workflows; + } + + /** + * The workflows which match the request. + * + * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; + * @param array<\Google\Cloud\Workflows\V1beta\Workflow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWorkflows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\V1beta\Workflow::class); + $this->workflows = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Unreachable resources. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/OperationMetadata.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/OperationMetadata.php new file mode 100644 index 00000000000..b4e7df56874 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/OperationMetadata.php @@ -0,0 +1,223 @@ +google.cloud.workflows.v1beta.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + protected $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + protected $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + protected $verb = ''; + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + */ + protected $api_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * @type string $api_version + * API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * API version used to start the operation. + * + * Generated from protobuf field string api_version = 5; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/UpdateWorkflowRequest.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/UpdateWorkflowRequest.php new file mode 100644 index 00000000000..eedfd1e55dd --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/UpdateWorkflowRequest.php @@ -0,0 +1,127 @@ +google.cloud.workflows.v1beta.UpdateWorkflowRequest + */ +class UpdateWorkflowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $workflow = null; + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Workflows\V1beta\Workflow $workflow + * Required. Workflow to be updated. + * @type \Google\Protobuf\FieldMask $update_mask + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Workflows\V1beta\Workflow|null + */ + public function getWorkflow() + { + return $this->workflow; + } + + public function hasWorkflow() + { + return isset($this->workflow); + } + + public function clearWorkflow() + { + unset($this->workflow); + } + + /** + * Required. Workflow to be updated. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Workflows\V1beta\Workflow $var + * @return $this + */ + public function setWorkflow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1beta\Workflow::class); + $this->workflow = $var; + + return $this; + } + + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow.php new file mode 100644 index 00000000000..b4dcfbd75c4 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow.php @@ -0,0 +1,503 @@ +google.cloud.workflows.v1beta.Workflow + */ +class Workflow extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following fields of a workflow: + * - `source_code` + * - `service_account` + * The format is "000001-a4d", where the first 6 characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * 3 hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_id = ''; + /** + * Output only. The timestamp of when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The last update timestamp of the workflow. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The timestamp that the latest revision of the workflow + * was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $revision_create_time = null; + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * Name of the service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} + * Using `-` as a wildcard for the `{project}` will infer the project from + * the account. The `{account}` value can be the `email` address or the + * `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + */ + protected $service_account = ''; + protected $source_code; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @type string $description + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * @type int $state + * Output only. State of the workflow deployment. + * @type string $revision_id + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following fields of a workflow: + * - `source_code` + * - `service_account` + * The format is "000001-a4d", where the first 6 characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * 3 hexadecimal random characters. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp of when the workflow was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The last update timestamp of the workflow. + * @type \Google\Protobuf\Timestamp $revision_create_time + * Output only. The timestamp that the latest revision of the workflow + * was created. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores and dashes. Label keys must start with a letter. + * International characters are allowed. + * @type string $service_account + * Name of the service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} + * Using `-` as a wildcard for the `{project}` will infer the project from + * the account. The `{account}` value can be the `email` address or the + * `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * @type string $source_contents + * Workflow code to be executed. The size limit is 32KB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the workflow. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the workflow provided by the user. + * Must be at most 1000 unicode characters long. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the workflow deployment. + * + * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Workflows\V1beta\Workflow\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following fields of a workflow: + * - `source_code` + * - `service_account` + * The format is "000001-a4d", where the first 6 characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * 3 hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRevisionId() + { + return $this->revision_id; + } + + /** + * Output only. The revision of the workflow. + * A new revision of a workflow is created as a result of updating the + * following fields of a workflow: + * - `source_code` + * - `service_account` + * The format is "000001-a4d", where the first 6 characters define + * the zero-padded revision ordinal number. They are followed by a hyphen and + * 3 hexadecimal random characters. + * + * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRevisionId($var) + { + GPBUtil::checkString($var, True); + $this->revision_id = $var; + + return $this; + } + + /** + * Output only. The timestamp of when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp of when the workflow was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The last update timestamp of the workflow. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The last update timestamp of the workflow. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The timestamp that the latest revision of the workflow + * was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRevisionCreateTime() + { + return $this->revision_create_time; + } + + public function hasRevisionCreateTime() + { + return isset($this->revision_create_time); + } + + public function clearRevisionCreateTime() + { + unset($this->revision_create_time); + } + + /** + * Output only. The timestamp that the latest revision of the workflow + * was created. + * + * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRevisionCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->revision_create_time = $var; + + return $this; + } + + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels associated with this workflow. + * Labels can contain at most 64 entries. Keys and values can be no longer + * than 63 characters and can only contain lowercase letters, numeric + * characters, underscores and dashes. Label keys must start with a letter. + * International characters are allowed. + * + * Generated from protobuf field map labels = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Name of the service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} + * Using `-` as a wildcard for the `{project}` will infer the project from + * the account. The `{account}` value can be the `email` address or the + * `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Name of the service account associated with the latest workflow version. + * This service account represents the identity of the workflow and determines + * what permissions the workflow has. + * Format: projects/{project}/serviceAccounts/{account} + * Using `-` as a wildcard for the `{project}` will infer the project from + * the account. The `{account}` value can be the `email` address or the + * `unique_id` of the service account. + * If not provided, workflow will use the project's default service account. + * Modifying this field for an existing workflow results in a new workflow + * revision. + * + * Generated from protobuf field string service_account = 9; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + + /** + * Workflow code to be executed. The size limit is 32KB. + * + * Generated from protobuf field string source_contents = 10; + * @return string + */ + public function getSourceContents() + { + return $this->readOneof(10); + } + + public function hasSourceContents() + { + return $this->hasOneof(10); + } + + /** + * Workflow code to be executed. The size limit is 32KB. + * + * Generated from protobuf field string source_contents = 10; + * @param string $var + * @return $this + */ + public function setSourceContents($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * @return string + */ + public function getSourceCode() + { + return $this->whichOneof("source_code"); + } + +} + diff --git a/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow/State.php b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow/State.php new file mode 100644 index 00000000000..ded042b45d2 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/proto/src/Google/Cloud/Workflows/V1beta/Workflow/State.php @@ -0,0 +1,58 @@ +google.cloud.workflows.v1beta.Workflow.State + */ +class State +{ + /** + * Invalid state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The workflow has been deployed successfully and is serving. + * + * Generated from protobuf enum ACTIVE = 1; + */ + const ACTIVE = 1; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ACTIVE => 'ACTIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Workflows\V1beta\Workflow_State::class); + diff --git a/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/create_workflow.php b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/create_workflow.php new file mode 100644 index 00000000000..e94ec5e8599 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/create_workflow.php @@ -0,0 +1,93 @@ +createWorkflow($formattedParent, $workflow, $workflowId); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Workflow $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); + $workflowId = '[WORKFLOW_ID]'; + + create_workflow_sample($formattedParent, $workflowId); +} +// [END workflows_v1beta_generated_Workflows_CreateWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/delete_workflow.php b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/delete_workflow.php new file mode 100644 index 00000000000..4b3550d644b --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/delete_workflow.php @@ -0,0 +1,78 @@ +deleteWorkflow($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + delete_workflow_sample($formattedName); +} +// [END workflows_v1beta_generated_Workflows_DeleteWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/get_workflow.php b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/get_workflow.php new file mode 100644 index 00000000000..b5c783be1c7 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/get_workflow.php @@ -0,0 +1,67 @@ +getWorkflow($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + + get_workflow_sample($formattedName); +} +// [END workflows_v1beta_generated_Workflows_GetWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/list_workflows.php b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/list_workflows.php new file mode 100644 index 00000000000..41e38e819ca --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/list_workflows.php @@ -0,0 +1,73 @@ +listWorkflows($formattedParent); + + /** @var Workflow $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); + + list_workflows_sample($formattedParent); +} +// [END workflows_v1beta_generated_Workflows_ListWorkflows_sync] diff --git a/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/update_workflow.php b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/update_workflow.php new file mode 100644 index 00000000000..a96fcbed886 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/samples/V1beta/WorkflowsClient/update_workflow.php @@ -0,0 +1,72 @@ +updateWorkflow($workflow); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Workflow $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END workflows_v1beta_generated_Workflows_UpdateWorkflow_sync] diff --git a/owl-bot-staging/Workflows/v1beta/src/V1beta/Gapic/WorkflowsGapicClient.php b/owl-bot-staging/Workflows/v1beta/src/V1beta/Gapic/WorkflowsGapicClient.php new file mode 100644 index 00000000000..80b599e4264 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/src/V1beta/Gapic/WorkflowsGapicClient.php @@ -0,0 +1,723 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $workflow = new Workflow(); + * $workflowId = 'workflow_id'; + * $operationResponse = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); + * $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 = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'createWorkflow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @experimental + * + * @deprecated This class will be removed in the next major version update. + */ +class WorkflowsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.workflows.v1beta.Workflows'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'workflows.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'workflows.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 static $locationNameTemplate; + + private static $workflowNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/workflows_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/workflows_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/workflows_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/workflows_rest_client_config.php', + ], + ], + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getWorkflowNameTemplate() + { + if (self::$workflowNameTemplate == null) { + self::$workflowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}'); + } + + return self::$workflowNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'workflow' => self::getWorkflowNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a workflow + * resource. + * + * @param string $project + * @param string $location + * @param string $workflow + * + * @return string The formatted workflow resource. + * + * @experimental + */ + public static function workflowName($project, $location, $workflow) + { + return self::getWorkflowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'workflow' => $workflow, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - workflow: projects/{project}/locations/{location}/workflows/{workflow} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 'workflows.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. + * + * Sample code: + * ``` + * $workflowsClient = new WorkflowsClient(); + * try { + * $formattedParent = $workflowsClient->locationName('[PROJECT]', '[LOCATION]'); + * $workflow = new Workflow(); + * $workflowId = 'workflow_id'; + * $operationResponse = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); + * $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 = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'createWorkflow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * @param string $parent Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param Workflow $workflow Required. Workflow to be created. + * @param string $workflowId Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * @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 + * + * @experimental + */ + public function createWorkflow($parent, $workflow, $workflowId, array $optionalArgs = []) + { + $request = new CreateWorkflowRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setWorkflow($workflow); + $request->setWorkflowId($workflowId); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * Sample code: + * ``` + * $workflowsClient = new WorkflowsClient(); + * try { + * $formattedName = $workflowsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + * $operationResponse = $workflowsClient->deleteWorkflow($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $workflowsClient->deleteWorkflow($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'deleteWorkflow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @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 + * + * @experimental + */ + public function deleteWorkflow($name, array $optionalArgs = []) + { + $request = new DeleteWorkflowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets details of a single Workflow. + * + * Sample code: + * ``` + * $workflowsClient = new WorkflowsClient(); + * try { + * $formattedName = $workflowsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + * $response = $workflowsClient->getWorkflow($formattedName); + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @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\Cloud\Workflows\V1beta\Workflow + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getWorkflow($name, array $optionalArgs = []) + { + $request = new GetWorkflowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetWorkflow', Workflow::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists Workflows in a given project and location. + * The default order is not specified. + * + * Sample code: + * ``` + * $workflowsClient = new WorkflowsClient(); + * try { + * $formattedParent = $workflowsClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $workflowsClient->listWorkflows($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $workflowsClient->listWorkflows($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * @param string $parent Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Filter to restrict results to specific workflows. + * @type string $orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * @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\PagedListResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function listWorkflows($parent, array $optionalArgs = []) + { + $request = new ListWorkflowsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListWorkflows', $optionalArgs, ListWorkflowsResponse::class, $request); + } + + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow may be created as a result of a + * successful update operation. In that case, such revision will be used + * in new workflow executions. + * + * Sample code: + * ``` + * $workflowsClient = new WorkflowsClient(); + * try { + * $workflow = new Workflow(); + * $operationResponse = $workflowsClient->updateWorkflow($workflow); + * $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 = $workflowsClient->updateWorkflow($workflow); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'updateWorkflow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $workflowsClient->close(); + * } + * ``` + * + * @param Workflow $workflow Required. Workflow to be updated. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * @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 + * + * @experimental + */ + public function updateWorkflow($workflow, array $optionalArgs = []) + { + $request = new UpdateWorkflowRequest(); + $requestParamHeaders = []; + $request->setWorkflow($workflow); + $requestParamHeaders['workflow.name'] = $workflow->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/Workflows/v1beta/src/V1beta/WorkflowsClient.php b/owl-bot-staging/Workflows/v1beta/src/V1beta/WorkflowsClient.php new file mode 100644 index 00000000000..41014011c35 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/src/V1beta/WorkflowsClient.php @@ -0,0 +1,36 @@ + [ + 'google.cloud.workflows.v1beta.Workflows' => [ + 'CreateWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Workflows\V1beta\Workflow', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateWorkflow' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Workflows\V1beta\Workflow', + 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListWorkflows' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getWorkflows', + ], + ], + ], + ], +]; diff --git a/owl-bot-staging/Workflows/v1beta/src/V1beta/resources/workflows_rest_client_config.php b/owl-bot-staging/Workflows/v1beta/src/V1beta/resources/workflows_rest_client_config.php new file mode 100644 index 00000000000..35bd2027c0e --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/src/V1beta/resources/workflows_rest_client_config.php @@ -0,0 +1,129 @@ + [ + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.workflows.v1beta.Workflows' => [ + 'CreateWorkflow' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/workflows', + 'body' => 'workflow', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'workflow_id', + ], + ], + 'DeleteWorkflow' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetWorkflow' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListWorkflows' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/workflows', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateWorkflow' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{workflow.name=projects/*/locations/*/workflows/*}', + 'body' => 'workflow', + 'placeholders' => [ + 'workflow.name' => [ + 'getters' => [ + 'getWorkflow', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Workflows/v1beta/tests/Unit/V1beta/WorkflowsClientTest.php b/owl-bot-staging/Workflows/v1beta/tests/Unit/V1beta/WorkflowsClientTest.php new file mode 100644 index 00000000000..bafc07b3383 --- /dev/null +++ b/owl-bot-staging/Workflows/v1beta/tests/Unit/V1beta/WorkflowsClientTest.php @@ -0,0 +1,582 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return WorkflowsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new WorkflowsClient($options); + } + + /** @test */ + public function createWorkflowTest() + { + $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/createWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $workflow = new Workflow(); + $workflowId = 'workflowId1712917915'; + $response = $gapicClient->createWorkflow($formattedParent, $workflow, $workflowId); + $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.workflows.v1beta.Workflows/CreateWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflow(); + $this->assertProtobufEquals($workflow, $actualValue); + $actualValue = $actualApiRequestObject->getWorkflowId(); + $this->assertProtobufEquals($workflowId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); + $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 createWorkflowExceptionTest() + { + $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/createWorkflowTest'); + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $workflow = new Workflow(); + $workflowId = 'workflowId1712917915'; + $response = $gapicClient->createWorkflow($formattedParent, $workflow, $workflowId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); + 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 deleteWorkflowTest() + { + $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/deleteWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $response = $gapicClient->deleteWorkflow($formattedName); + $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.workflows.v1beta.Workflows/DeleteWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); + $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 deleteWorkflowExceptionTest() + { + $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/deleteWorkflowTest'); + $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 + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $response = $gapicClient->deleteWorkflow($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); + 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 getWorkflowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + $response = $gapicClient->getWorkflow($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.v1beta.Workflows/GetWorkflow', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getWorkflowExceptionTest() + { + $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 + $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); + try { + $gapicClient->getWorkflow($formattedName); + // 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()); + } + + /** @test */ + public function listWorkflowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $workflowsElement = new Workflow(); + $workflows = [ + $workflowsElement, + ]; + $expectedResponse = new ListWorkflowsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setWorkflows($workflows); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listWorkflows($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getWorkflows()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.workflows.v1beta.Workflows/ListWorkflows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listWorkflowsExceptionTest() + { + $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 + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listWorkflows($formattedParent); + // 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()); + } + + /** @test */ + public function updateWorkflowTest() + { + $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/updateWorkflowTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $description = 'description-1724546052'; + $revisionId = 'revisionId513861631'; + $serviceAccount = 'serviceAccount-1948028253'; + $sourceContents = 'sourceContents-1799875906'; + $expectedResponse = new Workflow(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $expectedResponse->setRevisionId($revisionId); + $expectedResponse->setServiceAccount($serviceAccount); + $expectedResponse->setSourceContents($sourceContents); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateWorkflowTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $workflow = new Workflow(); + $response = $gapicClient->updateWorkflow($workflow); + $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.workflows.v1beta.Workflows/UpdateWorkflow', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getWorkflow(); + $this->assertProtobufEquals($workflow, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); + $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 updateWorkflowExceptionTest() + { + $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/updateWorkflowTest'); + $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 + $workflow = new Workflow(); + $response = $gapicClient->updateWorkflow($workflow); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); + 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()); + } +}